@@ -246,27 +246,33 @@ def test_container_task_image_spec(mock_image_spec_builder):
246246def test_container_task_timeout ():
247247 ct_with_timeout = ContainerTask (
248248 name = "timeout-test" ,
249+ input_data_dir = "/var/inputs" ,
250+ output_data_dir = "/var/outputs" ,
249251 image = "busybox" ,
250- command = ["sleep" , "5 " ],
252+ command = ["sleep" , "100 " ],
251253 timeout = 1 ,
252254 )
253255
256+
257+
254258 with pytest .raises ((docker .errors .APIError , Exception )):
255259 ct_with_timeout .execute ()
256260
257261 ct_with_timedelta = ContainerTask (
258262 name = "timedelta-timeout-test" ,
263+ input_data_dir = "/var/inputs" ,
264+ output_data_dir = "/var/outputs" ,
259265 image = "busybox" ,
260- command = ["sleep" , "2 " ],
266+ command = ["sleep" , "100 " ],
261267 timeout = timedelta (seconds = 1 ),
262268 )
269+
263270
264271 with pytest .raises ((docker .errors .APIError , Exception )):
265272 ct_with_timedelta .execute ()
266273
267274
268275def test_container_task_timeout_k8s_serialization ():
269- from datetime import timedelta
270276
271277 ps = V1PodSpec (
272278 containers = [], tolerations = [V1Toleration (effect = "NoSchedule" , key = "nvidia.com/gpu" , operator = "Exists" )]
@@ -300,3 +306,18 @@ def test_container_task_timeout_k8s_serialization():
300306
301307 k8s_pod_timedelta = ct_timedelta .get_k8s_pod (default_serialization_settings )
302308 assert k8s_pod_timedelta .pod_spec ["activeDeadlineSeconds" ] == 120
309+
310+ def test_container_task_no_timeout ():
311+
312+ ct = ContainerTask (
313+ name = "no-timeout-task" ,
314+ input_data_dir = "/var/inputs" ,
315+ output_data_dir = "/var/outputs" ,
316+ image = "busybox" ,
317+ command = ["sleep" , "1" ],
318+ timeout = 500 ,
319+ )
320+
321+
322+
323+ ct .execute ()
0 commit comments