Fix passing wrong file info & Add test coverage (#26400)

Co-authored-by: Chanh Hua <chanh.hua@magnolia-cms.com>
pull/26567/head
Kristin Laemmert 6 years ago committed by GitHub
parent c56e211168
commit eebeaace4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -125,6 +125,9 @@ func TestPackage_manyProviders(t *testing.T) {
for _, file := range read.File {
if _, exists := expectedFiles[file.Name]; exists {
if !file.FileInfo().Mode().IsRegular() {
t.Errorf("Expected file is not a regular file: %s", file.Name)
}
delete(expectedFiles, file.Name)
} else {
extraFiles[file.Name] = struct{}{}
@ -195,6 +198,9 @@ func TestPackage_localProviders(t *testing.T) {
for _, file := range read.File {
if _, exists := expectedFiles[file.Name]; exists {
if !file.FileInfo().Mode().IsRegular() {
t.Errorf("Expected file is not a regular file: %s", file.Name)
}
delete(expectedFiles, file.Name)
} else {
extraFiles[file.Name] = struct{}{}

@ -226,7 +226,7 @@ func (c *PackageCommand) Run(args []string) int {
return addZipFile(
filepath.Join(linkPath, file.Name()), // the link to this provider binary
filepath.Join(relPath, file.Name()), // the expected directory for the binary
info, outZ,
file, outZ,
)
}
}

Loading…
Cancel
Save