#230 Fix the test suite
Merged by ppisar. Opened by fivaldi.
releng/ fivaldi/fedora-module-defaults fix_test_suite  into  main

Download 230.patch
  • Move the prints so it's clear in which phase we're in.
  • Support obsoletes module:stream.yaml format.
  • Merge obsoletes into a separate index (don't mix with the defaults).
  • Exclude test obsoletes.
  • Pre-tested with perl:5.30.yaml, see PR#229.

Signed-off-by: Filip Valder fvalder@redhat.com

@ppisar Please can you check this one? Then we can continue the PR#229.

Thanks a lot.

pretty please pagure-ci rebuild

Metadata Update from @ppisar:
- Request assigned

If you now require an obsoletes file name to contain a stream, then you should check for it in tests/validate.py. See code under "Filenames must match their contents" comment. You check for a module name with "expected_name != mmd.props.module_name", but there is no check for the stream in the file name.

Also an error message ('Module name "{}" doesn\'t match filename "{}.yaml"') under "expected_name != mmd.props.module_name" condition does not match the name:stream.yaml format. The error message must be adjusted. Don't forget that defaults still use name.yaml format.

Otherwise it looks good. Could you please address the two issues?

rebased onto 1fa54e295dda9bb2dccb66f816b7c4332aefb453

Thanks for review & comment, I fixed it like this:

--- a/tests/validate.py
+++ b/tests/validate.py
@@ -86,9 +86,17 @@ def do_validate(filename, obsoletes=False):
                 "<name>:<old_stream>.yaml"
             )
             return False, None
-        expected_name = expected_name.rsplit(":", maxsplit=1)[0]
+        expected_module_name, expected_stream = expected_name.rsplit(":", maxsplit=1)
+        if (expected_module_name != mmd.props.module_name
+                or expected_stream != mmd.props.module_stream):
+            error(
+                'Module name/stream "{}:{}" doesn\'t match filename "{}.yaml"'.format(
+                    mmd.props.module_name, mmd.props.module_stream, expected_name
+                )
+            )
+            return False, None
-    if expected_name != mmd.props.module_name:
+    elif expected_name != mmd.props.module_name:
         error(
             'Module name "{}" doesn\'t match filename "{}.yaml"'.format(
                 mmd.props.module_name, expected_name
@@ -234,6 +242,9 @@ def main():
         # Try merging module obsoletes into the module obsoletes index.
         for file in obsoletes_files:
             (_, mmd) = do_validate(file, obsoletes=True)
+            if not mmd:
+                result = os.EX_DATAERR
+                break
             idx_obsoletes.add_obsoletes(mmd)
     except GLib.Error as e:
         error("Could not merge all obsoletes: {}".format(e.message))

Pull-Request has been merged by ppisar

Applied to all Fedoras.

Metadata