Skip to content

Commit

Permalink
unittest for edit mount order
Browse files Browse the repository at this point in the history
Signed-off-by: zhuyiqing.wiz <[email protected]>
  • Loading branch information
zhuyiqing.wiz committed Nov 16, 2024
1 parent 7d4fb44 commit 6b16d3c
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions pkg/cdi/container-edits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,45 @@ func TestApplyContainerEdits(t *testing.T) {
},
},
},
{
name: "mount added by edit comes after existing ones of same number of path parts",
spec: &oci.Spec{
Mounts: []oci.Mount{
{
Source: "/some/host/path1",
Destination: "/dest/path/c",
},
{
Source: "/some/host/path2",
Destination: "/dest/path/b",
},
},
},
edits: &cdi.ContainerEdits{
Mounts: []*cdi.Mount{
{
HostPath: "/some/host/path3",
ContainerPath: "/dest/path/a",
},
},
},
result: &oci.Spec{
Mounts: []oci.Mount{
{
Source: "/some/host/path1",
Destination: "/dest/path/c",
},
{
Source: "/some/host/path2",
Destination: "/dest/path/b",
},
{
Source: "/some/host/path3",
Destination: "/dest/path/a",
},
},
},
},
} {
t.Run(tc.name, func(t *testing.T) {
edits := ContainerEdits{tc.edits}
Expand Down

0 comments on commit 6b16d3c

Please sign in to comment.