diff options
Diffstat (limited to 'bin/update-test-fixtures')
| -rwxr-xr-x | bin/update-test-fixtures | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/bin/update-test-fixtures b/bin/update-test-fixtures new file mode 100755 index 0000000..380192f --- /dev/null +++ b/bin/update-test-fixtures @@ -0,0 +1,41 @@ +#!/bin/bash + +cd "$(dirname "$0")/.." + +root_dir=$(pwd) +tmp_dir=$root_dir/tmp +branch='update-test-fixtures' +mkdir -p "$tmp_dir" + +projects=$(ls test/results/ | sed -e 's/-v.*\.json//p' | sort | uniq) +echo $projects +for project in ${projects[@]}; do + echo "$project" + cd "$tmp_dir" + rm -fr "$project" + git clone "git@gitlab.com:gitlab-org/security-products/tests/$project.git" + cd "$project" + DIFF=$(diff "$root_dir/test/results/$project-v2.json" qa/expect/gl-license-management-report.json) + + if [[ $DIFF = "" ]]; then + continue + fi + + git co -b $branch + cp "$root_dir/test/results/$project-v2.json" qa/expect/gl-license-management-report.json + git diff + printf "Commit? (y/n)" + read -r answer + case $answer in + [Yy]* ) + git commit -am 'Update test fixture' + printf "Push? (y/n)" + read -r answer + case $answer in + [Yy]* ) git push -f origin $branch;; + [Nn]* ) echo 'Skipping commit';; + esac + ;; + [Nn]* ) echo 'Skipping commit';; + esac +done |
