]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
suite/tests: add distroversion
authorDan Mick <dan.mick@redhat.com>
Tue, 19 Jul 2016 05:21:01 +0000 (22:21 -0700)
committerDan Mick <dan.mick@redhat.com>
Tue, 26 Jul 2016 17:44:36 +0000 (10:44 -0700)
Signed-off-by: Dan Mick <dan.mick@redhat.com>
scripts/suite.py
teuthology/suite/placeholder.py
teuthology/suite/run.py
teuthology/suite/test/test_placeholder.py
teuthology/suite/test/test_run_.py
teuthology/suite/test/test_util.py
teuthology/suite/util.py

index ed5949849a8e5fe6d924ec0aef1ec9225c9bedeb..5a1ff7cc5bbe42cc08ae98b6708bc2dc7902fcf6 100644 (file)
@@ -54,7 +54,7 @@ Standard arguments:
                               Machine type [default: {default_machine_type}]
   -d <distro>, --distro <distro>
                               Distribution to run against
-  -D <distroversion>, --distroversion <distroversion>
+  -D <distroversion>, --distro-version <distroversion>
                               Distro version to run against
   --suite-branch <suite_branch>
                               Use this suite branch instead of the ceph branch
index 198208b7d419b458aaea6c8c25572de4effc1569..d10a0d08066f96199672b40fffc3dd201a4ac81f 100644 (file)
@@ -52,7 +52,7 @@ dict_templ = {
     'machine_type': Placeholder('machine_type'),
     'nuke-on-error': True,
     'os_type': Placeholder('distro'),
-    'os_version': Placeholder('distroversion'),
+    'os_version': Placeholder('distro_version'),
     'overrides': {
         'admin_socket': {
             'branch': Placeholder('ceph_branch'),
index e3ca178a2199d96ddec967ae0092e839a11548be..4c9b1a750e8cf41817673df56874e23621d050a2 100644 (file)
@@ -95,7 +95,7 @@ class Run(object):
             teuthology_branch=teuthology_branch,
             machine_type=self.args.machine_type,
             distro=self.args.distro,
-            distroversion=self.args.distroversion,
+            distro_version=self.args.distro_version,
             archive_upload=config.archive_upload,
             archive_upload_key=config.archive_upload_key,
         )
@@ -157,7 +157,7 @@ class Run(object):
             try:
                 ceph_version = util.package_version_for_hash(
                     ceph_hash, self.args.kernel_flavor, self.args.distro,
-                    self.args.distroversion, self.args.machine_type,
+                    self.args.distro_version, self.args.machine_type,
                 )
             except Exception as exc:
                 util.schedule_fail(str(exc), self.name)
index 033687083d487037d099a5149d071c2f13549e68..51683e642095bec1e293a4e96c13e94e32853584 100644 (file)
@@ -15,6 +15,7 @@ class TestPlaceholder(object):
             teuthology_branch='teuthology_branch',
             machine_type='machine_type',
             distro='distro',
+            distro_version='distro_version',
             archive_upload='archive_upload',
             archive_upload_key='archive_upload_key',
         )
@@ -38,6 +39,7 @@ class TestPlaceholder(object):
             archive_upload='archive_upload',
             archive_upload_key='archive_upload_key',
             distro=None,
+            distro_version=None,
         )
         output_dict = substitute_placeholders(dict_templ, input_dict)
         assert 'os_type' not in output_dict
index cd51684152de8027a0e73b1ab8762cab01675017..182e1ed3a2e2558d5f271b10ce090c88e2d79191 100644 (file)
@@ -144,6 +144,7 @@ class TestScheduleSuite(object):
             kernel_branch=None,
             kernel_flavor='kernel_flavor',
             distro='ubuntu',
+            distro_version='14.04',
             machine_type='machine_type',
             base_yaml_paths=list(),
         )
