rename user to avoid confusion with internal fields that are named reg- in the sfa...
[tests.git] / system / config_default.py
index 9bd90d4..1e6ee0a 100644 (file)
@@ -340,18 +340,19 @@ def keys (options,index):
 initscript_by_name="""#!/bin/bash
 command=$1; shift
 slicename=$1; shift
-stamp="the_script_name"
-stampfile=/tmp/$stamp.stamp
+stamp="initscript_by_name"
+stampfile=/var/tmp/$stamp.stamp
+date=$(date)
 
-echo "Running initscript with command=$command and slicename=$slicename"
+echo $date "Running initscript with command=$command and slicename=$slicename"
 
 function start () {
-  (echo Starting test initscript: $stamp on slicename $slicename ; date) >> $stampfile
-  echo "This is the stdout of the sliver $slicename initscript $command (exp. start) pid=$$" 
-  echo "This is the stderr of the sliver $slicename initscript $command (exp. start) pid=$$" 1>&2
+  (echo $date Starting test initscript: $stamp on slicename $slicename ; date) >> $stampfile
+  echo $date "This is the stdout of the sliver $slicename initscript $command (exp. start) pid=$$"
+  echo $date "This is the stderr of the sliver $slicename initscript $command (exp. start) pid=$$" 1>&2
 }
 function stop () {
-  echo "Removing stamp $stampfile"
+  echo $date "Removing stamp $stampfile"
   rm -f $stampfile
 }
 function restart () {
@@ -366,12 +367,12 @@ restart) restart ;;
 esac
 """
 
-initscript_by_code=initscript_by_name.replace("the_script_name","the_script_code")
+initscript_by_code=initscript_by_name.replace("initscript_by_name","initscript_by_code")
 
 # one single initscript in the InitScripts table
 def initscripts(options,index): 
     return [ { 'initscript_fields' : { 'enabled' : True,
-                                       'name':'the_script_name',
+                                       'name':'initscript_by_name',
                                        'script' : initscript_by_name,
                                        }},
              ]
@@ -393,16 +394,17 @@ def slices (options,index):
                        'sitename' : login_base(index),
                        'owner' : 'pi',
                        }
-        # 1st one has an initscript_code
+        # 1st one has an initscript by code
         if i%3==1:
             slice_spec['initscriptcode']=initscript_by_code
-            slice_spec['initscriptstamp']='the_script_code'
-        # 2nd one has an initscript (name)
+            slice_spec['initscriptstamp']='initscript_by_code'
+        # 2nd one has an initscript by name
         elif i%3==2:
-            slice_spec['initscriptname']='the_script_name'
-            slice_spec['initscriptstamp']='the_script_name'
+            slice_spec['initscriptname']='initscript_by_name'
+            slice_spec['initscriptstamp']='initscript_by_name'
         # 3rd one is omf-friendly
         else:
+            # potentially turned off with config_no_omf
             slice_spec ['omf-friendly'] = True
         return slice_spec
     # usual index is 1, additional plc's then get 2...
@@ -483,6 +485,7 @@ def plc (options,index) :
         'PLC_ROOT_USER' : 'root@test.onelab.eu',
         'PLC_ROOT_PASSWORD' : 'test++',
         'PLC_SLICE_PREFIX' : 'auto',
+        'PLC_HRN_ROOT': sfa_root(index),
         'PLC_SHORTNAME' : 'Rlab',
         'PLC_MAIL_ENABLED':'false',
         'PLC_MAIL_SUPPORT_ADDRESS' : 'thierry.parmentelat@inria.fr',
@@ -536,7 +539,7 @@ def sfa (options,index) :
                              for rspec_style in options.rspec_styles ]
     }
 
-# rspecstyle is 'pl' for sfav1 or 'pg' for pgv2
+# rspec_style is 'pl' for sfav1 or 'pg' for pgv2
 def test_auth_sfa_spec (options,index,rspec_style):
     # the auth/site part per se
     login_base=sfa_login_base(index,rspec_style)
@@ -544,16 +547,20 @@ def test_auth_sfa_spec (options,index,rspec_style):
     def full_hrn(x):  return "%s.%s"%(hrn_prefix,x)
     def full_mail(x): return "%s@test.%s"%(x,domain)
 
-    # 2 users
+    # 2 users; we use dashes on purpose, as it might show up in email addresses
+    pi_alias = 'pi-user'
+    user_alias = 'regular-user'
+#    pi_alias = 'pi'
+#    user_alias = 'user'
+    # 
     pi_spec = {
-        'name':         'pi',
-        'email':        full_mail ('piuser'),
+        'name':         pi_alias,
+        'email':        full_mail (pi_alias),
         'key_name':     'key_sfapi',
         }
-    user_hrn = full_hrn ('us')
     user_spec = {
-        'name':         'us',
-        'email':        full_mail ('regularuser'),
+        'name':         user_alias,
+        'email':        full_mail (user_alias),
         'key_name':     'key_sfauser',
         'add_options':  [ '--extra',"first_name=Fake",
                           '--extra',"last_name=SFA-style-%s"%rspec_style,
@@ -564,7 +571,7 @@ def test_auth_sfa_spec (options,index,rspec_style):
 
     slice_spec = {
         'name':          'sl',
-        'add_options':  [ '--researchers', user_hrn,
+        'add_options':  [ '--researchers', full_hrn (user_alias),
                           # xxx
                           '--extra', "description=SFA-testing-%s"%rspec_style,
                           '--extra', "url=http://slice%d.test.onelab.eu/"%index,