Skip to content

Commit

Permalink
test(slicer): reshuffle, rename and update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornplusplus committed Nov 29, 2024
1 parent 149dda9 commit 011d442
Showing 1 changed file with 28 additions and 29 deletions.
57 changes: 28 additions & 29 deletions internal/slicer/slicer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,6 @@ var slicerTests = []slicerTest{{
/hardlink:
slice2:
contents:
/dir/file:
/hardlink:
`,
},
Expand All @@ -1512,11 +1511,11 @@ var slicerTests = []slicerTest{{
"/hardlink": "file 0644 28121945",
},
manifestPaths: map[string]string{
"/dir/file": "file 0644 28121945 <1> {test-package_slice1,test-package_slice2}",
"/dir/file": "file 0644 28121945 <1> {test-package_slice1}",
"/hardlink": "file 0644 28121945 <1> {test-package_slice1,test-package_slice2}",
},
}, {
summary: "Empty hard link is inflated with its counterpart",
summary: "Standalone hard links are inflated with their counterparts",
slices: []setup.SliceKey{
{"test-package", "myslice"}},
pkgs: []*testutil.TestPackage{{
Expand Down Expand Up @@ -1548,16 +1547,18 @@ var slicerTests = []slicerTest{{
"/hardlink2": "file 0644 28121945 <1> {test-package_myslice}",
},
}, {
summary: "Single hard link has 0 hardlink identifier",
summary: "Hard link identifier distinguishes different hard links",
slices: []setup.SliceKey{
{"test-package", "myslice"}},
pkgs: []*testutil.TestPackage{{
Name: "test-package",
Data: testutil.MustMakeDeb([]testutil.TarEntry{
testutil.Dir(0755, "./"),
testutil.Dir(0755, "./dir/"),
testutil.Reg(0644, "./dir/file", "text for file"),
testutil.Hln(0644, "./hardlink", "./dir/file"),
testutil.Reg(0644, "./dir/file1", "text for file1"),
testutil.Reg(0644, "./dir/file2", "text for file2"),
testutil.Hln(0644, "./hardlink1", "./dir/file1"),
testutil.Hln(0644, "./hardlink2", "./dir/file2"),
}),
}},
release: map[string]string{
Expand All @@ -1566,28 +1567,36 @@ var slicerTests = []slicerTest{{
slices:
myslice:
contents:
/hardlink:
/dir/file1:
/dir/file2:
/hardlink1:
/hardlink2:
`,
},
filesystem: map[string]string{
"/hardlink": "file 0644 28121945",
"/dir/": "dir 0755",
"/dir/file1": "file 0644 df82bbbd",
"/dir/file2": "file 0644 dcddda2e",
"/hardlink1": "file 0644 df82bbbd",
"/hardlink2": "file 0644 dcddda2e",
},
manifestPaths: map[string]string{
"/hardlink": "file 0644 28121945 {test-package_myslice}",
"/dir/file1": "file 0644 df82bbbd <1> {test-package_myslice}",
"/dir/file2": "file 0644 dcddda2e <2> {test-package_myslice}",
"/hardlink1": "file 0644 df82bbbd <1> {test-package_myslice}",
"/hardlink2": "file 0644 dcddda2e <2> {test-package_myslice}",
},
}, {
summary: "Hard link identifier distinguishes different hard links",
summary: "Single hard link has no hardlink identifier",
slices: []setup.SliceKey{
{"test-package", "myslice"}},
pkgs: []*testutil.TestPackage{{
Name: "test-package",
Data: testutil.MustMakeDeb([]testutil.TarEntry{
testutil.Dir(0755, "./"),
testutil.Dir(0755, "./dir/"),
testutil.Reg(0644, "./dir/file1", "text for file1"),
testutil.Reg(0644, "./dir/file2", "text for file2"),
testutil.Hln(0644, "./hardlink1", "./dir/file1"),
testutil.Hln(0644, "./hardlink2", "./dir/file2"),
testutil.Reg(0644, "./dir/file", "text for file"),
testutil.Hln(0644, "./hardlink", "./dir/file"),
}),
}},
release: map[string]string{
Expand All @@ -1596,24 +1605,14 @@ var slicerTests = []slicerTest{{
slices:
myslice:
contents:
/dir/file1:
/dir/file2:
/hardlink1:
/hardlink2:
/hardlink:
`,
},
filesystem: map[string]string{
"/dir/": "dir 0755",
"/dir/file1": "file 0644 df82bbbd",
"/dir/file2": "file 0644 dcddda2e",
"/hardlink1": "file 0644 df82bbbd",
"/hardlink2": "file 0644 dcddda2e",
"/hardlink": "file 0644 28121945",
},
manifestPaths: map[string]string{
"/dir/file1": "file 0644 df82bbbd <1> {test-package_myslice}",
"/dir/file2": "file 0644 dcddda2e <2> {test-package_myslice}",
"/hardlink1": "file 0644 df82bbbd <1> {test-package_myslice}",
"/hardlink2": "file 0644 dcddda2e <2> {test-package_myslice}",
"/hardlink": "file 0644 28121945 {test-package_myslice}",
},
}, {
summary: "Hard links handled with wildcard",
Expand Down Expand Up @@ -1653,7 +1652,7 @@ var slicerTests = []slicerTest{{
"/hardlink2.txt": "file 0644 dcddda2e <2> {test-package_myslice}",
},
}, {
summary: "Symlink is a valid hard link base file",
summary: "Symlink is a valid hard link target file",
slices: []setup.SliceKey{
{"test-package", "myslice"}},
pkgs: []*testutil.TestPackage{{
Expand Down Expand Up @@ -1685,7 +1684,7 @@ var slicerTests = []slicerTest{{
"/hardlink": "symlink ./dir/file <1> {test-package_myslice}",
},
}, {
summary: "Hard link IDs are unique to multiple packages",
summary: "Hard link IDs are unique across packages",
slices: []setup.SliceKey{
{"test-package1", "myslice"},
{"test-package2", "myslice"},
Expand Down

0 comments on commit 011d442

Please sign in to comment.