Fix passing wrong file info & Add test coverage

This commit is contained in:
Chanh Hua 2020-09-25 13:08:22 +07:00 committed by Kristin Laemmert
parent 6ecee4e1d6
commit 6d4e02ee42
2 changed files with 7 additions and 1 deletions

View File

@ -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{}{}

View File

@ -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,
)
}
}