def test__delete_initialized_job_with_force_flag(): job = StatelessJob() job.create() # the job might have transitioned to INITIALIZED/PENDING # since there is no way to fine control the job transitions job.delete(force_delete=True) time.sleep(10) try: job.get_job() except grpc.RpcError as e: assert e.code() == grpc.StatusCode.NOT_FOUND return raise Exception("job not found error not received")
def test__delete_running_job_with_force_flag(): job = StatelessJob() job.create() job.wait_for_state(goal_state="RUNNING") job.delete(force_delete=True) time.sleep(10) try: job.get_job() except grpc.RpcError as e: assert e.code() == grpc.StatusCode.NOT_FOUND return raise Exception("job not found error not received")
def test__delete_killed_job(): job = StatelessJob() job.create() job.wait_for_state(goal_state="RUNNING") job.stop() job.wait_for_state(goal_state="KILLED") job.delete() time.sleep(10) try: job.get_job() except grpc.RpcError as e: assert e.code() == grpc.StatusCode.NOT_FOUND return raise Exception("job not found error not received")
def test__delete_sla_violated_job(): """ 1. Create a stateless job(instance_count=5) with host-limit-1 constraint and MaximumUnavailableInstances=1. Since there are only 3 UP hosts, 2 of the instances will not get placed (hence unavailable). 2. Force delete the job and verify that the job is deleted """ job = StatelessJob(job_file="test_stateless_job_spec_sla.yaml", ) job.job_spec.instance_count = 5 job.create() job.wait_for_all_pods_running(num_pods=3) job.delete(force_delete=True) time.sleep(10) try: job.get_job() except grpc.RpcError as e: assert e.code() == grpc.StatusCode.NOT_FOUND return raise Exception("job not found error not received")