From e7b4e49247097323d0ef07b5ca63759b5ab502ee Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Sat, 18 Feb 2017 17:37:07 +0100 Subject: Make usage of short_version/release consistent This removes irrelevant differences between the two test files, making it easier to observe similarities. --- ...nshift_master_facts_default_predicates_tests.py | 22 +++++++-------- ...nshift_master_facts_default_priorities_tests.py | 31 +++++++++++----------- 2 files changed, 26 insertions(+), 27 deletions(-) (limited to 'roles') diff --git a/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py b/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py index a33c183f6..1d6de616a 100644 --- a/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py +++ b/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py @@ -98,9 +98,9 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): def test_openshift_version(self): for regions_enabled in (True, False): - for release, deployment_type, default_predicates in TEST_VARS: - release = release + '.1' - yield self.check_defaults_version, release, deployment_type, default_predicates, regions_enabled + for version, deployment_type, default_predicates in TEST_VARS: + version = version + '.1' + yield self.check_defaults_version, version, deployment_type, default_predicates, regions_enabled def check_defaults_version(self, version, deployment_type, default_predicates, regions_enabled): @@ -143,8 +143,8 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): def test_short_version_defaults(self): for regions_enabled in (True, False): - for release, deployment_type, default_predicates in TEST_VARS: - yield self.check_defaults_short_version, release, deployment_type, default_predicates, regions_enabled + for short_version, deployment_type, default_predicates in TEST_VARS: + yield self.check_defaults_short_version, short_version, deployment_type, default_predicates, regions_enabled def check_defaults_short_version(self, short_version, deployment_type, default_predicates, regions_enabled): @@ -160,8 +160,8 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): def test_short_version_kwarg(self): for regions_enabled in (True, False): - for release, deployment_type, default_predicates in TEST_VARS: - yield self.check_defaults_short_version_kwarg, release, deployment_type, default_predicates, regions_enabled + for short_version, deployment_type, default_predicates in TEST_VARS: + yield self.check_defaults_short_version_kwarg, short_version, deployment_type, default_predicates, regions_enabled def check_defaults_short_version_kwarg(self, short_version, deployment_type, default_predicates, regions_enabled): @@ -177,8 +177,8 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): def test_deployment_type_kwarg(self): for regions_enabled in (True, False): - for release, deployment_type, default_predicates in TEST_VARS: - yield self.check_defaults_deployment_type_kwarg, release, deployment_type, default_predicates, regions_enabled + for short_version, deployment_type, default_predicates in TEST_VARS: + yield self.check_defaults_deployment_type_kwarg, short_version, deployment_type, default_predicates, regions_enabled def check_defaults_deployment_type_kwarg(self, short_version, deployment_type, default_predicates, regions_enabled): @@ -194,8 +194,8 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): def test_only_kwargs(self): for regions_enabled in (True, False): - for release, deployment_type, default_predicates in TEST_VARS: - yield self.check_defaults_only_kwargs, release, deployment_type, default_predicates, regions_enabled + for short_version, deployment_type, default_predicates in TEST_VARS: + yield self.check_defaults_only_kwargs, short_version, deployment_type, default_predicates, regions_enabled def check_defaults_only_kwargs(self, short_version, deployment_type, default_predicates, regions_enabled): diff --git a/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py b/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py index 326af3e13..32edc4c34 100644 --- a/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py +++ b/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py @@ -86,14 +86,14 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): def test_openshift_version(self): for zones_enabled in (True, False): - for release, deployment_type, default_priorities in TEST_VARS: - release = release + '.1' - yield self.check_defaults_version, release, deployment_type, default_priorities, zones_enabled + for version, deployment_type, default_priorities in TEST_VARS: + version = version + '.1' + yield self.check_defaults_version, version, deployment_type, default_priorities, zones_enabled - def check_defaults_version(self, release, deployment_type, default_priorities, + def check_defaults_version(self, version, deployment_type, default_priorities, zones_enabled): facts = copy.deepcopy(self.default_facts) - facts['openshift_version'] = release + facts['openshift_version'] = version facts['openshift']['common']['deployment_type'] = deployment_type results = self.lookup.run(None, variables=facts, zones_enabled=zones_enabled) if zones_enabled: @@ -109,8 +109,7 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): def test_v_release_defaults(self): for zones_enabled in (True, False): for release, deployment_type, default_priorities in TEST_VARS: - release = 'v' + release - yield self.check_defaults_release, release, deployment_type, default_priorities, zones_enabled + yield self.check_defaults_release, 'v' + release, deployment_type, default_priorities, zones_enabled def test_trunc_openshift_release(self): for release, deployment_type, default_priorities in TEST_VARS: @@ -133,10 +132,10 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): for short_version, deployment_type, default_priorities in TEST_VARS: yield self.check_defaults_short_version, short_version, deployment_type, default_priorities, zones_enabled - def check_defaults_short_version(self, release, deployment_type, + def check_defaults_short_version(self, short_version, deployment_type, default_priorities, zones_enabled): facts = copy.deepcopy(self.default_facts) - facts['openshift']['common']['short_version'] = release + facts['openshift']['common']['short_version'] = short_version facts['openshift']['common']['deployment_type'] = deployment_type results = self.lookup.run(None, variables=facts, zones_enabled=zones_enabled) if zones_enabled: @@ -144,18 +143,18 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): else: assert_equal(results, default_priorities) - def test_release_kwarg(self): + def test_short_version_kwarg(self): for zones_enabled in (True, False): for short_version, deployment_type, default_priorities in TEST_VARS: yield self.check_defaults_short_version_kwarg, short_version, deployment_type, default_priorities, zones_enabled - def check_defaults_short_version_kwarg(self, release, deployment_type, + def check_defaults_short_version_kwarg(self, short_version, deployment_type, default_priorities, zones_enabled): facts = copy.deepcopy(self.default_facts) facts['openshift']['common']['deployment_type'] = deployment_type results = self.lookup.run(None, variables=facts, zones_enabled=zones_enabled, - short_version=release) + short_version=short_version) if zones_enabled: assert_equal(results, default_priorities + [ZONE_PRIORITY]) else: @@ -166,10 +165,10 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): for short_version, deployment_type, default_priorities in TEST_VARS: yield self.check_defaults_deployment_type_kwarg, short_version, deployment_type, default_priorities, zones_enabled - def check_defaults_deployment_type_kwarg(self, release, deployment_type, + def check_defaults_deployment_type_kwarg(self, short_version, deployment_type, default_priorities, zones_enabled): facts = copy.deepcopy(self.default_facts) - facts['openshift']['common']['short_version'] = release + facts['openshift']['common']['short_version'] = short_version results = self.lookup.run(None, variables=facts, zones_enabled=zones_enabled, deployment_type=deployment_type) @@ -183,12 +182,12 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): for short_version, deployment_type, default_priorities in TEST_VARS: yield self.check_defaults_only_kwargs, short_version, deployment_type, default_priorities, zones_enabled - def check_defaults_only_kwargs(self, release, deployment_type, + def check_defaults_only_kwargs(self, short_version, deployment_type, default_priorities, zones_enabled): facts = copy.deepcopy(self.default_facts) results = self.lookup.run(None, variables=facts, zones_enabled=zones_enabled, - short_version=release, + short_version=short_version, deployment_type=deployment_type) if zones_enabled: assert_equal(results, default_priorities + [ZONE_PRIORITY]) -- cgit v1.2.3