X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2dd214985e9727bf0b5fbf11b0e39c3e7d3cc5c4..a4166f402b34e018940ae1df726351e8c52ac1c1:/services/nodemanager/tests/integration_test.py diff --git a/services/nodemanager/tests/integration_test.py b/services/nodemanager/tests/integration_test.py index f188f03140..284b361cea 100755 --- a/services/nodemanager/tests/integration_test.py +++ b/services/nodemanager/tests/integration_test.py @@ -124,8 +124,11 @@ def node_busy(g): def node_shutdown(g): global compute_nodes - del compute_nodes[g.group(1)] - return 0 + if g.group(1) in compute_nodes: + del compute_nodes[g.group(1)] + return 0 + else: + return 1 def jobs_req(g): global all_jobs @@ -284,21 +287,28 @@ def main(): # Provider "azure"), "test_single_node_azure": ( + # Actions (pattern -> action) [ (r".*Daemon started", set_squeue), (r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)", node_paired), (r".*ComputeNodeMonitorActor\..*\.([^[]*).*Not eligible for shut down because node state is \('busy', 'open', .*\)", node_busy), (r".*ComputeNodeMonitorActor\..*\.([^[]*).*Suggesting shutdown because node state is \('idle', 'open', .*\)", noop), (r".*ComputeNodeShutdownActor\..*\.([^[]*).*Shutdown success", node_shutdown), - ], { + ], + # Checks (things that shouldn't happen) + { r".*Suggesting shutdown because node state is \('down', .*\)": fail, r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)": partial(expect_count, 1), r".*Setting node quota.*": fail, }, + # Driver class "arvnodeman.test.fake_driver.FakeDriver", + # Jobs {"34t0i-dz642-h42bg3hq4bdfpf9": "ReqNodeNotAvail"}, + # Provider "azure"), "test_multiple_nodes": ( + # Actions (pattern -> action) [ (r".*Daemon started", set_squeue), (r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)", node_paired), @@ -311,46 +321,56 @@ def main(): (r".*ComputeNodeShutdownActor\..*\.([^[]*).*Shutdown success", node_shutdown), (r".*ComputeNodeShutdownActor\..*\.([^[]*).*Shutdown success", node_shutdown), (r".*ComputeNodeShutdownActor\..*\.([^[]*).*Shutdown success", node_shutdown), - ], { + ], + # Checks (things that shouldn't happen) + { r".*Suggesting shutdown because node state is \('down', .*\)": fail, r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)": partial(expect_count, 4), r".*Setting node quota.*": fail, }, + # Driver class "arvnodeman.test.fake_driver.FakeDriver", + # Jobs {"34t0i-dz642-h42bg3hq4bdfpf1": "ReqNodeNotAvail", "34t0i-dz642-h42bg3hq4bdfpf2": "ReqNodeNotAvail", "34t0i-dz642-h42bg3hq4bdfpf3": "ReqNodeNotAvail", - "34t0i-dz642-h42bg3hq4bdfpf4": "ReqNodeNotAvail" - }, "azure"), + "34t0i-dz642-h42bg3hq4bdfpf4": "ReqNodeNotAvail"}, + # Provider + "azure"), "test_hit_quota": ( + # Actions (pattern -> action) [ (r".*Daemon started", set_squeue), (r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)", node_paired), (r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)", node_paired), (r".*ComputeNodeMonitorActor\..*\.([^[]*).*Not eligible for shut down because node state is \('busy', 'open', .*\)", node_busy), (r".*ComputeNodeMonitorActor\..*\.([^[]*).*Suggesting shutdown because node state is \('idle', 'open', .*\)", remaining_jobs), - (r".*ComputeNodeMonitorActor\..*\.([^[]*).*Not eligible for shut down because node state is \('busy', 'open', .*\)", node_busy), (r".*ComputeNodeShutdownActor\..*\.([^[]*).*Shutdown success", node_shutdown), (r".*ComputeNodeShutdownActor\..*\.([^[]*).*Shutdown success", node_shutdown) - ], { + ], + # Checks (things that shouldn't happen) + { r".*Suggesting shutdown because node state is \('down', .*\)": fail, r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)": partial(expect_count, 2), r".*Sending create_node request.*": partial(expect_count, 5) }, + # Driver class "arvnodeman.test.fake_driver.QuotaDriver", + # Jobs {"34t0i-dz642-h42bg3hq4bdfpf1": "ReqNodeNotAvail", "34t0i-dz642-h42bg3hq4bdfpf2": "ReqNodeNotAvail", "34t0i-dz642-h42bg3hq4bdfpf3": "ReqNodeNotAvail", - "34t0i-dz642-h42bg3hq4bdfpf4": "ReqNodeNotAvail" - }, "azure"), + "34t0i-dz642-h42bg3hq4bdfpf4": "ReqNodeNotAvail"}, + # Provider + "azure"), "test_probe_quota": ( + # Actions (pattern -> action) [ (r".*Daemon started", set_squeue), (r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)", node_paired), (r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)", node_paired), (r".*ComputeNodeMonitorActor\..*\.([^[]*).*Not eligible for shut down because node state is \('busy', 'open', .*\)", node_busy), (r".*ComputeNodeMonitorActor\..*\.([^[]*).*Suggesting shutdown because node state is \('idle', 'open', .*\)", remaining_jobs), - (r".*ComputeNodeMonitorActor\..*\.([^[]*).*Not eligible for shut down because node state is \('busy', 'open', .*\)", node_busy), (r".*ComputeNodeShutdownActor\..*\.([^[]*).*Shutdown success", node_shutdown), (r".*ComputeNodeShutdownActor\..*\.([^[]*).*Shutdown success", node_shutdown), (r".*sending request", jobs_req), @@ -364,18 +384,24 @@ def main(): (r".*ComputeNodeShutdownActor\..*\.([^[]*).*Shutdown success", node_shutdown), (r".*ComputeNodeShutdownActor\..*\.([^[]*).*Shutdown success", node_shutdown), (r".*ComputeNodeShutdownActor\..*\.([^[]*).*Shutdown success", node_shutdown), - ], { + ], + # Checks (things that shouldn't happen) + { r".*Suggesting shutdown because node state is \('down', .*\)": fail, r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)": partial(expect_count, 6), r".*Sending create_node request.*": partial(expect_count, 9) }, + # Driver class "arvnodeman.test.fake_driver.QuotaDriver", + # Jobs {"34t0i-dz642-h42bg3hq4bdfpf1": "ReqNodeNotAvail", "34t0i-dz642-h42bg3hq4bdfpf2": "ReqNodeNotAvail", "34t0i-dz642-h42bg3hq4bdfpf3": "ReqNodeNotAvail", - "34t0i-dz642-h42bg3hq4bdfpf4": "ReqNodeNotAvail" - }, "azure"), + "34t0i-dz642-h42bg3hq4bdfpf4": "ReqNodeNotAvail"}, + # Provider + "azure"), "test_no_hang_failing_node_create": ( + # Actions (pattern -> action) [ (r".*Daemon started", set_squeue), (r".*Client error: nope", noop), @@ -383,53 +409,74 @@ def main(): (r".*Client error: nope", noop), (r".*Client error: nope", noop), ], + # Checks (things that shouldn't happen) {}, + # Driver class "arvnodeman.test.fake_driver.FailingDriver", + # Jobs {"34t0i-dz642-h42bg3hq4bdfpf1": "ReqNodeNotAvail", "34t0i-dz642-h42bg3hq4bdfpf2": "ReqNodeNotAvail", "34t0i-dz642-h42bg3hq4bdfpf3": "ReqNodeNotAvail", - "34t0i-dz642-h42bg3hq4bdfpf4": "ReqNodeNotAvail" - }, "azure"), + "34t0i-dz642-h42bg3hq4bdfpf4": "ReqNodeNotAvail"}, + # Provider + "azure"), "test_retry_create": ( + # Actions (pattern -> action) [ (r".*Daemon started", set_squeue), (r".*Rate limit exceeded - scheduling retry in 12 seconds", noop), (r".*Rate limit exceeded - scheduling retry in 2 seconds", noop), (r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)", noop), ], + # Checks (things that shouldn't happen) {}, + # Driver class "arvnodeman.test.fake_driver.RetryDriver", - {"34t0i-dz642-h42bg3hq4bdfpf1": "ReqNodeNotAvail" - }, "azure"), + # Jobs + {"34t0i-dz642-h42bg3hq4bdfpf1": "ReqNodeNotAvail"}, + # Provider + "azure"), "test_single_node_aws": ( + # Actions (pattern -> action) [ (r".*Daemon started", set_squeue), (r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)", node_paired), (r".*ComputeNodeMonitorActor\..*\.([^[]*).*Not eligible for shut down because node state is \('busy', 'open', .*\)", node_busy), (r".*ComputeNodeMonitorActor\..*\.([^[]*).*Suggesting shutdown because node state is \('idle', 'open', .*\)", noop), (r".*ComputeNodeShutdownActor\..*\.([^[]*).*Shutdown success", node_shutdown), - ], { + ], + # Checks (things that shouldn't happen) + { r".*Suggesting shutdown because node state is \('down', .*\)": fail, r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)": partial(expect_count, 1), r".*Setting node quota.*": fail, }, + # Driver class "arvnodeman.test.fake_driver.FakeAwsDriver", + # Jobs {"34t0i-dz642-h42bg3hq4bdfpf9": "ReqNodeNotAvail"}, + # Provider "ec2"), "test_single_node_gce": ( + # Actions (pattern -> action) [ (r".*Daemon started", set_squeue), (r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)", node_paired), (r".*ComputeNodeMonitorActor\..*\.([^[]*).*Not eligible for shut down because node state is \('busy', 'open', .*\)", node_busy), (r".*ComputeNodeMonitorActor\..*\.([^[]*).*Suggesting shutdown because node state is \('idle', 'open', .*\)", noop), (r".*ComputeNodeShutdownActor\..*\.([^[]*).*Shutdown success", node_shutdown), - ], { + ], + # Checks (things that shouldn't happen) + { r".*Suggesting shutdown because node state is \('down', .*\)": fail, r".*Cloud node (\S+) is now paired with Arvados node (\S+) with hostname (\S+)": partial(expect_count, 1), r".*Setting node quota.*": fail, }, + # Driver class "arvnodeman.test.fake_driver.FakeGceDriver", + # Jobs {"34t0i-dz642-h42bg3hq4bdfpf9": "ReqNodeNotAvail"}, + # Provider "gce") }