diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9f306b4..d179c75 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ on: - pull_request env: - GOSSVERSION: v0.3.21 + GOSSVERSION: v0.4.4 jobs: test: diff --git a/feature/krew/goss/.env b/feature/krew/goss.bash/.env similarity index 100% rename from feature/krew/goss/.env rename to feature/krew/goss.bash/.env diff --git a/feature/krew/goss.bash/.ignore-integration b/feature/krew/goss.bash/.ignore-integration new file mode 100644 index 0000000..e69de29 diff --git a/feature/krew/goss.bash/goss.yaml b/feature/krew/goss.bash/goss.yaml new file mode 100644 index 0000000..3ca2a71 --- /dev/null +++ b/feature/krew/goss.bash/goss.yaml @@ -0,0 +1,17 @@ +command: + krew: + exec: "/home/cloudcontrol/.krew/bin/kubectl-krew version" + exit-status: 0 + stdout: + - "/home/cloudcontrol/.krew" + krew-plugins: + exec: "/home/cloudcontrol/.krew/bin/kubectl-krew list" + exit-status: 0 + stdout: + - "example" + path-includes-home: + exec: "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin && . /usr/local/bin/cloudcontrol run && . /home/cloudcontrol/.bashrc && echo $PATH" + exit-status: 0 + stdout: + - "/home/cloudcontrol/bin" + - "/home/cloudcontrol/.krew/bin" diff --git a/feature/krew/goss.fish/.env b/feature/krew/goss.fish/.env new file mode 100644 index 0000000..df1a2ff --- /dev/null +++ b/feature/krew/goss.fish/.env @@ -0,0 +1,2 @@ +KREW_PLUGINS=example +USE_fish=yes \ No newline at end of file diff --git a/feature/krew/goss/goss.yaml b/feature/krew/goss.fish/goss.yaml similarity index 52% rename from feature/krew/goss/goss.yaml rename to feature/krew/goss.fish/goss.yaml index 946ce59..cfb004b 100644 --- a/feature/krew/goss/goss.yaml +++ b/feature/krew/goss.fish/goss.yaml @@ -9,3 +9,9 @@ command: exit-status: 0 stdout: - "example" + path-includes-home: + exec: "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/cloudcontrol/bin && fish -c 'echo $PATH'" + exit-status: 0 + stdout: + - "/home/cloudcontrol/bin" + - "/home/cloudcontrol/.krew/bin" diff --git a/feature/krew/install.sh b/feature/krew/install.sh index ba2dd69..c1af8b1 100644 --- a/feature/krew/install.sh +++ b/feature/krew/install.sh @@ -37,11 +37,11 @@ fi if [[ $(cat /home/cloudcontrol/.shell) == "fish" ]] then cat <> ~/.config/fish/conf.d/krew.fish - set -gx PATH $PATH $HOME/.krew/bin + set -gx PATH \$PATH \$HOME/.krew/bin EOF else cat <> /home/cloudcontrol/.bashrc - export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" + export PATH="\${KREW_ROOT:-\$HOME/.krew}/bin:\$PATH" EOF fi diff --git a/internal/tests/lib/testRunner.go b/internal/tests/lib/testRunner.go index 739e2f6..274a375 100644 --- a/internal/tests/lib/testRunner.go +++ b/internal/tests/lib/testRunner.go @@ -82,8 +82,12 @@ func TestFeature(feature Feature, testBed TestBed, containerAdapter container.Ad return fmt.Errorf("error chmodding temporary directory to 0777: %w", err) } defer func() { - if err := os.RemoveAll(testDir); err != nil { - panic(fmt.Errorf("can not remove temporary directory: %w", err)) + if cleanup || !hasProblems { + if err := os.RemoveAll(testDir); err != nil { + panic(fmt.Errorf("can not remove temporary directory: %w", err)) + } + } else { + logrus.Infof("Not removing temporary directory %s because cleanup wasn't enabled.", testDir) } }() logrus.Debugf("Preparing test suite in %s", testDir) @@ -237,12 +241,16 @@ func TestFeature(feature Feature, testBed TestBed, containerAdapter container.Ad containerId, []string{ "/goss/goss", - "-g", + "--gossfile", "/goss/goss.yaml", + "--loglevel", + "DEBUG", "validate", - "--color", "--format", "documentation", + "--format-options", + "verbose", + "--no-color", }, ); err != nil { if mightFail { @@ -480,12 +488,16 @@ func IntegrationTests(features []Feature, testBed TestBed, containerAdapter cont containerId, []string{ "/goss/goss", - "-g", + "--gossfile", "/goss/goss.yaml", + "--loglevel", + "DEBUG", "validate", - "--color", "--format", "documentation", + "--format-options", + "verbose", + "--no-color", }, ); err != nil { var runCommandError *container.RunCommandError