def test_one_node(self): mock_ssh_file('testmaster', 'some_file', b'file contents') run_on_all_nodes(self.runner, self.output_dir, ['cat', 'some_file'], print_stderr=False) with open(os.path.join(self.output_dir, 'master', 'stdout'), 'r') as f: self.assertEqual(f.read().rstrip(), 'file contents') self.assertEqual(os.listdir(self.output_dir), ['master'])
def test_one_node(self): mock_ssh_file('testmaster', 'some_file', 'file contents') run_on_all_nodes(self.runner, self.output_dir, ['cat', 'some_file'], print_stderr=False) with open(os.path.join(self.output_dir, 'master', 'stdout'), 'r') as f: self.assertEqual(f.read(), 'file contents\n') self.assertEqual(os.listdir(self.output_dir), ['master'])
def test_two_nodes(self): self.add_slave() self.runner._opts['num_ec2_instances'] = 2 mock_ssh_file('testmaster', 'some_file', 'file contents 1') mock_ssh_file('testmaster!testslave0', 'some_file', 'file contents 2') run_on_all_nodes(self.runner, self.output_dir, ['cat', 'some_file'], print_stderr=False) with open(os.path.join(self.output_dir, 'master', 'stdout'), 'r') as f: self.assertEqual(f.read(), 'file contents 1\n') with open(os.path.join(self.output_dir, 'slave testslave0', 'stdout'), 'r') as f: self.assertEqual(f.read(), 'file contents 2\n') self.assertEqual(sorted(os.listdir(self.output_dir)), ['master', 'slave testslave0'])
def test_two_nodes(self): self.add_slave() self.runner._opts['num_ec2_instances'] = 2 mock_ssh_file('testmaster', 'some_file', 'file contents 1') mock_ssh_file('testmaster!testslave0', 'some_file', 'file contents 2') run_on_all_nodes(self.runner, self.output_dir, ['cat', 'some_file'], print_stderr=False) with open(os.path.join(self.output_dir, 'master', 'stdout'), 'r') as f: assert_equal(f.read(), 'file contents 1\n') with open(os.path.join(self.output_dir, 'slave testslave0', 'stdout'), 'r') as f: assert_equal(f.read(), 'file contents 2\n') assert_equal(sorted(os.listdir(self.output_dir)), ['master', 'slave testslave0'])
def test_two_nodes(self): self.add_slave() self.runner._opts['num_ec2_instances'] = 2 mock_ssh_file('testmaster', 'some_file', b'file contents 1') mock_ssh_file('testmaster!testslave0', 'some_file', b'file contents 2') self.runner.fs # force initialization of _ssh_fs self.runner._enable_slave_ssh_access() run_on_all_nodes(self.runner, self.output_dir, ['cat', 'some_file'], print_stderr=False) with open(os.path.join(self.output_dir, 'master', 'stdout'), 'r') as f: self.assertEqual(f.read().rstrip(), 'file contents 1') with open(os.path.join(self.output_dir, 'slave testslave0', 'stdout'), 'r') as f: self.assertEqual(f.read().strip(), 'file contents 2') self.assertEqual(sorted(os.listdir(self.output_dir)), ['master', 'slave testslave0'])