@@ -196,7 +197,7 @@ class TestScheduleSuite(object):
         count = runobj.schedule_suite()
         assert(count == 1)
         m_has_packages_for_distro.assert_has_calls(
-            [call('ceph_sha1', 'ubuntu', 'basic', {})],
+            [call('ceph_sha1', 'ubuntu', '14.04', 'basic', {})],
         )
         frags = (frag1_read_output, frag2_read_output)
         expected_job = dict(
@@ -321,7 +322,7 @@ class TestScheduleSuite(object):
         count = runobj.schedule_suite()
         assert count == 1
         m_has_packages_for_distro.assert_has_calls(
-            [call('ceph_sha1' + '^' * i, 'ubuntu', 'basic', {})
+            [call('ceph_sha1' + '^' * i, 'ubuntu', '14.04', 'basic', {})
              for i in xrange(NUM_FAILS+1)]
         )
         m_find_git_parent.assert_has_calls(
index 8def09e375354776064b8801e8de89f5453fa1e5..d20ee83e2c46004207b854f5a1c4416bb87bcea6 100644 (file)
@@ -187,19 +187,22 @@ class TestMissingPackages(object):
     scheduled job will have missing packages in gitbuilder.
     """
     def setup(self):
-        package_versions = dict(
-            sha1=dict(
-                ubuntu=dict(
-                    basic="1.0",
-                )
-            )
-        )
+        package_versions = {
+            'sha1': {
+                'ubuntu': {
+                    '14.04': {
+                        'basic': '1.0'
+                    }
+                }
+            }
+        }
         self.pv = package_versions
 
     def test_os_in_package_versions(self):
         assert self.pv == util.get_package_versions(
             "sha1",
             "ubuntu",
+            "14.04",
             "basic",
             package_versions=self.pv
         )
@@ -210,11 +213,20 @@ class TestMissingPackages(object):
         result = util.get_package_versions(
             "sha1",
             "rhel",
+            "7.0",
             "basic",
             package_versions=self.pv
         )
         expected = deepcopy(self.pv)
-        expected['sha1'].update(dict(rhel=dict(basic="1.1")))
+        expected['sha1'].update(
+            {
+                'rhel': {
+                    '7.0': {
+                        'basic': '1.1'
+                    }
+                }
+            }
+        )
         assert result == expected
 
     @patch("teuthology.suite.util.package_version_for_hash")
@@ -224,6 +236,7 @@ class TestMissingPackages(object):
         result = util.get_package_versions(
             "sha1",
             "rhel",
+            "7.0",
             "basic",
             package_versions=self.pv
         )
@@ -235,6 +248,7 @@ class TestMissingPackages(object):
         result = util.get_package_versions(
             "sha1",
             "ubuntu",
+            "14.04",
             "basic",
         )
         expected = deepcopy(self.pv)
@@ -244,6 +258,7 @@ class TestMissingPackages(object):
         result = util.has_packages_for_distro(
             "sha1",
             "ubuntu",
+            "14.04",
             "basic",
             package_versions=self.pv,
         )
@@ -253,6 +268,7 @@ class TestMissingPackages(object):
         result = util.has_packages_for_distro(
             "sha1",
             "rhel",
+            "7.0",
             "basic",
             package_versions=self.pv,
         )
@@ -264,8 +280,8 @@ class TestMissingPackages(object):
         result = util.has_packages_for_distro(
             "sha1",
             "rhel",
-            "basic",
-        )
+            "7.0",
+            "basic",)
         assert not result
 
 
index 79eac7ef3da5bd934accab017b1fd62d8e3ae6a8..106f8bff6a35051d6fc8e3faf58e5813622d6534 100644 (file)
@@ -84,7 +84,7 @@ def get_worker(machine_type):
 
 def get_gitbuilder_hash(project='ceph', branch='master', flavor='basic',
                         machine_type='plana', distro='ubuntu',
-                        distroversion='14.04'):
+                        distro_version='14.04'):
     """
     Find the hash representing the head of the project's repository via
     querying a gitbuilder repo.
@@ -105,7 +105,7 @@ def get_gitbuilder_hash(project='ceph', branch='master', flavor='basic',
             branch=branch,
             flavor=flavor,
             os_type=distro,
-            os_version=distroversion,
+            os_version=distro_version,
             arch=arch,
         ),
     )
@@ -253,7 +253,7 @@ def get_branch_info(project, branch, project_owner='ceph'):
 
 
 def package_version_for_hash(hash, kernel_flavor='basic', distro='rhel',
-                             distroversion='7.0', machine_type='smithi'):
+                             distro_version='7.0', machine_type='smithi'):
     """
     Does what it says on the tin. Uses gitbuilder repos.
 
@@ -267,7 +267,7 @@ def package_version_for_hash(hash, kernel_flavor='basic', distro='rhel',
         dict(
             flavor=kernel_flavor,
             os_type=distro,
-            os_version=distroversion,
+            os_version=distro_version,
             arch=arch,
             sha1=hash,
         ),
@@ -382,7 +382,7 @@ def get_package_versions(sha1, os_type, os_version, flavor,
             sha1,
             flavor,
             distro=os_type,
-            distroversion=os_version,
+            distro_version=os_version,
         )
         flavors[flavor] = package_version
         os_versions[os_version] = flavors