def test_single_node_fail(self, get_target_nodes): args = MagicMock() args.command = "foo" args.may_fail = False args.node_workers = 2 args.sudo = True node = FakeNode("node1") get_target_nodes.return_value = [node] output = list(run.bw_run(MagicMock(), args)) self.assertTrue(output[0].startswith("[node1] ✘ failed after ")) self.assertTrue(output[0].endswith("s (return code 47)"))
def test_group_success(self, get_target_nodes): args = MagicMock() args.command = "foo" args.may_fail = False args.node_workers = 2 args.sudo = True node1 = FakeNode("node1") node1.result.return_code = 0 node2 = FakeNode("node2") node2.result.return_code = 0 get_target_nodes.return_value = [node1, node2] output = list(run.bw_run(MagicMock(), args)) self.assertTrue("completed successfully after" in output[0]) self.assertTrue("completed successfully after" in output[1]) self.assertEqual(len(output), 2)