nix:postgrest-loadtest-against multiple branches

Improve postgrest-loadtest-against script to accept multiple refs
to perform loadtests against *all* of them
This commit is contained in:
Andrei Dziahel
2023-09-21 14:08:53 -03:00
committed by Steve Chavez
parent 1b4dae5a7a
commit fca039a54d
+11 -8
View File
@@ -76,13 +76,12 @@ let
inherit name; inherit name;
docs = docs =
'' ''
Run the vegeta loadtest twice: Run the vegeta loadtest against every target branch and HEAD:
- once on the <target> branch - once on the every <target-#> branch
- once in the current worktree - once in the current worktree
''; '';
args = [ args = [
"ARG_POSITIONAL_SINGLE([target], [Commit-ish reference to compare with])" "ARG_POSITIONAL_INF([target], [Commit-ish reference to compare with], 1)"
"ARG_LEFTOVERS([additional vegeta arguments])"
]; ];
positionalCompletion = positionalCompletion =
'' ''
@@ -93,9 +92,11 @@ let
inRootDir = true; inRootDir = true;
} }
'' ''
for tgt in "''${_arg_target[@]}"; do
cat << EOF cat << EOF
Running loadtest on "$_arg_target"... Running loadtest on "$tgt"...
EOF EOF
@@ -104,21 +105,23 @@ let
# Save the results in the current working tree, too, # Save the results in the current working tree, too,
# otherwise they'd be lost in the temporary working tree # otherwise they'd be lost in the temporary working tree
# created by withTools.withGit. # created by withTools.withGit.
${withTools.withGit} "$_arg_target" ${loadtest} --output "$PWD/loadtest/$_arg_target.bin" --testdir "$PWD/test/load" "''${_arg_leftovers[@]}" ${withTools.withGit} "$tgt" ${loadtest} --output "$PWD/loadtest/$tgt.bin" --testdir "$PWD/test/load"
cat << EOF cat << EOF
Done running on "$_arg_target". Done running on "$tgt".
EOF EOF
done
cat << EOF cat << EOF
Running loadtest on HEAD... Running loadtest on HEAD...
EOF EOF
${loadtest} --output "$PWD/loadtest/head.bin" --testdir "$PWD/test/load" "''${_arg_leftovers[@]}" ${loadtest} --output "$PWD/loadtest/head.bin" --testdir "$PWD/test/load"
cat << EOF cat << EOF