File tree Expand file tree Collapse file tree 2 files changed +24
-6
lines changed
Expand file tree Collapse file tree 2 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -7,12 +7,23 @@ SED = gsed
77BATS_LIB_PATH = /opt/homebrew/lib
88endif
99
10+ BATS_ENV := BATS_LIB_PATH=$(BATS_LIB_PATH ) \
11+ GITHUB_REPOSITORY_OWNER=aquasecurity \
12+ TRIVY_CACHE_DIR=.cache \
13+ TRIVY_DISABLE_VEX_NOTICE=true \
14+ TRIVY_DEBUG=true
15+
16+ BATS_FLAGS := --recursive --timing --verbose-run .
17+
1018.PHONY : test
1119test :
1220 mkdir -p .cache
13- BATS_LIB_PATH=$(BATS_LIB_PATH ) GITHUB_REPOSITORY_OWNER=aquasecurity\
14- TRIVY_CACHE_DIR=.cache TRIVY_DISABLE_VEX_NOTICE=true TRIVY_DEBUG=true\
15- bats --recursive --timing --verbose-run .
21+ $(BATS_ENV ) bats $(BATS_FLAGS )
22+
23+ .PHONY : update-golden
24+ update-golden :
25+ mkdir -p .cache
26+ UPDATE_GOLDEN=1 $(BATS_ENV ) bats $(BATS_FLAGS )
1627
1728bump-trivy :
1829 @[ $$ NEW_VERSION ] || ( echo " env 'NEW_VERSION' is not set" ; exit 1 )
Original file line number Diff line number Diff line change @@ -57,9 +57,16 @@ function compare_files() {
5757 remove_github_fields " $file1 "
5858 remove_github_fields " $file2 "
5959
60- run diff " $file1 " " $file2 "
61- echo " $output "
62- assert_files_equal " $file1 " " $file2 "
60+ if [ " ${UPDATE_GOLDEN} " = " 1" ]; then
61+ cp " $file1 " " $file2 "
62+ echo " Updated golden file: $file2 "
63+ else
64+ run diff " $file1 " " $file2 "
65+ echo " $output "
66+ assert_files_equal " $file1 " " $file2 "
67+ fi
68+
69+ rm -f " $file1 "
6370}
6471
6572@test " trivy repo with securityCheck secret only" {
You can’t perform that action at this time.
0 commit comments