Skip to content

Commit

Permalink
Add test-unit-update-golden target to update golden files ๐ŸŸ
Browse files Browse the repository at this point in the history
Errors should be ignored when running this ๐Ÿ‘ผ

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
  • Loading branch information
vdemeester authored and tekton-robot committed Jan 19, 2020
1 parent f326912 commit 9dab488
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ test-unit: ./vendor ## run unit tests
@echo "Running unit tests..."
@go test -failfast -v -cover ./...

.PHONY: test-unit-update-golden
test-unit-update-golden: ./vendor ## run unit tests (updating golden files)
@echo "Running unit tests updating golden files..."
@./hack/update-golden.sh

.PHONY: test-e2e
test-e2e: bin/tkn ## run e2e tests
@echo "Running e2e tests..."
Expand Down
5 changes: 5 additions & 0 deletions hack/update-golden.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# This will run `go test a/package -test.update-golden=true` on all packages that are importing `gotest.tools/v3/golden`
# This will update the golden files with the current output.
# Run this only when you are sure the output is meant to change.
go test $(go list -f '{{ .ImportPath }} {{ .TestImports }}' ./... | grep gotest.tools/v3/golden | awk '{print $1}' | tr '\n' ' ') -test.update-golden=true

0 comments on commit 9dab488

Please sign in to comment.