diff --git a/pkg/nvcdi/transform/merged-device_test.go b/pkg/nvcdi/transform/merged-device_test.go index d8ef7244..10328530 100644 --- a/pkg/nvcdi/transform/merged-device_test.go +++ b/pkg/nvcdi/transform/merged-device_test.go @@ -163,6 +163,18 @@ func TestMergedDevice(t *testing.T) { }, expectedSpec: &specs.Spec{ Devices: []specs.Device{ + { + Name: "all", + ContainerEdits: specs.ContainerEdits{ + Hooks: []*specs.Hook{ + { + HookName: "createContainer", + Path: "/usr/bin/nvidia-ctk", + Args: []string{"nvidia-ctk", "hook", "chmod", "--mode", "755", "--path", "/dev/dri"}, + }, + }, + }, + }, { Name: "gpu0", ContainerEdits: specs.ContainerEdits{ @@ -187,18 +199,6 @@ func TestMergedDevice(t *testing.T) { }, }, }, - { - Name: "all", - ContainerEdits: specs.ContainerEdits{ - Hooks: []*specs.Hook{ - { - HookName: "createContainer", - Path: "/usr/bin/nvidia-ctk", - Args: []string{"nvidia-ctk", "hook", "chmod", "--mode", "755", "--path", "/dev/dri"}, - }, - }, - }, - }, }, }, }, diff --git a/pkg/nvcdi/transform/simplify.go b/pkg/nvcdi/transform/simplify.go index a2162ad6..ddc6f597 100644 --- a/pkg/nvcdi/transform/simplify.go +++ b/pkg/nvcdi/transform/simplify.go @@ -29,7 +29,11 @@ var _ Transformer = (*simplify)(nil) // NewSimplifier creates a simplifier transformer. // This transoformer ensures that entities in the spec are deduplicated and that common edits are removed from device-specific edits. func NewSimplifier() Transformer { - return &simplify{} + return Merge( + dedupe{}, + simplify{}, + sorter{}, + ) } // Transform simplifies the supplied spec.