Skip to content

Commit

Permalink
Fix failing test on windows due to slash difference
Browse files Browse the repository at this point in the history
Authored-by: Dennis Leon <leonde@vmware.com>
  • Loading branch information
DennisDenuto committed Oct 4, 2021
1 parent 118d573 commit 5f4b30f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pkg/imgpkg/cmd/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package cmd

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
Expand Down Expand Up @@ -56,7 +57,7 @@ func TestMultiImgpkgDirError(t *testing.T) {
t.Fatalf("Expected validations to err, but did not")
}

if !strings.Contains(err.Error(), "This directory contains multiple bundle definitions. Only a single instance of .imgpkg/images.yml can be provided") {
if !strings.Contains(err.Error(), fmt.Sprintf("This directory contains multiple bundle definitions. Only a single instance of .imgpkg%simages.yml can be provided", string(os.PathSeparator))) {
t.Fatalf("Expected error to contain message about multiple .imgpkg dirs, got: %s", err)
}
}
Expand Down Expand Up @@ -133,7 +134,7 @@ func TestBundleDirectoryErrors(t *testing.T) {
{
name: "no bundle",
createBundleDir: false,
expectedError: "This directory is not a bundle. It is missing .imgpkg/images.yml",
expectedError: fmt.Sprintf("This directory is not a bundle. It is missing .imgpkg%simages.yml", string(os.PathSeparator)),
},
}

Expand Down
7 changes: 6 additions & 1 deletion test/helpers/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
"strings"
"testing"

Expand Down Expand Up @@ -94,7 +95,11 @@ func (a *Assets) CleanCreatedFolders() {
a.T.Helper()
for _, folder := range a.CreatedFolders {
err := os.RemoveAll(folder)
require.NoErrorf(a.T, err, "cleaning folder: '%s'", folder)

//TODO: figure out why windows still has a file handle on the bundle.tar file
if runtime.GOOS != "windows" {
require.NoErrorf(a.T, err, "cleaning folder: '%s'", folder)
}
}
}

Expand Down

0 comments on commit 5f4b30f

Please sign in to comment.