def do_run_script(exp, nodes): script = "tests/sample_script.sh" frontend = site + ".iot-lab.info" script_out = "'A8/script_out.*'" ssh(frontend, "rm -f " + script_out) run("open-a8-cli -i " + exp.id + " run-script " + script + a8_nodes_list(nodes)) # script runs _async_ on A8 nodes. sample_script sleeps 3-4s. wait time.sleep(10) ret = ssh(frontend, "cat " + script_out) assert ret == "{}\n".format(time.strftime("%F")) * len(nodes)
def test_a8_nodes_list_expected_usage(): nodes = [ "node-a8-2.grenoble.iot-lab.info", "node-a8-10.saclay.iot-lab.info" ] ret = a8_nodes_list(nodes) assert ret == ' -l grenoble,a8,2 -l saclay,a8,10'
def test_a8_nodes_list_eat_none(): nodes = None ret = a8_nodes_list(nodes) assert ret == ""
def test_a8_nodes_list_dont_care_about_node_a8_name(): nodes = [ "a8-10.saclay", "a8-3.saclay", "a8-4.grenoble" ] ret = a8_nodes_list(nodes) assert ret == ' -l saclay,a8,10+3 -l grenoble,a8,4'
def test_a8_nodes_list_does_not_filter_out_m3(): nodes = [ "m3-2.grenoble.iot-lab.info", "node-a8-10.saclay.iot-lab.info" ] ret = a8_nodes_list(nodes) assert ret == ' -l grenoble,a8,2 -l saclay,a8,10'
def test_run_script(exp): info = run("experiment-cli get -p -i " + exp.id) deployed_nodes = info["deploymentresults"]["0"] ret = run("open-a8-cli -i " + exp.id + " wait-for-boot" + a8_nodes_list(deployed_nodes)) booted_nodes = ret["wait-for-boot"]["0"] do_run_script(exp, booted_nodes)
def test_run_cmd(exp): ret = open_a8(exp, "wait-for-boot --max-wait 70") booted_nodes = ret["wait-for-boot"]["0"] open_a8(exp, "run-cmd 'uname -a' " + a8_nodes_list(booted_nodes))