Skip to content

Commit

Permalink
Test that explicitly configured pod template with shm vol is not remo…
Browse files Browse the repository at this point in the history
…ved if disable in task config

Signed-off-by: Fabio Grätz <[email protected]>
  • Loading branch information
Fabio Grätz committed Jul 19, 2024
1 parent 60c8211 commit d6941d5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions plugins/flytekit-kf-pytorch/tests/test_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@
True,
True,
),
# Test that explicitly configured pod template with shared memory volume is not removed if `increase_shared_mem=False`
(
Elastic(nnodes=2, increase_shared_mem=False),
PodTemplate(
pod_spec=V1PodSpec(
containers=[
V1Container(name="primary", volume_mounts=[V1VolumeMount(name="shm", mount_path="/dev/shm")]),
],
volumes=[V1Volume(name="shm", empty_dir=V1EmptyDirVolumeSource(medium="Memory"))],
),
),
True,
False,
),
],
)
def test_task_shared_memory(
Expand Down Expand Up @@ -90,6 +104,7 @@ def test_task() -> None:
)

else:
# Check that the shared memory volume + volume mount is not added
no_pod_template = test_task.pod_template is None
no_pod_spec = no_pod_template or test_task.pod_template.pod_spec is None
no_volumes = no_pod_spec or test_task.pod_template.pod_spec.volumes is None
Expand Down

0 comments on commit d6941d5

Please sign in to comment.