From b8cf83cb2dcf1e83fc2f9dc46aca8a827220f087 Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Mon, 18 Jul 2016 22:21:01 -0700 Subject: [PATCH] suite/tests: add distroversion Signed-off-by: Dan Mick --- scripts/suite.py | 2 +- teuthology/suite/placeholder.py | 2 +- teuthology/suite/run.py | 4 +-- teuthology/suite/test/test_placeholder.py | 2 ++ teuthology/suite/test/test_run_.py | 5 ++-- teuthology/suite/test/test_util.py | 36 ++++++++++++++++------- teuthology/suite/util.py | 10 +++---- 7 files changed, 40 insertions(+), 21 deletions(-) diff --git a/scripts/suite.py b/scripts/suite.py index ed5949849a..5a1ff7cc5b 100644 --- a/scripts/suite.py +++ b/scripts/suite.py @@ -54,7 +54,7 @@ Standard arguments: Machine type [default: {default_machine_type}] -d , --distro Distribution to run against - -D , --distroversion + -D , --distro-version Distro version to run against --suite-branch Use this suite branch instead of the ceph branch diff --git a/teuthology/suite/placeholder.py b/teuthology/suite/placeholder.py index 198208b7d4..d10a0d0806 100644 --- a/teuthology/suite/placeholder.py +++ b/teuthology/suite/placeholder.py @@ -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'), diff --git a/teuthology/suite/run.py b/teuthology/suite/run.py index e3ca178a21..4c9b1a750e 100644 --- a/teuthology/suite/run.py +++ b/teuthology/suite/run.py @@ -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) diff --git a/teuthology/suite/test/test_placeholder.py b/teuthology/suite/test/test_placeholder.py index 033687083d..51683e6420 100644 --- a/teuthology/suite/test/test_placeholder.py +++ b/teuthology/suite/test/test_placeholder.py @@ -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 diff --git a/teuthology/suite/test/test_run_.py b/teuthology/suite/test/test_run_.py index cd51684152..182e1ed3a2 100644 --- a/teuthology/suite/test/test_run_.py +++ b/teuthology/suite/test/test_run_.py @@ -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( diff --git a/teuthology/suite/test/test_util.py b/teuthology/suite/test/test_util.py index 8def09e375..d20ee83e2c 100644 --- a/teuthology/suite/test/test_util.py +++ b/teuthology/suite/test/test_util.py @@ -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 diff --git a/teuthology/suite/util.py b/teuthology/suite/util.py index 79eac7ef3d..106f8bff6a 100644 --- a/teuthology/suite/util.py +++ b/teuthology/suite/util.py @@ -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 -- 2.39.5