integrated plcapi test (formerly in PLCAPI/PLC/Test.py) as the plcsh_stress_test...
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 30 May 2008 14:02:27 +0000 (14:02 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 30 May 2008 14:02:27 +0000 (14:02 +0000)
plcapi/Makefile [deleted file]
system/TestPlc.py
system/TestSsh.py
system/plcsh-stress-test.py [moved from plcapi/Test.py with 100% similarity]

diff --git a/plcapi/Makefile b/plcapi/Makefile
deleted file mode 100644 (file)
index d26d630..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-ifdef PLCHOST
-ifdef VSERVER
-PLCSSH:=root@$(PLCHOST):/vservers/$(VSERVER)
-endif
-endif
-
-LOCAL_RSYNC_EXCLUDES   := --exclude '*.pyc' 
-RSYNC_EXCLUDES         := --exclude .svn --exclude CVS --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
-RSYNC_COND_DRY_RUN     := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
-RSYNC                  := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
-
-sync:
-ifeq (,$(PLCSSH))
-       echo "sync: You must define PLCHOST and VSERVER on the command line"
-       echo " e.g. make sync PLCHOST=private.one-lab.org VSERVER=myplc01" ; exit 1
-else
-       +$(RSYNC) Test.py $(PLCSSH)/usr/share/plc_api/
-endif
index 1ea2ff6..441a0a6 100644 (file)
@@ -69,7 +69,7 @@ class TestPlc:
                      'init_node','bootcd', 'configure_qemu', 'export_qemu',
                      'kill_all_qemus', 'reinstall_node','start_node', SEP,
                      'nodes_booted', 'nodes_ssh', 'check_slice',
-                     'check_initscripts', 'check_tcp',SEP,
+                     'check_initscripts', 'check_tcp', 'plcsh_stress_test', SEP,
                      'force_gather_logs', 'force_kill_qemus', 'force_record_tracker','force_free_tracker' ]
     other_steps = [ 'stop_all_vservers','fresh_install', 'cache_rpm', 'stop', 'vs_start', SEP,
                     'clean_initscripts', 'clean_all_sites',
@@ -444,7 +444,6 @@ class TestPlc:
             tag_types = self.apiserver.GetNodeTagTypes(auth,{'tagname':nodegroupname})
             if tag_types:
                 tag_type_id = tag_types[0]['node_tag_type_id']
-                print 'node-tag-type',nodegroupname,'already exists'
             else:
                 tag_type_id = self.apiserver.AddNodeTagType(auth,
                                                             {'tagname':nodegroupname,
@@ -453,9 +452,7 @@ class TestPlc:
                                                              'min_role_id':10})
             # create nodegroup
             nodegroups = self.apiserver.GetNodeGroups (auth, {'groupname':nodegroupname})
-            if nodegroups:
-                print 'nodegroup',nodegroupname,'already exists'
-            else:
+            if not nodegroups:
                 self.apiserver.AddNodeGroup(auth, nodegroupname, tag_type_id, 'yes')
             # set node tag on all nodes, value='yes'
             overall = True
@@ -475,8 +472,9 @@ class TestPlc:
                         print 'Mismatch node tag on node',nodename,'got',expect_yes
                         overall=False
                 except:
-                    print 'Cannot find tag',nodegroupname,'on node',nodename
-                    overall = False
+                    if not self.options.dry_run:
+                        print 'Cannot find tag',nodegroupname,'on node',nodename
+                        overall = False
         return overall
 
     def all_hostnames (self) :
@@ -684,7 +682,17 @@ class TestPlc:
             if not c_test_sliver.run_tcp_client(s_test_sliver.test_node.name(),port):
                 overall=False
         return overall
-    
+
+    def plcsh_stress_test (self):
+        # install the stress-test in the plc image
+        location = "/usr/share/plc_api/plcsh-stress-test.py"
+        remote="/vservers/%s/%s"%(self.vservername,location)
+        self.test_ssh.copy_abs("plcsh-stress-test.py",remote)
+        if self.options.small_test:
+            command=location + " -- --tiny"
+        else:
+            command=location
+        return ( self.run_in_guest(command) == 0)
 
     def gather_logs (self):
         # (1) get the plc's /var/log and store it locally in logs/myplc.var-log.<plcname>/*
index d392659..f523843 100644 (file)
@@ -128,6 +128,18 @@ class TestSsh:
                                       self.buildname,os.path.basename(local_file) or ".")
         return utils.system(scp_command)
 
+    def copy_abs (self,local_file,remote_file,recursive=False):
+        if self.is_local():
+            dest=""
+        else:
+            dest= "%s:"%self.hostname_part()
+        scp_command="scp "
+        scp_command += TestSsh.std_options
+        if recursive: scp_command += "-r "
+        scp_command += self.key_part()
+        scp_command += "%s %s%s"%(local_file,dest,remote_file)
+        return utils.system(scp_command)
+
     def fetch (self, remote_file, local_file, recursive=False):
         if self.is_local():
             command="cp "
similarity index 100%
rename from plcapi/Test.py
rename to system/plcsh-stress-test.py