Skip to content

Commit

Permalink
fixed all except 1 test
Browse files Browse the repository at this point in the history
Signed-off-by: Ludvig Liljenberg <[email protected]>
  • Loading branch information
ludfjig committed Sep 18, 2023
1 parent 876fcc7 commit 09bea31
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/porter/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ func (ex *exporter) addImage(base bundle.BaseImage) error {
// If the name contains a path separator, all path separators will be replaced with "-".
func (ex *exporter) createArchiveFolder(name string) (string, error) {
cleanedPath := strings.ReplaceAll(afero.UnicodeSanitize(name), string(os.PathSeparator), "-")
cleanedPath = strings.ReplaceAll(cleanedPath, "/", "-") // this is needed because on windows, if the bundle name is from a reference
// e.g. "ghcr.io/getporter/examples/porter-hello:v0.2.0", the name will be "examples/porter-hello",
// so we still need to replace the / with -, which the above line doesn't do (on windows)
archiveDir, err := ex.fs.TempDir("", cleanedPath)
if err != nil {
return "", fmt.Errorf("can not create a temporary archive folder: %w", err)
Expand Down
6 changes: 5 additions & 1 deletion tests/integration/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"crypto/sha256"
"fmt"
"io"
"runtime"
"testing"

"get.porter.sh/porter/pkg"
Expand Down Expand Up @@ -38,7 +39,10 @@ func TestArchive_StableDigest(t *testing.T) {

info, err := p.FileSystem.Stat(archiveFile1)
require.NoError(p.T(), err)
tests.AssertFilePermissionsEqual(t, archiveFile1, pkg.FileModeWritable, info.Mode())
if runtime.GOOS != "windows" {
// permission bits make no sense on windows
tests.AssertFilePermissionsEqual(t, archiveFile1, pkg.FileModeWritable, info.Mode())
}

hash1 := getHash(p, archiveFile1)

Expand Down

0 comments on commit 09bea31

Please sign in to comment.