def test_qmove_queu_4(): """ qmove test run: queu_4 """ args = """q1 q2 1 2 3""" cmdout = '' cmderr = \ """jobid must be an integer: q2 """ stubout = '' stubout_file = "stub.out" expected_results = ( 256, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('qmove.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_qselect_invalid_option(): """ qselect test run: invalid_option """ args = """-k""" cmdout = "" cmderr = """Usage: qselect.py [options] qselect.py: error: no such option: -k """ stubout = "" stubout_file = "stub.out" expected_results = ( 512, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd("qselect.py", args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_slpstat_version(): """ slpstat test run: version """ args = """--version""" cmdout = \ """version: "slpstat.py " + $Revision: 1221 $ + , Cobalt + $Version$ """ cmderr = '' stubout = '' stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('slpstat.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_partlist_version_option_1(): """ partlist test run: version_option_1 """ args = """--version""" cmdout = \ """version: "partlist.py " + $Revision: 1981 $ + , Cobalt + $Version$ """ cmderr = '' stubout = '' stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('partlist.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_schedctl_combo_1(): """ schedctl test run: combo_1 """ args = """--start --stop""" cmdout = '' cmderr = \ """Option combinations not allowed with: start option(s) """ stubout = '' stubout_file = "stub.out" expected_results = ( 256, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('schedctl.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_nodelist_options_4(): """ nodelist test run: options_4 """ args = """--version""" cmdout = \ """version: "nodelist.py " + TBD + , Cobalt + TBD """ cmderr = '' stubout = '' stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('nodelist.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_boot_block_combo(): """ boot-block test run: combo """ args = """--free --reboot --block b --jobid 1""" cmdout = '' cmderr = \ """ERROR: --free may not be specified with --reboot. """ stubout = '' stubout_file = "stub.out" expected_results = ( 768, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('boot-block.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_releaseres_version(): """ releaseres test run: version """ args = """--version""" cmdout = \ """version: "releaseres.py " + $Id: releaseres.py 2146 2011-04-29 16:19:22Z richp $ + , Cobalt + $Version$ """ cmderr = '' stubout = '' stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('releaseres.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_qselect_only_arg(): """ qselect test run: only_arg """ args = """1""" cmdout = "" cmderr = """qselect takes no arguments """ stubout = "" stubout_file = "stub.out" expected_results = ( 256, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd("qselect.py", args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_schedctl_save_2(): """ schedctl test run: save_2 """ args = """--savestate s""" cmdout = '' cmderr = \ """directory s does not exist """ stubout = '' stubout_file = "stub.out" expected_results = ( 256, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('schedctl.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_schedctl_combo_1(): """ schedctl test run: combo_1 """ args = """--start --stop""" cmdout = '' cmderr = \ """Option combinations not allowed with: start option(s) """ stubout = '' stubout_file = "stub.out" expected_results = ( 256, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('schedctl.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_partlist_argument_1(): """ partlist test run: argument_1 """ args = """arg""" cmdout = '' cmderr = \ """No arguments required """ stubout = '' stubout_file = "stub.out" expected_results = ( 256, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('partlist.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_userres_version(): """ userres test run: version """ args = """--version""" cmdout = \ """version: "userres.py " + $Id: releaseres.py 1361 2008-08-08 16:22:14Z buettner $ + , Cobalt + $Version$ """ cmderr = '' stubout = '' stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('userres.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_boot_block_free_2(): """ boot-block test run: free_2 """ args = """--free --jobid 1""" cmdout = '' cmderr = \ """ERROR: block not specified as option or in environment. """ stubout = '' stubout_file = "stub.out" expected_results = ( 768, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('boot-block.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_boot_block_combo(): """ boot-block test run: combo """ args = """--free --reboot --block b --jobid 1""" cmdout = '' cmderr = \ """ERROR: --free may not be specified with --reboot. """ stubout = '' stubout_file = "stub.out" expected_results = ( 768, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('boot-block.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_get_bootable_blocks_geometry_10(): """ get-bootable-blocks test run: geometry_10 """ args = """--geometry 90x90x90x90x11 arg""" cmdout = '' cmderr = \ """Invalid Geometry. Geometry must be in the form of AxBxCxDxE """ stubout = '' stubout_file = "stub.out" expected_results = ( 256, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('get-bootable-blocks.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_qselect_only_arg(): """ qselect test run: only_arg """ args = """1""" cmdout = '' cmderr = \ """qselect takes no arguments """ stubout = '' stubout_file = "stub.out" expected_results = ( 256, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('qselect.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_nodelist_options_4(): """ nodelist test run: options_4 """ args = """--version""" cmdout = \ """version: "nodelist.py " + TBD + , Cobalt + TBD """ cmderr = '' stubout = '' stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('nodelist.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_schedctl_save_2(): """ schedctl test run: save_2 """ args = """--savestate s""" cmdout = '' cmderr = \ """directory s does not exist """ stubout = '' stubout_file = "stub.out" expected_results = ( 256, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('schedctl.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_get_bootable_blocks_geometry_10(): """ get-bootable-blocks test run: geometry_10 """ args = """--geometry 90x90x90x90x11 arg""" cmdout = '' cmderr = \ """Invalid Geometry. Geometry must be in the form of AxBxCxDxE """ stubout = '' stubout_file = "stub.out" expected_results = ( 256, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('get-bootable-blocks.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_partlist_argument_1(): """ partlist test run: argument_1 """ args = """arg""" cmdout = '' cmderr = \ """No arguments required """ stubout = '' stubout_file = "stub.out" expected_results = ( 256, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('partlist.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_get_bootable_blocks_version(): """ get-bootable-blocks test run: version """ args = """--version""" cmdout = \ """version: "get-bootable-blocks.py " + TBD + , Cobalt + TBD """ cmderr = '' stubout = '' stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('get-bootable-blocks.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_qdel_jobid_1(): """ qdel test run: jobid_1 """ args = """myq 1 2 3 4""" cmdout = '' cmderr = \ """jobid must be an integer: myq """ stubout = '' stubout_file = "stub.out" expected_results = ( 256, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('qdel.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_showres_combo(): """ showres test run: combo """ args = """-l -x""" cmdout = '' cmderr = \ """Only use -l or -x not both """ stubout = '' stubout_file = "stub.out" expected_results = ( 256, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('showres.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_boot_block_free_2(): """ boot-block test run: free_2 """ args = """--free --jobid 1""" cmdout = '' cmderr = \ """ERROR: block not specified as option or in environment. """ stubout = '' stubout_file = "stub.out" expected_results = ( 768, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('boot-block.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_get_bootable_blocks_version(): """ get-bootable-blocks test run: version """ args = """--version""" cmdout = \ """version: "get-bootable-blocks.py " + TBD + , Cobalt + TBD """ cmderr = '' stubout = '' stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('get-bootable-blocks.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_partlist_argument_2(): """ partlist test run: argument_2 """ args = '' cmdout = \ """Name Queue State Backfill ============================================================================== P10 zq:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P9 yours:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P8 myq:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P7 dito:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P6 hhh:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P5 bbb:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P4 aaa:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P3 bello:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P2 jello:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P1 kebra:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - """ cmderr = '' stubout = \ """ GET_PARTITIONS plist: [{'queue': '*', 'scheduled': '*', 'state': '*', 'tag': 'partition', 'name': '*', 'backfill_time': '*', 'children': '*', 'functional': '*', 'draining': '*', 'size': '*'}] GET_RESERVATIONS active:True active type: <type 'bool'> partitions:* partitions type: <type 'str'> queue:* queue type: <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('partlist.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_partlist_argument_2(): """ partlist test run: argument_2 """ args = '' cmdout = \ """Name Queue State Backfill ============================================================================== P10 zq:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P9 yours:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P8 myq:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P7 dito:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P6 hhh:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P5 bbb:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P4 aaa:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P3 bello:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P2 jello:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - P1 kebra:kebra:jello:bello:aaa:bbb:hhh:dito:myq:yours:zq idle - """ cmderr = '' stubout = \ """ GET_PARTITIONS plist: [{'queue': '*', 'scheduled': '*', 'state': '*', 'tag': 'partition', 'name': '*', 'backfill_time': '*', 'children': '*', 'functional': '*', 'draining': '*', 'size': '*'}] GET_RESERVATIONS active:True active type: <type 'bool'> partitions:* partitions type: <type 'str'> queue:* queue type: <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('partlist.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_releaseres_arg_3(): """ releaseres test run: arg_3 """ args = """s1 s2""" cmdout = \ """Released reservation 's1' for partitions: ['p1', 'p2'] Released reservation 's2' for partitions: ['p1', 'p2'] """ cmderr = '' stubout = \ """ GET_RESERVATIONS name:s1 name type: <type 'str'> partitions:* partitions type: <type 'str'> name:s2 name type: <type 'str'> partitions:* partitions type: <type 'str'> \RELEASE_RESERVATIONS name:s1 name type: <type 'str'> partitions:* partitions type: <type 'str'> name:s2 name type: <type 'str'> partitions:* partitions type: <type 'str'> user: gooduser """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('releaseres.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_releaseres_arg_3(): """ releaseres test run: arg_3 """ args = """s1 s2""" cmdout = \ """Released reservation 's1' for partitions: ['p1', 'p2'] Released reservation 's2' for partitions: ['p1', 'p2'] """ cmderr = '' stubout = \ """ GET_RESERVATIONS name:s1 name type: <type 'str'> partitions:* partitions type: <type 'str'> name:s2 name type: <type 'str'> partitions:* partitions type: <type 'str'> \RELEASE_RESERVATIONS name:s1 name type: <type 'str'> partitions:* partitions type: <type 'str'> name:s2 name type: <type 'str'> partitions:* partitions type: <type 'str'> user: gooduser """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('releaseres.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_boot_block_nofree_noreboot_3(): """ boot-block test run: nofree_noreboot_3 """ args = """--jobid 1 --block b""" cmdout = \ """status 1 status 2 status 3 Boot for location b complete. """ cmderr = '' stubout = \ """ INITIATE_PROXY_BOOT block: b, type = <type 'str'> user: gooduser jobid: 1, type = <type 'int'> GET_BOOT_STATUSES_AND_STRINGS block: b, type = <type 'str'> GET_BOOT_STATUSES_AND_STRINGS block: b, type = <type 'str'> REAP_BOOT block: b, type = <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('boot-block.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_userres_arg_2(): """ userres test run: arg_2 """ args = """s1""" cmdout = \ """Setting new start time for for reservation 's1': Tue Mar 26 17:01:40 2013 """ cmderr = '' stubout = \ """ GET_RESERVATIONS cycle:* cycle type: <type 'str'> duration:* duration type: <type 'str'> name:s1 name type: <type 'str'> start:* start type: <type 'str'> users:* users type: <type 'str'> SET_RESERVATIONS name:s1 name type: <type 'str'> start:1364335300.0 start type: <type 'float'> user: gooduser """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('userres.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_userres_arg_2(): """ userres test run: arg_2 """ args = """s1""" cmdout = \ """Setting new start time for for reservation 's1': Tue Mar 26 17:01:40 2013 """ cmderr = '' stubout = \ """ GET_RESERVATIONS cycle:* cycle type: <type 'str'> duration:* duration type: <type 'str'> name:s1 name type: <type 'str'> start:* start type: <type 'str'> users:* users type: <type 'str'> SET_RESERVATIONS name:s1 name type: <type 'str'> start:1364335300.0 start type: <type 'float'> user: gooduser """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('userres.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_slpstat_debug_2(): """ slpstat test run: debug_2 """ args = """-d""" cmdout = \ """no services registered """ cmderr = \ """ slpstat.py -d component: "service-location.get_services", defer: False get_services( [{'stamp': '*', 'tag': 'service', 'name': '*', 'location': '*'}], ) """ stubout = \ """ GET_SERVICES location:* location type: <type 'str'> name:* name type: <type 'str'> stamp:* stamp type: <type 'str'> tag:service tag type: <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("NO SERVICES") results = testutils.run_cmd('slpstat.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_slpstat_debug_2(): """ slpstat test run: debug_2 """ args = """-d""" cmdout = \ """no services registered """ cmderr = \ """ slpstat.py -d component: "service-location.get_services", defer: False get_services( [{'stamp': '*', 'tag': 'service', 'name': '*', 'location': '*'}], ) """ stubout = \ """ GET_SERVICES location:* location type: <type 'str'> name:* name type: <type 'str'> stamp:* stamp type: <type 'str'> tag:service tag type: <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("NO SERVICES") results = testutils.run_cmd('slpstat.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_boot_block_nofree_noreboot_3(): """ boot-block test run: nofree_noreboot_3 """ args = """--jobid 1 --block b""" cmdout = \ """status 1 status 2 status 3 Boot for locaiton b complete. """ cmderr = '' stubout = \ """ INITIATE_PROXY_BOOT block: b, type = <type 'str'> user: gooduser jobid: 1, type = <type 'int'> GET_BOOT_STATUSES_AND_STRINGS block: b, type = <type 'str'> GET_BOOT_STATUSES_AND_STRINGS block: b, type = <type 'str'> REAP_BOOT block: b, type = <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('boot-block.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_nodeadm_down_1(): """ nodeadm test run: down_1 """ args = """--down p1 p2 p3""" cmdout = \ """nodes marked down: D1 D2 D3 D4 D5 unknown nodes: p1 p2 p3 """ cmderr = '' stubout = \ """ GET_IMPLEMENTATION NODES_DOWN whoami: gooduser p1 p2 p3 """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('nodeadm.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_qselect_no_args_opts(): """ qselect test run: no_args_opts """ args = '' cmdout = \ """ The following jobs matched your query: 100 """ cmderr = '' stubout = \ """ GET_JOBS jobid:* jobid type: <type 'str'> mode:* mode type: <type 'str'> nodes:* nodes type: <type 'str'> project:* project type: <type 'str'> queue:* queue type: <type 'str'> state:* state type: <type 'str'> tag:job tag type: <type 'str'> walltime:* walltime type: <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('qselect.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_slpstat_arg_3(): """ slpstat test run: arg_3 """ args = """arg1""" cmdout = \ """Name Location Update Time ========================================== S0 P0 Mon Apr 22 17:06:10 2013 S1 P1 Mon Apr 22 17:06:20 2013 S2 P2 Mon Apr 22 17:06:30 2013 S3 P3 Mon Apr 22 17:06:40 2013 S4 P4 Mon Apr 22 17:06:50 2013 """ cmderr = \ """No arguments needed """ stubout = \ """ GET_SERVICES location:* location type: <type 'str'> name:* name type: <type 'str'> stamp:* stamp type: <type 'str'> tag:service tag type: <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('slpstat.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_slpstat_arg_3(): """ slpstat test run: arg_3 """ args = """arg1""" cmdout = \ """Name Location Update Time ========================================== S0 P0 Mon Apr 22 17:06:10 2013 S1 P1 Mon Apr 22 17:06:20 2013 S2 P2 Mon Apr 22 17:06:30 2013 S3 P3 Mon Apr 22 17:06:40 2013 S4 P4 Mon Apr 22 17:06:50 2013 """ cmderr = \ """No arguments needed """ stubout = \ """ GET_SERVICES location:* location type: <type 'str'> name:* name type: <type 'str'> stamp:* stamp type: <type 'str'> tag:service tag type: <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('slpstat.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_schedctl_inherit_5(): """ schedctl test run: inherit_5 """ args = """--inherit +1.0 1 2 3""" cmdout = \ """updating inheritance fraction for jobs: 1, 2, 3 """ cmderr = '' stubout = \ """ SET_JOBS Original Jobs: user: gooduser jobid:1 jobid type: <type 'int'> jobid:2 jobid type: <type 'int'> jobid:3 jobid type: <type 'int'> New Job Info: dep_frac:1.0 dep_frac type: <type 'float'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('schedctl.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_schedctl_inherit_5(): """ schedctl test run: inherit_5 """ args = """--inherit +1.0 1 2 3""" cmdout = \ """updating inheritance fraction for jobs: 1, 2, 3 """ cmderr = '' stubout = \ """ SET_JOBS Original Jobs: user: gooduser jobid:1 jobid type: <type 'int'> jobid:2 jobid type: <type 'int'> jobid:3 jobid type: <type 'int'> New Job Info: dep_frac:1.0 dep_frac type: <type 'float'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('schedctl.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_nodeadm_up_1(): """ nodeadm test run: up_1 """ args = """--up p1 p2 p3""" cmdout = \ """nodes marked up: U1 U2 U3 U4 U5 nodes that weren't in the down list: p1 p2 p3 """ cmderr = '' stubout = \ """ GET_IMPLEMENTATION NODES_UP whoami: gooduser args: ['p1', 'p2', 'p3'] """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('nodeadm.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_nodelist_arg_2(): """ nodelist test run: arg_2 """ args = """arg1""" cmdout = \ """Host Queue State ==================== D1 QD1 good D2 QD2 bad D3 QD3 ugly U1 QU1 one U2 QU2 two U3 QU3 three """ cmderr = \ """No arguments needed """ stubout = \ """ GET_IMPLEMENTATION GET_NODES_STATUS GET_QUEUE_ASSIGNMENTS """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('nodelist.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_qselect_no_args_opts(): """ qselect test run: no_args_opts """ args = "" cmdout = """ The following jobs matched your query: 100 """ cmderr = "" stubout = """ GET_JOBS jobid:* jobid type: <type 'str'> mode:* mode type: <type 'str'> nodes:* nodes type: <type 'str'> project:* project type: <type 'str'> queue:* queue type: <type 'str'> state:* state type: <type 'str'> tag:job tag type: <type 'str'> walltime:* walltime type: <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd("qselect.py", args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_schedctl_stop_3(): """ schedctl test run: stop_3 """ args = """-d --stop""" cmdout = \ """Job Scheduling: DISABLED """ cmderr = \ """ schedctl.py -d --stop component: "scheduler.disable", defer: False disable( gooduser, ) """ stubout = \ """ DISABLE whoami: gooduser """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('schedctl.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_qdel_jobid_3(): """ qdel test run: jobid_3 """ args = """1""" cmdout = \ """ Deleted Jobs JobID User ================= 1 gooduser """ cmderr = '' stubout = \ """ DEL_JOBS force:False whoami:gooduser jobid:1 jobid type: <type 'int'> tag:job tag type: <type 'str'> user:gooduser user type: <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('qdel.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_schedctl_stop_3(): """ schedctl test run: stop_3 """ args = """-d --stop""" cmdout = \ """Job Scheduling: DISABLED """ cmderr = \ """ schedctl.py -d --stop component: "scheduler.disable", defer: False disable( gooduser, ) """ stubout = \ """ DISABLE whoami: gooduser """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('schedctl.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_qdel_jobid_3(): """ qdel test run: jobid_3 """ args = """1""" cmdout = \ """ Deleted Jobs JobID User ================= 1 gooduser """ cmderr = '' stubout = \ """ DEL_JOBS force:False whoami:gooduser jobid:1 jobid type: <type 'int'> tag:job tag type: <type 'str'> user:gooduser user type: <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('qdel.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_userres_arg_5(): """ userres test run: arg_5 """ args = """s1""" cmdout = '' cmderr = \ """You are not a user of reservation 's1' and so cannot alter it. """ stubout = \ """ GET_RESERVATIONS cycle:* cycle type: <type 'str'> duration:* duration type: <type 'str'> name:s1 name type: <type 'str'> start:* start type: <type 'str'> users:* users type: <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("BOGUS USER") results = testutils.run_cmd('userres.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_userres_arg_5(): """ userres test run: arg_5 """ args = """s1""" cmdout = '' cmderr = \ """You are not a user of reservation 's1' and so cannot alter it. """ stubout = \ """ GET_RESERVATIONS cycle:* cycle type: <type 'str'> duration:* duration type: <type 'str'> name:s1 name type: <type 'str'> start:* start type: <type 'str'> users:* users type: <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("BOGUS USER") results = testutils.run_cmd('userres.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_slpstat_arg_2(): """ slpstat test run: arg_2 """ args = '' cmdout = \ """no services registered """ cmderr = '' stubout = \ """ GET_SERVICES location:* location type: <type 'str'> name:* name type: <type 'str'> stamp:* stamp type: <type 'str'> tag:service tag type: <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("NO SERVICES") results = testutils.run_cmd('slpstat.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_boot_block_free_3(): """ boot-block test run: free_3 """ args = """--free --jobid 1 --block b""" cmdout = \ """Block free on b initiated. Block b successfully freed. """ cmderr = '' stubout = \ """ INITIATE_PROXY_FREE block: b, type = <type 'str'> user: gooduser jobid: 1, type = <type 'int'> GET_BLOCK_BGSCHED_STATUS block: b, type = <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('boot-block.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_boot_block_free_3(): """ boot-block test run: free_3 """ args = """--free --jobid 1 --block b""" cmdout = \ """Block free on b initiated. Block b successfully freed. """ cmderr = '' stubout = \ """ INITIATE_PROXY_FREE block: b, type = <type 'str'> user: gooduser jobid: 1, type = <type 'int'> GET_BLOCK_BGSCHED_STATUS block: b, type = <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('boot-block.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_slpstat_arg_2(): """ slpstat test run: arg_2 """ args = '' cmdout = \ """no services registered """ cmderr = '' stubout = \ """ GET_SERVICES location:* location type: <type 'str'> name:* name type: <type 'str'> stamp:* stamp type: <type 'str'> tag:service tag type: <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("NO SERVICES") results = testutils.run_cmd('slpstat.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_schedctl_score_4(): """ schedctl test run: score_4 """ args = """--score -1.0 1 2 3""" cmdout = \ """updating scores for jobs: 1, 2, 3 """ cmderr = '' stubout = \ """ ADJUST_JOB_SCORES jobid:1 jobid type: <type 'int'> jobid:2 jobid type: <type 'int'> jobid:3 jobid type: <type 'int'> new score: -1.0, type = <type 'str'> """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('schedctl.py', args, stubout_file) result = testutils.validate_results(results, expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result
def test_nodeadm_queue_2(): """ nodeadm test run: queue_2 """ args = """--queue "QU1 QD1" U1 D1 P1""" cmdout = \ """QU1 QD1 """ cmderr = '' stubout = \ """ GET_IMPLEMENTATION GET_QUEUE_ASSIGNMENTS whoami: gooduser args: ['U1', 'D1', 'P1'] queues: QU1 QD1 """ stubout_file = "stub.out" expected_results = ( 0, # Expected return status cmdout, # Expected command output stubout, # Expected stub functions output cmderr, # Expected command error output ) testutils.save_testhook("") results = testutils.run_cmd('nodeadm.py',args,stubout_file) result = testutils.validate_results(results,expected_results) testutils.remove_testhook() correct = 1 assert result == correct, "Result:\n%s" % result