diff options
| author | mo khan <mo.khan@gmail.com> | 2019-11-18 10:56:33 -0700 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2019-11-18 17:40:41 -0700 |
| commit | 22745169b3287d8831a2119cf0ddbc27fb3f2bc7 (patch) | |
| tree | 2caf76b17524abf8c92932a518472de4706488d9 /bin/update-test-fixtures | |
| parent | a9d6626a63a83f2b4f20d97733dccfe7bdc83306 (diff) | |
Add script to update test fixturesupdate-qa-reports
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 |
