@@ -244,29 +244,12 @@ def test_container_task_image_spec(mock_image_spec_builder):
244244 assert pod .pod_spec ["containers" ][1 ]["image" ] == image_spec_2 .image_name ()
245245
246246def test_container_task_timeout ():
247- ct_with_timeout = ContainerTask (
248- name = "timeout-test" ,
249- input_data_dir = "/var/inputs" ,
250- output_data_dir = "/var/outputs" ,
251- image = "busybox" ,
252- command = ["sleep" , "100" ],
253- timeout = 1 ,
254- )
255-
256-
257-
258- with pytest .raises ((docker .errors .APIError , Exception )):
259- ct_with_timeout .execute ()
260-
261247 ct_with_timedelta = ContainerTask (
262248 name = "timedelta-timeout-test" ,
263- input_data_dir = "/var/inputs" ,
264- output_data_dir = "/var/outputs" ,
265249 image = "busybox" ,
266250 command = ["sleep" , "100" ],
267251 timeout = timedelta (seconds = 1 ),
268252 )
269-
270253
271254 with pytest .raises ((docker .errors .APIError , Exception )):
272255 ct_with_timedelta .execute ()
@@ -278,24 +261,13 @@ def test_container_task_timeout_k8s_serialization():
278261 containers = [], tolerations = [V1Toleration (effect = "NoSchedule" , key = "nvidia.com/gpu" , operator = "Exists" )]
279262 )
280263 pt = PodTemplate (pod_spec = ps , labels = {"test" : "timeout" })
281-
282- ct_numeric = ContainerTask (
283- name = "timeout-k8s-test" ,
284- image = "busybox" ,
285- command = ["echo" , "hello" ],
286- pod_template = pt ,
287- timeout = 60 ,
288- )
289-
264+
290265 default_image = Image (name = "default" , fqn = "docker.io/xyz" , tag = "some-git-hash" )
291266 default_image_config = ImageConfig (default_image = default_image )
292267 default_serialization_settings = SerializationSettings (
293268 project = "p" , domain = "d" , version = "v" , image_config = default_image_config
294269 )
295270
296- k8s_pod = ct_numeric .get_k8s_pod (default_serialization_settings )
297- assert k8s_pod .pod_spec ["activeDeadlineSeconds" ] == 60
298-
299271 ct_timedelta = ContainerTask (
300272 name = "timeout-k8s-timedelta-test" ,
301273 image = "busybox" ,
@@ -308,16 +280,13 @@ def test_container_task_timeout_k8s_serialization():
308280 assert k8s_pod_timedelta .pod_spec ["activeDeadlineSeconds" ] == 120
309281
310282def test_container_task_no_timeout ():
311-
312- ct = ContainerTask (
283+ ct_timedelta = ContainerTask (
313284 name = "no-timeout-task" ,
314285 input_data_dir = "/var/inputs" ,
315286 output_data_dir = "/var/outputs" ,
316287 image = "busybox" ,
317288 command = ["sleep" , "1" ],
318- timeout = 500 ,
289+ timeout = timedelta ( seconds = 500 ) ,
319290 )
320291
321-
322-
323- ct .execute ()
292+ ct_timedelta .execute ()
0 commit comments