Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(backport to v0.13) terraform-bundle: Fix passing wrong file info & Add test coverage #26400

Merged
merged 1 commit into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tools/terraform-bundle/e2etest/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}{}
Expand Down Expand Up @@ -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{}{}
Expand Down
2 changes: 1 addition & 1 deletion tools/terraform-bundle/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}
}
Expand Down