Delete unused blueprint.ValidateDirFileCustomizations() function

This function is no longer used by any code. Instead, its copy in the
`osbuild/images` repository is used by distro definitions to validate
the customization.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2023-10-19 13:43:00 +02:00 committed by Simon de Vlieger
parent d57f2e5bb5
commit d4e3173234
2 changed files with 0 additions and 261 deletions

View file

@ -975,160 +975,3 @@ func TestFileCustomizationUnmarshalJSON(t *testing.T) {
})
}
}
func TestValidateDirFileCustomizations(t *testing.T) {
testCases := []struct {
Name string
Files []FileCustomization
Dirs []DirectoryCustomization
Error bool
}{
{
Name: "empty-customizations",
},
{
Name: "valid-file-customizations-only",
Files: []FileCustomization{
{
Path: "/etc/file1",
},
{
Path: "/etc/file2",
},
},
},
{
Name: "valid-dir-customizations-only",
Dirs: []DirectoryCustomization{
{
Path: "/etc/dir1",
},
{
Path: "/etc/dir2",
},
},
},
{
Name: "valid-file-and-dir-customizations",
Files: []FileCustomization{
{
Path: "/etc/named/path1/path2/file",
},
{
Path: "/etc/named/path1/file",
},
{
Path: "/etc/named/path1/path2/file2",
},
{
Path: "/etc/named/path1/file2",
},
{
Path: "/etc/named/file",
},
},
Dirs: []DirectoryCustomization{
{
Path: "/etc/named/path1/path2",
},
{
Path: "/etc/named/path1",
},
},
},
// Errors
{
Name: "file-parent-of-file",
Files: []FileCustomization{
{
Path: "/etc/file1/file2",
},
{
Path: "/etc/file1",
},
},
Error: true,
},
{
Name: "file-parent-of-dir",
Files: []FileCustomization{
{
Path: "/etc/file2",
},
{
Path: "/etc/dir1",
},
},
Dirs: []DirectoryCustomization{
{
Path: "/etc/dir1/dir2",
},
{
Path: "/etc/dir3",
},
},
Error: true,
},
{
Name: "duplicate-file-paths",
Files: []FileCustomization{
{
Path: "/etc/file1",
},
{
Path: "/etc/file2",
},
{
Path: "/etc/file1",
},
},
Error: true,
},
{
Name: "duplicate-dir-paths",
Dirs: []DirectoryCustomization{
{
Path: "/etc/dir1",
},
{
Path: "/etc/dir2",
},
{
Path: "/etc/dir1",
},
},
Error: true,
},
{
Name: "duplicate-file-and-dir-paths",
Files: []FileCustomization{
{
Path: "/etc/path1",
},
{
Path: "/etc/path2",
},
},
Dirs: []DirectoryCustomization{
{
Path: "/etc/path3",
},
{
Path: "/etc/path2",
},
},
Error: true,
},
}
for _, tc := range testCases {
t.Run(tc.Name, func(t *testing.T) {
err := ValidateDirFileCustomizations(tc.Dirs, tc.Files)
if tc.Error {
assert.Error(t, err)
} else {
assert.NoError(t, err)
}
})
}
}