X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=system%2FTestPlc.py;h=c9b621baf0ded72b4f34aa7b4e46382b109e58e2;hb=a161111621b56df355e7473ba28d0e667105409e;hp=57b0c5a067638bcdb636ac1815ac9bca99aef0aa;hpb=bdf6981919bef7a8c63e1228f29fadd4cb35a06b;p=tests.git diff --git a/system/TestPlc.py b/system/TestPlc.py index 57b0c5a..c9b621b 100644 --- a/system/TestPlc.py +++ b/system/TestPlc.py @@ -64,6 +64,18 @@ def slice_mapper (method): actual.__doc__=TestSlice.__dict__[method.__name__].__doc__ return actual +# run a step but return True so that we can go on +def ignore_result (method): + def wrappee (self): + # ssh_slice_ignore->ssh_slice + ref_name=method.__name__.replace('_ignore','').replace('force_','') + ref_method=TestPlc.__dict__[ref_name] + result=ref_method(self) + print "Actual - but ignored - result for %(ref_name)s is %(result)s"%locals() + return Ignored (result) + wrappee.__doc__="ignored version of " + method.__name__.replace('_ignore','').replace('ignore_','') + return wrappee + # a variant that expects the TestSlice method to return a list of CompleterTasks that # are then merged into a single Completer run to avoid wating for all the slices # esp. useful when a test fails of course @@ -105,6 +117,10 @@ def auth_sfa_mapper (method): actual.__doc__=TestAuthSfa.__dict__[method.__name__].__doc__ return actual +class Ignored: + def __init__ (self,result): + self.result=result + SEP='' SEPSFA='' @@ -131,14 +147,14 @@ class TestPlc: # we used to run plcsh_stress_test, and then ssh_node_debug and ssh_node_boot # but as the stress test might take a while, we sometimes missed the debug mode.. 'ssh_node_debug@1', 'plcsh_stress_test@1', SEP, - 'ssh_node_boot@1', 'node_bmlogs@1', 'ssh_slice', 'ssh_slice_basics', 'check_initscripts', SEP, + 'ssh_node_boot@1', 'node_bmlogs@1', 'ssh_slice', 'ssh_slice_basics', 'check_initscripts_ignore', SEP, 'ssh_slice_sfa@1', 'sfa_delete_slice@1', 'sfa_delete_user@1', SEPSFA, 'cross_check_tcp@1', 'check_system_slice', SEP, # check slices are turned off properly 'empty_slices', 'ssh_slice_off', SEP, # check they are properly re-created with the same name - 'fill_slices', 'ssh_slice', SEP, - 'force_gather_logs', SEP, + 'fill_slices', 'ssh_slice_again_ignore', SEP, + 'gather_logs_force', SEP, ] other_steps = [ 'export', 'show_boxes', SEP, @@ -236,7 +252,7 @@ class TestPlc: def vm_root_in_host(self): if self.options.plcs_use_lxc: - return "/vservers/%s/rootfs/"%(self.vservername) + return "/vservers/%s/"%(self.vservername) else: return "/vservers/%s"%(self.vservername) @@ -620,25 +636,24 @@ class TestPlc: repo_url = self.options.arch_rpms_url for level in [ 'arch' ]: repo_url = os.path.dirname(repo_url) + + # invoke initvm (drop support for vs) + script="lbuild-initvm.sh" + script_options="" # pass the vbuild-nightly options to [lv]test-initvm - test_env_options="" - test_env_options += " -p %s"%self.options.personality - test_env_options += " -d %s"%self.options.pldistro - test_env_options += " -f %s"%self.options.fcdistro - if self.options.plcs_use_lxc: - script="ltest-initvm.sh" - else: - script="vtest-initvm.sh" + script_options += " -p %s"%self.options.personality + script_options += " -d %s"%self.options.pldistro + script_options += " -f %s"%self.options.fcdistro + script_options += " -r %s"%repo_url vserver_name = self.vservername - vserver_options="--netdev eth0 --interface %s"%self.vserverip try: vserver_hostname=socket.gethostbyaddr(self.vserverip)[0] - vserver_options += " --hostname %s"%vserver_hostname + script_options += " -n %s"%vserver_hostname except: print "Cannot reverse lookup %s"%self.vserverip print "This is considered fatal, as this might pollute the test results" return False - create_vserver="%(build_dir)s/%(script)s %(test_env_options)s %(vserver_name)s %(repo_url)s -- %(vserver_options)s"%locals() + create_vserver="%(build_dir)s/%(script)s %(script_options)s %(vserver_name)s"%locals() return self.run_in_host(create_vserver) == 0 ### install_rpm @@ -1172,6 +1187,11 @@ class TestPlc: @slice_mapper__tasks(20,19,15) def ssh_slice_off (self): pass + # use another name so we can exclude/ignore it from the tests on the nightly command line + def ssh_slice_again(self): return self.ssh_slice() + # note that simply doing ssh_slice_again=ssh_slice would kind od work too + # but for some reason the ignore-wrapping thing would not + @slice_mapper def ssh_slice_basics(self): pass @@ -1693,6 +1713,26 @@ class TestPlc: utils.header('Database restored from ' + dump) + @staticmethod + def create_ignore_steps (): + for step in TestPlc.default_steps + TestPlc.other_steps: + # default step can have a plc qualifier + if '@' in step: (step,qualifier)=step.split('@') + # or be defined as forced or ignored by default + for keyword in ['_ignore','_force']: + if step.endswith (keyword): step=step.replace(keyword,'') + if step == SEP or step == SEPSFA : continue + method=getattr(TestPlc,step) + name=step+'_ignore' + wrapped=ignore_result(method) +# wrapped.__doc__ = method.__doc__ + " (run in ignore-result mode)" + setattr(TestPlc, name, wrapped) + +# @ignore_result +# def ssh_slice_again_ignore (self): pass +# @ignore_result +# def check_initscripts_ignore (self): pass + def standby_1_through_20(self): """convenience function to wait for a specified number of minutes""" pass