Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Patryk Małek <[email protected]>
  • Loading branch information
czeslavo and pmalek committed Dec 19, 2023
1 parent 8e210ce commit dd28ce6
Show file tree
Hide file tree
Showing 18 changed files with 270 additions and 266 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
- name: setup helm
uses: azure/setup-helm@v3
with:
version: v3.11.0
version: v3.13.3

- name: setup testing environment (kind-cluster)
env:
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
- name: setup helm
uses: azure/setup-helm@v3
with:
version: v3.11.0
version: v3.13.3

- name: setup testing environment (kind-cluster)
run: ./scripts/test-env.sh
Expand All @@ -170,7 +170,7 @@ jobs:
- name: setup helm
uses: azure/setup-helm@v3
with:
version: v3.11.0
version: v3.13.3

- name: setup golang
uses: actions/setup-go@v4
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ lint.charts.kong:
lint.shellcheck:
shellcheck ./scripts/*

KONG_CHART_GO_TEST_MODULE=charts/kong/tests
TEST_GOLDEN_TESTCASE_NAME=TestGolden
KONG_CHART_GO_TEST_MODULE ?= charts/kong/tests
TEST_GOLDEN_TESTCASE_NAME ?= TestGolden
.PHONY: test
test:
cd $(KONG_CHART_GO_TEST_MODULE) && \
go test ./...
go test -count=1 ./...

.PHONY: test.golden.update
test.golden.update:
cd $(KONG_CHART_GO_TEST_MODULE) && \
rm testdata/golden/* && \
rm testdata/golden/* || true && \
go test -run $(TEST_GOLDEN_TESTCASE_NAME) -update-golden
6 changes: 5 additions & 1 deletion charts/kong/tests/golden_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ var update = flag.Bool("update-golden", false, "update golden test output files"
// When a difference in the output is expected, you can regenerate golden files by passing `-update-golden` flag while
// invoking this test (or using `make test.golden.update`).
func TestGolden(t *testing.T) {
// Add the bitnami repo so that the dependencies can be resolved.
helm.AddRepo(t, &helm.Options{}, "bitnami", "https://charts.bitnami.com/bitnami")

// Build the dependencies using Chart.lock. It has to be done because we do not keep /charts directory
// containing the dependencies in the repository.
_, err := helm.RunHelmCommandAndGetOutputE(t, &helm.Options{}, "dependencies", "build", "../", "--skip-refresh")
require.NoError(t, err)

Expand All @@ -39,7 +43,7 @@ func TestGolden(t *testing.T) {
}

expected, err := os.ReadFile(goldenFile)
require.NoError(t, err, "could not read the golden file")
require.NoErrorf(t, err, "could not read the golden file: %s", goldenFile)
require.Equal(t, string(expected), string(rendered),
"golden differs from the rendered manifest, if that's expected, run `make test.golden.update`")
})
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 17 additions & 17 deletions charts/kong/tests/testdata/golden/custom-labels-values_golden.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dd28ce6

Please sign in to comment.