X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=system%2FTestNode.py;h=491b35660fcb204c8bf6f8781d643b56411008da;hb=e5cc25001c2d87be1d69a70408dfe66d8d6cb571;hp=7cc360231ea0ec741b786ffdb5fd67937c2c5eff;hpb=67c81c5efda9efe832c0e7bb47f292848b2cdd75;p=tests.git diff --git a/system/TestNode.py b/system/TestNode.py index 7cc3602..491b356 100644 --- a/system/TestNode.py +++ b/system/TestNode.py @@ -1,4 +1,4 @@ -import os, sys, time, base64 +import sys, os, os.path, time, base64 import xmlrpclib import utils @@ -208,3 +208,31 @@ class TestNode: def clear_known_hosts (self): TestSsh(self.name()).clear_known_hosts() return True + + def create_test_ssh(self): + # get the plc's keys for entering the node + vservername=self.test_plc.vservername + # assuming we've run testplc.fetch_keys() + key = "keys/%(vservername)s.rsa"%locals() + return TestSsh(self.name(), buildname=self.buildname(), key=key) + + def check_sanity (self): + extensions = [ 'py','pl','sh' ] + path='tests/qaapi/qa/tests/node/' + scripts=utils.locate_sanity_scripts ('node '+self.name(), path,extensions) + overall = True + for script in scripts: + if not self.check_sanity_script (script): + overall = False + return overall + + def check_sanity_script (self,local_script): + # push the script on the node's root context + ssh_handle=self.create_test_ssh() + ssh_handle.copy_home(local_script) + script_name=os.path.basename(local_script) + if ssh_handle.run("./"+script_name) != 0: + print "WARNING: sanity check script %s FAILED"%script_name + # xxx - temporary : always return true for now + #return False + return True