X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=qaapi%2Fruntests.py;h=9ce212fc3db6202961bcc1857e3f5ffc9de50de1;hb=9b733a4719b75382285799e42b245108f986aaa1;hp=3b97c1940a5b5b5efc32233e5e2044fce507a26e;hpb=c6575e48df3fdbbf895f6c1aec747f7bbce9dba7;p=tests.git diff --git a/qaapi/runtests.py b/qaapi/runtests.py index 3b97c19..9ce212f 100755 --- a/qaapi/runtests.py +++ b/qaapi/runtests.py @@ -2,7 +2,7 @@ # # Sample myplc testing script that makes use of # qaapi modules. - +import sys from pprint import pprint from qa.Config import Config from qa.tests.plc_configure import plc_configure @@ -14,32 +14,41 @@ from qa.tests.get_boot_state import get_boot_state from qa.tests.node_remote_call import node_remote_call from qa.tests.access_slice import access_slice -config = Config() -node = config.TEST_NODE_HOSTNAME_1 -person = config.TEST_PERSON_EMAIL +def main(args): + if len(args) > 0: + config = Config(args[0]) + else: + config = Config() + config.load("qa/qa_config.py") + + plc_configure(config)("TestPLC") + plc_start(config)() + + # Add test site, node, person and slice data + # Adds slice to node and person to slice + config.update_api() + add_test_data(config)() + + # Update plc with tests user's current public key + # person = config.TEST_PERSON_EMAIL + # sync_person_key(config)(person) -plc_configure()() -#plc_start()() -# Add test site, node, person and slice data -# Adds slice to node and person to slice -add_test_data()() + sys.exit(0) + # Boot test node and confirm boot state + boot_node(config)(node) -# Update plc with tests user's current public key -sync_person_key()(person) + # Restart node manager on the node + restart_nm = 'service nm restart' + node_remote_call(node, restart_nm) -# Boot test node and confirm boot state -boot_node()(node) -if get_boot_state()(node) not in ['boot']: - raise Exception, "%(node)s not fully booted" % locals() + # Try to access the test slice on the test node + email = config.TEST_PERSON_EMAIL + slice = config.TEST_SLICE_NAME + access_slice(email, slice, node) -# Restart node manager on the node -priv_key_path = "/etc/planetlab/root_ssh_key.rsa" % locals() -restart_nm = 'service nm restart' -remote_call(priv_key_path, node, restart_nm) + # Run node tests + node_run_tests(config)(node) -# Try to access the test slice on the test node -email = config.TEST_PERSON_EMAIL -slice = config.TEST_SLICE_NAME -access_slice(email, slice, node) - +if __name__ == '__main__': + main(sys.argv[1:])