configurable rspec styles using -y
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 15 Nov 2011 11:16:13 +0000 (12:16 +0100)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 15 Nov 2011 11:16:13 +0000 (12:16 +0100)
system/TestMain.py
system/TestSliceSfa.py
system/config_default.py

index 6fba5c3..779d957 100755 (executable)
@@ -112,6 +112,8 @@ steps refer to a method in TestPlc or to a step_* module
                           help="sets test size in # of plcs - default is 1")
         parser.add_option("-q","--qualifier",action="store",type="int",dest="qualifier",default=None,
                           help="run steps only on plc numbered <qualifier>, starting at 1")
+        parser.add_option("-y","--rspec-style",action="append",dest="rspec_styles",default=[],
+                          help="pl is for planetlab rspecs, pg is for protogeni")
         parser.add_option("-k","--keep-going",action="store",dest="keep_going",default=False,
                           help="proceeds even if some steps are failing")
         parser.add_option("-D","--dbname",action="store",dest="dbname",default=None,
@@ -141,6 +143,9 @@ steps refer to a method in TestPlc or to a step_* module
         for optname in ['config','exclude','ips_bplc','ips_vplc','ips_bnode','ips_vnode']:
             setattr(self.options,optname, flatten ( [ arg.split() for arg in getattr(self.options,optname) ] ))
 
+        if not self.options.rspec_styles:
+            self.options.rspec_styles=['pl','pg']
+
         # handle defaults and option persistence
         for (recname,filename,default,need_reverse) in (
             ('build_url','arg-build-url',TestMain.default_build_url,None) ,
index 82fa0ed..9900cd9 100644 (file)
@@ -29,7 +29,7 @@ class TestSliceSfa:
     def name(self):
         return self.sfa_slice_spec['slice_fields']['name']
     
-    def rspecmode (self): return self.sfa_slice_spec['rspecmode']
+    def rspec_style (self): return self.sfa_slice_spec['rspec_style']
 
     def hrn(self): 
        root_auth=self.test_plc.plc_spec['sfa']['SFA_REGISTRY_ROOT_AUTH']
@@ -43,7 +43,7 @@ class TestSliceSfa:
     def reqfile (self): return self.resname("req","rspec")
     def nodefile (self): return self.resname("nodes","txt")
     def discover_option(self):
-        if self.rspecmode()=='pg': return "-r protogeni"
+        if self.rspec_style()=='pg': return "-r protogeni"
         else: return ""
 
     def sfi_path (self):
index fca0d68..1f564fc 100644 (file)
@@ -312,16 +312,16 @@ def sfa (options,index) :
        'SFA_PLC_URL' : 'deferred-myplc-api-url',
         'SFA_API_DEBUG': True,
         # details of the slices to create
-        'sfa_slice_specs' : [ sfa_slice_spec(options,index,rspecmode) 
-                              for rspecmode in ['pl','pg']],
+        'sfa_slice_specs' : [ sfa_slice_spec(options,index,rspec_style) 
+                              for rspec_style in options.rspec_styles ]
     }
 
 # subindex is 0 (pl slice) or 1 (pg slice)
-def sfa_slice_spec (options,index,rspecmode):
+def sfa_slice_spec (options,index,rspec_style):
     the_login_base=login_base(index)
     piuser='fake-pi%d'%index
-    regularuser='sfauser%d%s'%(index,rspecmode)
-    slicename='slsfa%d%s'%(index,rspecmode)
+    regularuser='sfauser%d%s'%(index,rspec_style)
+    slicename='slsfa%d%s'%(index,rspec_style)
     prefix='%s.%s'%(sfa_root(index),the_login_base)
     hrn=prefix+'.'+slicename
     person_hrn=prefix+'.'+regularuser
@@ -352,7 +352,7 @@ last_name="Sfa" name="%(hrn)s" type="user">
              'slicename' : slicename,
              'slice_add_xml' : slice_add_xml,
              'slice_person_xml' : slice_person_xml,
-             'rspecmode':rspecmode,
+             'rspec_style':rspec_style,
              }