Skip to content

Commit

Permalink
fixed TestPorter_FixPermissions TestPorter_FixPermissions_NoConfigFil…
Browse files Browse the repository at this point in the history
…e TestResolveBundleReference TestInstall_stringParam

Signed-off-by: Ludvig Liljenberg <ludfjig@hotmail.com>
  • Loading branch information
ludfjig committed Sep 18, 2023
1 parent c398027 commit 876fcc7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/porter/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"math/rand"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -125,13 +126,16 @@ func (p *TestPorter) SetupIntegrationTest() context.Context {

// Load test credentials, with KUBECONFIG replaced properly
kubeconfig := filepath.Join(p.RepoRoot, "kind.config")
if runtime.GOOS == "windows" {
kubeconfig = strings.Replace(kubeconfig, `\`, `\\`, -1)
}
ciCredsPath := filepath.Join(p.RepoRoot, "build/testdata/credentials/ci.json")
ciCredsB, err := p.FileSystem.ReadFile(ciCredsPath)
require.NoError(t, err, "could not read test credentials %s", ciCredsPath)
// update the kubeconfig reference in the credentials to match what's on people's dev machine
ciCredsB = []byte(strings.Replace(string(ciCredsB), "KUBECONFIGPATH", kubeconfig, -1))
var testCreds storage.CredentialSet
err = encoding.UnmarshalYaml(ciCredsB, &testCreds)
err = encoding.UnmarshalJson(ciCredsB, &testCreds)
require.NoError(t, err, "could not unmarshal test credentials %s", ciCredsPath)
err = p.Credentials.UpsertCredentialSet(context.Background(), testCreds)
require.NoError(t, err, "could not save test credentials (ci)")
Expand Down
11 changes: 11 additions & 0 deletions pkg/porter/porter_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package porter
import (
"os"
"path/filepath"
"runtime"
"testing"

"get.porter.sh/porter/pkg"
Expand All @@ -13,6 +14,11 @@ import (
)

func TestPorter_FixPermissions(t *testing.T) {
if runtime.GOOS == "windows" {
// Fixing permission bits on windows makes no sense
t.SkipNow()
}

p := NewTestPorter(t)
ctx := p.SetupIntegrationTest()
defer p.Close()
Expand Down Expand Up @@ -40,6 +46,11 @@ func TestPorter_FixPermissions(t *testing.T) {
}

func TestPorter_FixPermissions_NoConfigFile(t *testing.T) {
if runtime.GOOS == "windows" {
// Fixing permission bits on windows makes no sense
t.SkipNow()
}

p := NewTestPorter(t)
ctx := p.SetupIntegrationTest()
defer p.Close()
Expand Down

0 comments on commit 876fcc7

Please sign in to comment.