Пример #1
0
 def test_get_status_success(self, mock_read_namespaced_job,
                             mock_list_namespaced_pod):
     """
     Checking if job status is complete
     """
     executor = self.data['executors'][0]
     jobname = executor['metadata']['name']
     job = Job(executor, jobname, taskmaster.args.namespace)
     status, all_pods_running = job.get_status(False)
     self.assertEqual(status, "Complete")
Пример #2
0
 def test_get_status_running(self, mock_read_namespaced_job,
                             mock_list_namespaced_pod):
     """
     Checking if the job is in running state in an ideal situation
     """
     executor = self.data['executors'][0]
     jobname = executor['metadata']['name']
     job = Job(executor, jobname, taskmaster.args.namespace)
     status, all_pods_running = job.get_status(False)
     self.assertEqual(status, "Running")
Пример #3
0
 def test_get_job_status_for_failed_pod(self, mock_read_namespaced_job,
                                        mock_list_namespaced_pod):
     """
     Checking if the job status is 'running' when the pod failed to start with a reason other than ImagePullBackOff.
     """
     mock_list_namespaced_pod.return_value = list_namespaced_pod_pending_unknown_error(
     )
     mock_read_namespaced_job.return_value = read_namespaced_job_pending()
     executor = self.data['executors'][0]
     jobname = executor['metadata']['name']
     job = Job(executor, jobname, taskmaster.args.namespace)
     status, all_pods_running = job.get_status(False)
     self.assertEqual(status, "Running")
Пример #4
0
 def test_get_job_status_for_wrong_image(self, mock_read_namespaced_job,
                                         mock_list_namespaced_pod):
     """
     Assuming image name is wrong, the testcase will check if job status returned from the method is "running"
     during the default pod timeout.
     """
     mock_list_namespaced_pod.return_value = list_namespaced_pod_error_ImagePullBackOff(
         2)
     mock_read_namespaced_job.return_value = read_namespaced_job_pending(2)
     executor = self.data['executors'][0]
     jobname = executor['metadata']['name']
     job = Job(executor, jobname, taskmaster.args.namespace)
     status, all_pods_running = job.get_status(False)
     self.assertEqual(status, "Running")
Пример #5
0
 def test_get_job_status_ImagaPullBackoff_error(self,
                                                mock_list_namespaced_pod,
                                                mock_read_namespaced_job):
     """
     Checking whether the job state is 'error', when the pod failed to start and if reason for pod failure
     is ImagePullBackOff
     """
     mock_list_namespaced_pod.return_value = list_namespaced_pod_error_ImagePullBackOff(
     )
     executor = self.data['executors'][0]
     jobname = executor['metadata']['name']
     job = Job(executor, jobname, taskmaster.args.namespace)
     job.timeout = 50
     status, all_pods_running = job.get_status(False)
     self.assertEqual(status, "Error")