def test_build_test_execution_commands_spot_bid(self): """Test building commands using spot bids instead of flat rates.""" exp = (["starcluster -c sc_config start -b 0.50 --force-spot-master " "nightly_tests"], ["starcluster -c sc_config sshmaster -u root nightly_tests " "'source /bin/setup.sh; cd /bin; ./tests.py'", "starcluster -c sc_config sshmaster -u root nightly_tests " "'/bin/cogent_tests'"], ["starcluster -c sc_config terminate -c nightly_tests"]) test_suites = parse_config_file(self.config) obs = _build_test_execution_commands(test_suites, 'sc_config', 'nightly_tests', spot_bid=0.50) self.assertEqual(obs, exp) # With custom cluster template and user. exp = (["starcluster -c sc_config start -c some_cluster_template -b " "1.00 --force-spot-master nightly_tests"], ["starcluster -c sc_config sshmaster -u ubuntu nightly_tests " "'source /bin/setup.sh; cd /bin; ./tests.py'", "starcluster -c sc_config sshmaster -u ubuntu nightly_tests " "'/bin/cogent_tests'"], ["starcluster -c sc_config terminate -c nightly_tests"]) obs = _build_test_execution_commands(test_suites, 'sc_config', 'nightly_tests', cluster_template='some_cluster_template', user='******', spot_bid=1) self.assertEqual(obs, exp)
def test_build_test_execution_commands_no_test_suites(self): """Test building commands with no test suites.""" exp = (["starcluster -c sc_config start nightly_tests"], [], ["starcluster -c sc_config terminate -c nightly_tests"]) obs = _build_test_execution_commands([], 'sc_config', 'ubuntu', 'nightly_tests') self.assertEqual(obs, exp)
def test_build_test_execution_commands_no_test_suites(self): """Test building commands with no test suites.""" exp = (["starcluster -c sc_config start nightly_tests"], [], ["starcluster -c sc_config terminate -c nightly_tests"]) obs = _build_test_execution_commands([], 'sc_config', 'ubuntu', 'nightly_tests') self.assertEqual(obs, exp)
def test_build_test_execution_commands_standard(self): """Test building commands based on standard, valid input.""" exp = (["starcluster -c sc_config start nightly_tests"], ["starcluster -c sc_config sshmaster -u root nightly_tests " "'source /bin/setup.sh; cd /bin; ./tests.py'", "starcluster -c sc_config sshmaster -u root nightly_tests " "'/bin/cogent_tests'"], ["starcluster -c sc_config terminate -c nightly_tests"]) test_suites = parse_config_file(self.config) obs = _build_test_execution_commands(test_suites, 'sc_config', 'nightly_tests') self.assertEqual(obs, exp)
def test_build_test_execution_commands_standard(self): """Test building commands based on standard, valid input.""" exp = (["starcluster -c sc_config start nightly_tests"], [ "starcluster -c sc_config sshmaster -u ubuntu nightly_tests " "'source /bin/setup.sh; cd /bin; ./tests.py'", "starcluster -c sc_config sshmaster -u ubuntu nightly_tests " "'/bin/cogent_tests'" ], ["starcluster -c sc_config terminate -c nightly_tests"]) test_suites = parse_config_file(self.config) obs = _build_test_execution_commands(test_suites, 'sc_config', 'ubuntu', 'nightly_tests') self.assertEqual(obs, exp)
def test_build_test_execution_commands_custom_cluster_template(self): """Test building commands using a non-default cluster template.""" exp = (["starcluster -c sc_config start -c some_cluster_template " "nightly_tests"], ["starcluster -c sc_config sshmaster -u ubuntu nightly_tests " "'source /bin/setup.sh; cd /bin; ./tests.py'", "starcluster -c sc_config sshmaster -u ubuntu nightly_tests " "'/bin/cogent_tests'"], ["starcluster -c sc_config terminate -c nightly_tests"]) test_suites = parse_config_file(self.config) obs = _build_test_execution_commands(test_suites, 'sc_config', 'nightly_tests', 'some_cluster_template', 'ubuntu') self.assertEqual(obs, exp)
def test_build_test_execution_commands_custom_starcluster_exe_fp(self): """Test building commands using a non-default starcluster exec.""" exp = (["/usr/local/bin/starcluster -c sc_config start -c " "some_cluster_template nightly_tests"], ["/usr/local/bin/starcluster -c sc_config sshmaster -u ubuntu " "nightly_tests 'source /bin/setup.sh; cd /bin; ./tests.py'", "/usr/local/bin/starcluster -c sc_config sshmaster -u ubuntu " "nightly_tests '/bin/cogent_tests'"], ["/usr/local/bin/starcluster -c sc_config terminate -c " "nightly_tests"]) test_suites = parse_config_file(self.config) obs = _build_test_execution_commands(test_suites, 'sc_config', 'nightly_tests', 'some_cluster_template', 'ubuntu', sc_exe_fp='/usr/local/bin/starcluster') self.assertEqual(obs, exp)
def test_build_test_execution_commands_custom_cluster_template(self): """Test building commands using a non-default cluster template.""" exp = ([ "starcluster -c sc_config start -c some_cluster_template " "nightly_tests" ], [ "starcluster -c sc_config sshmaster -u ubuntu nightly_tests " "'source /bin/setup.sh; cd /bin; ./tests.py'", "starcluster -c sc_config sshmaster -u ubuntu nightly_tests " "'/bin/cogent_tests'" ], ["starcluster -c sc_config terminate -c nightly_tests"]) test_suites = parse_config_file(self.config) obs = _build_test_execution_commands(test_suites, 'sc_config', 'ubuntu', 'nightly_tests', 'some_cluster_template') self.assertEqual(obs, exp)