def test_empties_solitaries_indepent_and_usual_deps(): grouplist = [[[]], [['one']], [[]], [['two']], [[]], [['three']], [[]], [['four'], ['five'], ['six']], [[]], [['seven', 'eight', 'nine']], [[]]] assert_equals(list(flatten(combine_fixture_deps(grouplist))), [ 'four', 'five', 'six', 'one', 'two', 'three', 'seven', 'eight', 'nine' ])
def test_combine_fixtures_basic(): grouplist1 = [ [ ['single-node'], ['novaclient-users' , 'novaclient-network'], ['novaclient-images'] , ['novaclient-keys'], ['novaclient-flatnetwork'] ], [ ['single-node'], ['novaclient-users' , 'novaclient-network'], ['novaclient-images'], ['novaclient-keys'] ], [ ['single-node'], ['novaclient-users', 'novaclient-network'], ['novaclient-images'], ['novaclient-keys'], ['volume-services'], ['volume'] ] ] result = combine_fixture_deps(grouplist1) expected = ['single-node', 'novaclient-network', 'novaclient-users', 'novaclient-images', 'novaclient-keys', 'novaclient-flatnetwork', 'volume-services', 'volume'] assert_equals(list(flatten(result)), expected)
def run(self): """ Execute set of test bunches sequentially """ no_bunch_failed = True for bunch in self.bunch_list: collector = BunchXmlCollector() none_failed = True self.__set_current_bunch(bunch) stories = bunch.get_stories() setup_deps, teardown_deps = self.__get_fixture_deps(stories) try: setup_seq = dependencies.combine_fixture_deps(setup_deps) teardown_seq = dependencies.combine_fixture_deps(teardown_deps) except CyclicDependencySpecification as cycle_error: self.__print_cyclic_dependencies_error(cycle_error, bunch.name()) continue #Now perform all setup if self.__run_fixtures( setup_seq, self.__save_path_for_test( os.path.join(bunch.deploy_dir, "setup")), collector): #setup passed, execute tests none_failed = none_failed and self.__run_stories( stories, setup_seq, teardown_seq, collector) else: none_failed = False #Now execute teardown disregarding setup results and ignoring script failures self.__run_fixtures( teardown_seq, self.__save_path_for_test( os.path.join(bunch.deploy_dir, "teardown")), collector, False) no_bunch_failed = no_bunch_failed and none_failed collector.dump( self.__save_path_for_test( os.path.join(bunch.deploy_dir, bunch.name()))) self.plugin.transform( collector.get_element_tree(), MustfailMatcher(self.__current_bunch.get_config()), BunchDetails(name=bunch.name())) return no_bunch_failed
def run(self): """ Execute set of test bunches sequentially """ no_bunch_failed = True for bunch in self.bunch_list: collector = BunchXmlCollector() none_failed = True self.__set_current_bunch(bunch) stories = bunch.get_stories() setup_deps, teardown_deps = self.__get_fixture_deps(stories) try: setup_seq = dependencies.combine_fixture_deps(setup_deps) teardown_seq = dependencies.combine_fixture_deps(teardown_deps) except CyclicDependencySpecification as cycle_error: self.__print_cyclic_dependencies_error(cycle_error, bunch.name()) continue #Now perform all setup if self.__run_fixtures(setup_seq, self.__save_path_for_test(os.path.join(bunch.deploy_dir,"setup")), collector): #setup passed, execute tests none_failed = none_failed and self.__run_stories(stories, setup_seq, teardown_seq, collector) else: none_failed = False #Now execute teardown disregarding setup results and ignoring script failures self.__run_fixtures(teardown_seq, self.__save_path_for_test(os.path.join(bunch.deploy_dir,"teardown")), collector, False) no_bunch_failed = no_bunch_failed and none_failed collector.dump(self.__save_path_for_test(os.path.join(bunch.deploy_dir, bunch.name()))) self.plugin.transform(collector.get_element_tree(), MustfailMatcher(self.__current_bunch.get_config()), BunchDetails(name=bunch.name())) return no_bunch_failed
def test_empties_solitaries_indepent_and_usual_deps(): grouplist = [ [ [] ], [ ['one'] ], [ [] ], [ ['two'] ], [ [] ], [ ['three'] ], [ [] ], [ ['four'], ['five'], ['six']], [ [] ], [ ['seven','eight', 'nine'] ], [ [] ] ] assert_equals( list(flatten(combine_fixture_deps(grouplist))), ['four', 'five', 'six', 'one', 'two', 'three', 'seven', 'eight', 'nine'])
def test_no_solitary_duplication(): grouplist =[[], [[u'single-node.clean.setup'], [u'keystone-init.setup'], [u'keystone-user.setup'], [u'novaclient-network.setup'], [u'novarc-keystone.setup'], [u'novaclient-images.setup'], [u'novaclient-keys.setup']], [[u'novaclient-keys.setup']], [], [[u'single-node.clean.setup'], [u'novaclient-users.setup'], [u'novaclient-network.setup'], [u'novaclient-images.setup'], [u'novaclient-keys.setup']], [[u'lvm.setup']]] assert_equals( list(flatten(combine_fixture_deps(grouplist))), list(flatten([[u'single-node.clean.setup'], [u'keystone-init.setup', u'novaclient-users.setup'], [u'keystone-user.setup'], [u'novaclient-network.setup'], [u'novarc-keystone.setup'], [u'novaclient-images.setup'], [u'novaclient-keys.setup'], [u'lvm.setup']])))
def test_several_empty_deps(): grouplist = [[[]]] assert_equals(list(flatten(combine_fixture_deps(grouplist))), [])
def test_several_solitary_deps(): grouplist = [[['one']], [['two']], [['three']]] assert_equals(list(flatten(combine_fixture_deps(grouplist))), ['one', 'two', 'three'])
def test_one_solitary_dep(): grouplist = [[['one']]] assert_equals(list(flatten(combine_fixture_deps(grouplist))), ['one'])
def test_several_solitary_deps(): grouplist = [ [ ['one'] ], [ ['two'] ], [ ['three'] ] ] assert_equals(list(flatten(combine_fixture_deps(grouplist))), ['one', 'two', 'three'])
def test_independent_single_deps(): grouplist = [[['1', '2', '3', '4', '5']]] assert_equals(list(flatten(combine_fixture_deps(grouplist))), ['1', '2', '3', '4', '5'])
def test_empties_and_solitaries_deps(): grouplist = [[[]], [['one']], [[]], [['two']], [[]], [['three']], [[]]] assert_equals(list(flatten(combine_fixture_deps(grouplist))), ['one', 'two', 'three'])
def test_one_solitary_dep(): grouplist = [ [ ['one'] ] ] assert_equals(list(flatten(combine_fixture_deps(grouplist))), ['one'])
def test_independent_single_deps(): grouplist = [ [ ['1','2','3' ,'4', '5'] ] ] assert_equals( list(flatten(combine_fixture_deps(grouplist))), ['1', '2', '3', '4', '5'])
def test_empties_and_solitaries_deps(): grouplist = [ [ [] ], [ ['one'] ], [ [] ], [ ['two'] ], [ [] ],[ ['three'] ], [ [] ] ] assert_equals( list(flatten(combine_fixture_deps(grouplist))), ['one', 'two', 'three'])
def test_several_empty_deps(): grouplist = [ [ [] ] ] assert_equals( list(flatten(combine_fixture_deps(grouplist))), [])