Handle hook arguments for creation of symlinks

Signed-off-by: Christopher Desiniotis <cdesiniotis@nvidia.com>
This commit is contained in:
Christopher Desiniotis
2023-02-22 13:11:10 -08:00
parent 0516fc96ca
commit 45ed3b0412
3 changed files with 98 additions and 9 deletions

View File

@@ -98,18 +98,54 @@ func TestRootTransformer(t *testing.T) {
spec: &specs.Spec{
ContainerEdits: specs.ContainerEdits{
Hooks: []*specs.Hook{
{Path: "/root/usr/bin/nvidia-ctk"},
{Path: "/target-root/usr/bin/nvidia-ctk"},
{Path: "/different-root/usr/bin/nvidia-ctk"},
{
Path: "/root/usr/bin/nvidia-ctk",
Args: []string{
"--link",
"/root/path/to/target::/root/path/to/link",
},
},
{
Path: "/target-root/usr/bin/nvidia-ctk",
Args: []string{
"--link",
"/target-root/path/to/target::/target-root/path/to/link",
},
},
{
Path: "/different-root/usr/bin/nvidia-ctk",
Args: []string{
"--link",
"/different-root/path/to/target::/different-root/path/to/link",
},
},
},
},
},
expectedSpec: &specs.Spec{
ContainerEdits: specs.ContainerEdits{
Hooks: []*specs.Hook{
{Path: "/target-root/usr/bin/nvidia-ctk"},
{Path: "/target-root/usr/bin/nvidia-ctk"},
{Path: "/different-root/usr/bin/nvidia-ctk"},
{
Path: "/target-root/usr/bin/nvidia-ctk",
Args: []string{
"--link",
"/target-root/path/to/target::/target-root/path/to/link",
},
},
{
Path: "/target-root/usr/bin/nvidia-ctk",
Args: []string{
"--link",
"/target-root/path/to/target::/target-root/path/to/link",
},
},
{
Path: "/different-root/usr/bin/nvidia-ctk",
Args: []string{
"--link",
"/different-root/path/to/target::/different-root/path/to/link",
},
},
},
},
},