]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
suite: support a suite consisting of multiple collections
authorSage Weil <sage@newdream.net>
Wed, 10 Aug 2011 20:34:38 +0000 (13:34 -0700)
committerSage Weil <sage@newdream.net>
Thu, 18 Aug 2011 23:30:08 +0000 (16:30 -0700)
suite = many collections, and maybe some shared files
collection = a collection of facets
facet = a config fragment

teuthology/suite.py

index fc27cc92a20bd727a0fa382798ff198ceab34b7c..26953eee93f2fe225246b1d63175cc2fc98c1517 100644 (file)
@@ -12,11 +12,16 @@ def main():
     parser = argparse.ArgumentParser(description="""
 Run a suite of ceph integration tests.
 
-A suite is a directory containing facets.
+A suite is a directory containing a subdirectory collections/
+containing collections.
+
+A collection is a directory containing facets.
 
 A facet is a directory containing config snippets.
 
-Running the suite means running teuthology for every configuration
+Running the suite means running teuthology for every collection.
+
+Running a collection means running teuthology for every configuration
 combination generated by taking one config snippet from each facet.
 
 Any config files passed on the command line will be used for every
@@ -60,46 +65,64 @@ combination, and will override anything in the suite.
         level=loglevel,
         )
 
-    facets = [
-        f for f in sorted(os.listdir(args.suite))
-        if not f.startswith('.')
-        and os.path.isdir(os.path.join(args.suite, f))
-        ]
-    facet_configs = (
-        [(f, name, os.path.join(args.suite, f, name))
-         for name in sorted(os.listdir(os.path.join(args.suite, f)))
-         if not name.startswith('.')
-         and name.endswith('.yaml')
-         ]
-        for f in facets
-        )
-    for configs in itertools.product(*facet_configs):
-        description=' '.join('{facet}:{name}'.format(facet=facet, name=name)
-                     for facet, name, path in configs)
-        log.info(
-            'Running teuthology-schedule with facets %s', description
-            )
-        arg = [
-            os.path.join(os.path.dirname(sys.argv[0]), 'teuthology-schedule'),
+    collection_dir = os.path.join(args.suite,'collections')
+    print collection_dir
+    if os.path.exists(collection_dir) and os.path.isdir(collection_dir):
+        collections = [
+            (os.path.join(collection_dir, f), f)
+            for f in sorted(os.listdir(collection_dir))
+            if not f.startswith('.')
+            and os.path.isdir(os.path.join(collection_dir, f))
             ]
-
-        if args.verbose:
-            arg.append('-v')
-
-        if args.owner:
-            arg.extend(['--owner', args.owner])
-
-        arg.extend([
-                '--name', args.name,
-                '--description', description,
-                '--',
-                ])
-
-        arg.extend(path for facet, name, path in configs)
-        arg.extend(args.config)
-        subprocess.check_call(
-            args=arg,
+    else:
+        # degenerate case; 'suite' is actually a single collection
+        collections = [(args.suite, 'none')]
+
+    for collection, collection_name in sorted(collections):
+        log.info('Collection %s in %s' % (collection_name, collection))
+        facets = [
+            f for f in sorted(os.listdir(collection))
+            if not f.startswith('.')
+            and os.path.isdir(os.path.join(collection, f))
+            ]
+        facet_configs = (
+            [(f, name, os.path.join(collection, f, name))
+             for name in sorted(os.listdir(os.path.join(collection, f)))
+             if not name.startswith('.')
+             and name.endswith('.yaml')
+             ]
+            for f in facets
             )
+        for configs in itertools.product(*facet_configs):
+            description = 'collection:%s ' % (collection_name);
+            description += ' '.join('{facet}:{name}'.format(
+                    facet=facet, name=name)
+                                 for facet, name, path in configs)
+            log.info(
+                'Running teuthology-schedule with facets %s', description
+                )
+            arg = [
+                os.path.join(os.path.dirname(sys.argv[0]), 'teuthology-schedule'),
+                ]
+
+            if args.verbose:
+                arg.append('-v')
+
+            if args.owner:
+                arg.extend(['--owner', args.owner])
+
+            arg.extend([
+                    '--name', args.name,
+                    '--description', description,
+                    '--',
+                    ])
+
+            arg.extend(path for facet, name, path in configs)
+            arg.extend(args.config)
+            print arg
+            subprocess.check_call(
+                args=arg,
+                )
 
 def ls():
     parser = argparse.ArgumentParser(description='List teuthology job results')