def testWaitForCompletion(self, mock_check_output): # Test success mock_check_output.return_value = '\'0,0,\'' self.assertTrue(kubectl_util.WaitForCompletion('test_pod')) # Test failure mock_check_output.return_value = '\'0,1,\'' self.assertFalse(kubectl_util.WaitForCompletion('test_pod')) # Test timeout with self.assertRaises(kubectl_util.TimeoutError): mock_check_output.return_value = '\'0,,\'' kubectl_util.WaitForCompletion('test_pod', timeout=5)
def _RunBenchmark(name, yaml_file): """Runs a single distributed benchmark. Args: name: name of the benchmark to run. yaml_file: path to kubernetes config file. """ kubectl_util.DeletePods(name, yaml_file) kubectl_util.CreatePods(name, yaml_file) kubectl_util.WaitForCompletion(name) kubectl_util.DeletePods(name, yaml_file)