Skip to content

Commit

Permalink
more feedback and fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Ludvig Liljenberg <[email protected]>
  • Loading branch information
ludfjig committed Aug 7, 2023
1 parent 0fdd838 commit 9d3a9fa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
4 changes: 0 additions & 4 deletions pkg/exec/builder/execute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@ func TestExecuteStep_HasOrderedArguments(t *testing.T) {
}

func TestExecuteStep_SpecifiesCustomWorkingDirectory(t *testing.T) {
//if runtime.GOOS == "windows" {
// t.Skip() // pwd not available on windows (for some reason the only command that works is "help" ?!?)
//}

ctx := context.Background()
c := porterruntime.NewTestRuntimeConfig(t)
c.TestContext.UseFilesystem()
Expand Down
9 changes: 3 additions & 6 deletions pkg/porter/cnab_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,9 @@ func TestSharedOptions_validateBundleJson(t *testing.T) {
}

func Test_bundleFileOptions(t *testing.T) {
absWantFile, err := filepath.Abs(filepath.FromSlash("/" + config.Name))
require.NoError(t, err)
absWantCNABFile, err := filepath.Abs(filepath.FromSlash("/" + build.LOCAL_BUNDLE))
require.NoError(t, err)
absPathToBundle, err := filepath.Abs(filepath.FromSlash("/path/to/bundle"))
require.NoError(t, err)
absWantFile := absOSFilepath(t, "/"+config.Name)
absWantCNABFile := absOSFilepath(t, "/"+build.LOCAL_BUNDLE)
absPathToBundle := absOSFilepath(t, "/path/to/bundle")

testcases := []struct {
name string
Expand Down
16 changes: 10 additions & 6 deletions pkg/porter/credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,17 +296,19 @@ func TestShowCredential_PreserveCase(t *testing.T) {
}

func TestCredentialsEdit(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip() // bash and vi not available on windows
}

p := NewTestPorter(t)
defer p.Close()

p.Setenv("SHELL", "bash")
p.Setenv("EDITOR", "vi")
p.Setenv(test.ExpectedCommandEnv, "bash -c vi "+filepath.Join(os.TempDir(), "porter-kool-kreds.yaml"))

if runtime.GOOS == "windows" {
p.Setenv("SHELL", "cmd")
p.Setenv("EDITOR", "notepad")
p.Setenv(test.ExpectedCommandEnv, "cmd /C notepad "+filepath.Join(os.TempDir(), "porter-kool-kreds.yaml"))
}

opts := CredentialEditOptions{Namespace: "dev", Name: "kool-kreds"}

p.TestCredentials.AddTestCredentialsDirectory("testdata/test-creds")
Expand All @@ -320,8 +322,10 @@ func TestCredentialsEditEditorPathWithArgument(t *testing.T) {

p.Setenv("SHELL", "something")
p.Setenv("EDITOR", "C:\\Program Files\\Visual Studio Code\\code.exe --wait")
p.Setenv(test.ExpectedCommandEnv, "something -c C:\\Program Files\\Visual Studio Code\\code.exe --wait "+filepath.Join(os.TempDir(), "porter-kool-kreds.yaml")+
"\nsomething /C C:\\Program Files\\Visual Studio Code\\code.exe --wait "+filepath.Join(os.TempDir(), "porter-kool-kreds.yaml"))
p.Setenv(test.ExpectedCommandEnv, fmt.Sprintf("something -c C:\\Program Files\\Visual Studio Code\\code.exe --wait %s", filepath.Join(os.TempDir(), "porter-kool-kreds.yaml")))
if runtime.GOOS == "windows" {
p.Setenv(test.ExpectedCommandEnv, fmt.Sprintf("something /C C:\\Program Files\\Visual Studio Code\\code.exe --wait %s", filepath.Join(os.TempDir(), "porter-kool-kreds.yaml")))
}
opts := CredentialEditOptions{Namespace: "dev", Name: "kool-kreds"}

p.TestCredentials.AddTestCredentialsDirectory("testdata/test-creds")
Expand Down

0 comments on commit 9d3a9fa

Please sign in to comment.