X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=system%2FTestPlc.py;h=dd422a8ee1fb97655bd1951780b207e8ec491059;hb=87f953c20a5a10273673e0fab3a6ded79475ad4c;hp=6c215f57968fb9ac8d5e592125277921f2a7ca1a;hpb=7317850c86d935cf17cbbc53da0b9e169d0f8555;p=tests.git diff --git a/system/TestPlc.py b/system/TestPlc.py index 6c215f5..dd422a8 100644 --- a/system/TestPlc.py +++ b/system/TestPlc.py @@ -68,11 +68,11 @@ def slice_mapper (method): def ignore_result (method): def wrappee (self): # ssh_slice_ignore->ssh_slice - ref_name=method.__name__.replace('_ignore','').replace('ignore_','') + 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 True + 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 @@ -83,7 +83,6 @@ def ignore_result (method): class slice_mapper__tasks (object): # could not get this to work with named arguments def __init__ (self,timeout_minutes,silent_minutes,period_seconds): - print "timeout_minutes,silent_minutes,period_seconds",timeout_minutes,silent_minutes,period_seconds self.timeout=timedelta(minutes=timeout_minutes) self.silent=timedelta(minutes=silent_minutes) self.period=timedelta(seconds=period_seconds) @@ -117,6 +116,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='' @@ -150,7 +153,7 @@ class TestPlc: 'empty_slices', 'ssh_slice_off', SEP, # check they are properly re-created with the same name 'fill_slices', 'ssh_slice_again_ignore', SEP, - 'force_gather_logs', SEP, + 'gather_logs_force', SEP, ] other_steps = [ 'export', 'show_boxes', SEP, @@ -166,7 +169,7 @@ class TestPlc: 'plc_db_dump' , 'plc_db_restore', SEP, 'check_netflow','check_drl', SEP, 'debug_nodemanager', SEP, - 'standby_1_through_20',SEP, + 'standby_1_through_20','yes','no',SEP, ] @staticmethod @@ -248,7 +251,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) @@ -634,7 +637,7 @@ class TestPlc: repo_url = os.path.dirname(repo_url) # invoke initvm (drop support for vs) - script="ltest-initvm.sh" + script="lbuild-initvm.sh" script_options="" # pass the vbuild-nightly options to [lv]test-initvm script_options += " -p %s"%self.options.personality @@ -1183,9 +1186,10 @@ class TestPlc: @slice_mapper__tasks(20,19,15) def ssh_slice_off (self): pass - # this is semantically just equivalent to ssh_slice - # but we use another name so we can exclude it from the tests on the nightly command line - ssh_slice_again=ssh_slice + # 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 @@ -1708,10 +1712,25 @@ class TestPlc: utils.header('Database restored from ' + dump) - @ignore_result - def ssh_slice_again_ignore (self): pass - @ignore_result - def check_initscripts_ignore (self): pass + @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""" @@ -1756,3 +1775,7 @@ class TestPlc: def standby_19(): pass @standby_generic def standby_20(): pass + + # convenience for debugging the test logic + def yes (self): return True + def no (self): return False