From 87e406eee62bb47fdfd98f18da3919b3edb2e4c5 Mon Sep 17 00:00:00 2001 From: Christopher Desiniotis Date: Thu, 23 Feb 2023 11:08:04 -0800 Subject: [PATCH] Update root transformer tests to ensure container path is not modified Signed-off-by: Christopher Desiniotis --- pkg/nvcdi/transform/root_test.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/nvcdi/transform/root_test.go b/pkg/nvcdi/transform/root_test.go index 519c9eae..0d036f90 100644 --- a/pkg/nvcdi/transform/root_test.go +++ b/pkg/nvcdi/transform/root_test.go @@ -52,18 +52,18 @@ func TestRootTransformer(t *testing.T) { spec: &specs.Spec{ ContainerEdits: specs.ContainerEdits{ DeviceNodes: []*specs.DeviceNode{ - {HostPath: "/root/dev/nvidia0"}, - {HostPath: "/target-root/dev/nvidia1"}, - {HostPath: "/different-root/dev/nvidia2"}, + {HostPath: "/root/dev/nvidia0", Path: "/root/dev/nvidia0"}, + {HostPath: "/target-root/dev/nvidia1", Path: "/target-root/dev/nvidia1"}, + {HostPath: "/different-root/dev/nvidia2", Path: "/different-root/dev/nvidia2"}, }, }, }, expectedSpec: &specs.Spec{ ContainerEdits: specs.ContainerEdits{ DeviceNodes: []*specs.DeviceNode{ - {HostPath: "/target-root/dev/nvidia0"}, - {HostPath: "/target-root/dev/nvidia1"}, - {HostPath: "/different-root/dev/nvidia2"}, + {HostPath: "/target-root/dev/nvidia0", Path: "/root/dev/nvidia0"}, + {HostPath: "/target-root/dev/nvidia1", Path: "/target-root/dev/nvidia1"}, + {HostPath: "/different-root/dev/nvidia2", Path: "/different-root/dev/nvidia2"}, }, }, }, @@ -75,18 +75,18 @@ func TestRootTransformer(t *testing.T) { spec: &specs.Spec{ ContainerEdits: specs.ContainerEdits{ Mounts: []*specs.Mount{ - {HostPath: "/root/lib/lib1.so"}, - {HostPath: "/target-root/lib/lib2.so"}, - {HostPath: "/different-root/lib/lib3.so"}, + {HostPath: "/root/lib/lib1.so", ContainerPath: "/root/lib/lib1.so"}, + {HostPath: "/target-root/lib/lib2.so", ContainerPath: "/target-root/lib/lib2.so"}, + {HostPath: "/different-root/lib/lib3.so", ContainerPath: "/different-root/lib/lib3.so"}, }, }, }, expectedSpec: &specs.Spec{ ContainerEdits: specs.ContainerEdits{ Mounts: []*specs.Mount{ - {HostPath: "/target-root/lib/lib1.so"}, - {HostPath: "/target-root/lib/lib2.so"}, - {HostPath: "/different-root/lib/lib3.so"}, + {HostPath: "/target-root/lib/lib1.so", ContainerPath: "/root/lib/lib1.so"}, + {HostPath: "/target-root/lib/lib2.so", ContainerPath: "/target-root/lib/lib2.so"}, + {HostPath: "/different-root/lib/lib3.so", ContainerPath: "/different-root/lib/lib3.so"}, }, }, },