From 558ff33dfd0b028d7f8ae8fdea7495af5d74a660 Mon Sep 17 00:00:00 2001 From: krrrr38 Date: Sun, 18 Dec 2022 14:32:29 +0900 Subject: [PATCH] refactor: e2e test ensure conftest command to check conftest version is greater or equal to specific version --- .circleci/config.yml | 2 +- .github/workflows/test.yml | 2 +- Makefile | 4 ++-- server/controllers/events/events_controller_e2e_test.go | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ad1d18fa4..5390e9b6c2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: test: docker: - - image: ghcr.io/runatlantis/testing-env:2022.11.17 + - image: ghcr.io/runatlantis/testing-env:2022.12.17 steps: - checkout - run: make check-fmt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bebdedd363..12d1e75a8b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,7 @@ jobs: if: github.event.pull_request.draft == false name: runner / gotest runs-on: ubuntu-22.04 - container: ghcr.io/runatlantis/testing-env:2022.11.17 + container: ghcr.io/runatlantis/testing-env:2022.12.17 steps: - uses: actions/checkout@v3.0.2 - run: make test-all diff --git a/Makefile b/Makefile index 38497806ca..fcb4c8bd11 100644 --- a/Makefile +++ b/Makefile @@ -36,14 +36,14 @@ test: ## Run tests .PHONY: docker/test docker/test: ## Run tests in docker - docker run -it -v $(pwd):/atlantis ghcr.io/runatlantis/testing-env:2022.11.17 sh -c "cd /atlantis && make test" + docker run -it -v $(pwd):/atlantis ghcr.io/runatlantis/testing-env:2022.12.17 sh -c "cd /atlantis && make test" test-all: ## Run tests including integration @go test $(PKG) .PHONY: docker/test-all docker/test-all: ## Run all tests in docker - docker run -it -v $(pwd):/atlantis ghcr.io/runatlantis/testing-env:2022.11.17 sh -c "cd /atlantis && make test-all" + docker run -it -v $(pwd):/atlantis ghcr.io/runatlantis/testing-env:2022.12.17 sh -c "cd /atlantis && make test-all" test-coverage: @mkdir -p .cover diff --git a/server/controllers/events/events_controller_e2e_test.go b/server/controllers/events/events_controller_e2e_test.go index 126e82e9e4..89627002a6 100644 --- a/server/controllers/events/events_controller_e2e_test.go +++ b/server/controllers/events/events_controller_e2e_test.go @@ -636,7 +636,7 @@ func TestGitHubWorkflowWithPolicyCheck(t *testing.T) { } // Ensure we have >= TF 0.14 locally. ensureRunning014(t) - // Ensure we have >= Conftest 0.21 locally. + // Ensure we have conftest locally. ensureRunningConftest(t) cases := []struct { @@ -1363,11 +1363,11 @@ func mkSubDirs(t *testing.T) (string, string, string) { return tmp, binDir, cachedir } -// Will fail test if conftest isn't in path and isn't version >= 0.25.0 +// Will fail test if conftest isn't in path or is version less than specific version func ensureRunningConftest(t *testing.T) { - localPath, err := exec.LookPath(fmt.Sprintf("conftest%s", ConftestVersion)) + localPath, err := exec.LookPath("conftest") if err != nil { - t.Logf("conftest >= %s must be installed to run this test", ConftestVersion) + t.Logf("conftest must be installed to run this test") t.FailNow() } versionOutBytes, err := exec.Command(localPath, "--version").Output() // #nosec