diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-03-04 17:23:20 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-03-04 17:25:11 +0000 |
commit | 227f94a7d9661675c6e8a5d158e39e3433cbc06a (patch) | |
tree | 8b44acd0aad7075e5baa6115180d7f196b4633c1 | |
parent | c52e58bfaf84662c004c390c9a2fa800e3e5078a (diff) | |
download | gitano-227f94a7d9661675c6e8a5d158e39e3433cbc06a.tar.gz |
quotes all the things
-rw-r--r-- | testing/library.yarn | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/testing/library.yarn b/testing/library.yarn index b829ce6..5547faf 100644 --- a/testing/library.yarn +++ b/testing/library.yarn @@ -25,10 +25,10 @@ General instance management if [ "$GTT_PROTO" = http ]; then printf "%s" admin | GTT_PROTO=ssh $GTT runcommand \ testinstance adminkey as admin passwd \ - >> $DATADIR/stdout 2>> $DATADIR/stderr + >> "$DATADIR/stdout" 2>> "$DATADIR/stderr" printf "%s" gitano-bypass | GTT_PROTO=ssh $GTT runcommand \ testinstance bypasskey as gitano-bypass passwd \ - >> $DATADIR/stdout 2>> $DATADIR/stderr + >> "$DATADIR/stdout" 2>> "$DATADIR/stderr" fi IMPLEMENTS FINALLY the instance is torn down @@ -41,10 +41,10 @@ The `gitano-test-tool` utility helps us manage fake UNIX users and give them SSH keys. Sometimes it's helpful to be able to work with these... IMPLEMENTS GIVEN a unix user called ([a-z][a-z0-9]*) - $GTT createunixuser $MATCH_1 + $GTT createunixuser "$MATCH_1" IMPLEMENTS GIVEN ([a-z][a-z0-9]*) has keys called ([a-z][a-z0-9]*) - $GTT createsshkey $MATCH_1 $MATCH_2 + $GTT createsshkey "$MATCH_1" "$MATCH_2" IMPLEMENTS WHEN ([a-z][a-z0-9]*) uses their ssh public key called ([a-z][a-z0-9]*) as stdin cp "$DATADIR/user-home-$MATCH_1/.ssh/$MATCH_2.pub" "$DATADIR/stdin" @@ -54,17 +54,17 @@ rolls up the creation of a unix user, allocation of an SSH key, and creation of the user inside Gitano. IMPLEMENTS GIVEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9_-]*),? adds a new user ([a-z][a-z0-9_-]*), with a key called ([a-z][a-z0-9_-]*) - $GTT createunixuser $MATCH_3 - $GTT createsshkey $MATCH_3 $MATCH_4 - $GTT runcommand $MATCH_1 $MATCH_2 \ - user add $MATCH_3 $MATCH_3@testinstance "$MATCH_3's real name" > $DATADIR/stdout 2> $DATADIR/stderr - $GTT runcommand $MATCH_1 $MATCH_2 \ - as $MATCH_3 sshkey add default < \ - $($GTT pubkeyfilename $MATCH_3 $MATCH_4) >> $DATADIR/stdout 2>> $DATADIR/stderr + $GTT createunixuser "$MATCH_3" + $GTT createsshkey "$MATCH_3" "$MATCH_4" + $GTT runcommand "$MATCH_1" "$MATCH_2" \ + user add "$MATCH_3" "$MATCH_3"@testinstance "$MATCH_3's real name" > "$DATADIR/stdout" 2> "$DATADIR/stderr" + $GTT runcommand "$MATCH_1" "$MATCH_2" \ + as "$MATCH_3" sshkey add default < \ + "$($GTT pubkeyfilename "$MATCH_3" "$MATCH_4")" >> "$DATADIR/stdout" 2>> "$DATADIR/stderr" if [ "$GTT_PROTO" = http ]; then printf "%s" "$MATCH_3" | GTT_PROTO=ssh $GTT runcommand \ - $MATCH_1 $MATCH_2 as $MATCH_3 passwd \ - >> $DATADIR/stdout 2>> $DATADIR/stderr + "$MATCH_1" "$MATCH_2" as "$MATCH_3" passwd \ + >> "$DATADIR/stdout" 2>> "$DATADIR/stderr" fi @@ -72,19 +72,19 @@ Repository access ----------------- IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? clones ([^ ]+) as ([^ ]+)( with depth (\d+))? - $GTT clone $MATCH_1 $MATCH_2 "$MATCH_3" "$MATCH_4" ${MATCH_5:+ --no-local --depth="$MATCH_6"} \ - >$DATADIR/stdout 2>$DATADIR/stderr + $GTT clone "$MATCH_1" "$MATCH_2" "$MATCH_3" "$MATCH_4" ${MATCH_5:+ --no-local --depth="$MATCH_6"} \ + >"$DATADIR/stdout" 2>"$DATADIR/stderr" IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? (expecting failure,? )?pushes ([^ ]+) to ([^ ]+) - if $GTT push $MATCH_1 $MATCH_2 "$MATCH_4" "$MATCH_5" \ - >$DATADIR/stdout 2>$DATADIR/stderr; then + if $GTT push "$MATCH_1" "$MATCH_2" "$MATCH_4" "$MATCH_5" \ + >"$DATADIR/stdout" 2>"$DATADIR/stderr"; then test "$MATCH_3" = "" fi IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? (expecting failure,? )?destroys ([^ ]+) using the (.+) token - if $GTT runcommand $MATCH_1 $MATCH_2 \ - destroy $MATCH_4 "$(cat "$DATADIR/saved-tokens/$MATCH_5")" \ - >$DATADIR/stdout 2>$DATADIR/stderr; then + if $GTT runcommand "$MATCH_1" "$MATCH_2" \ + destroy "$MATCH_4" "$(cat "$DATADIR/saved-tokens/$MATCH_5")" \ + >"$DATADIR/stdout" 2>"$DATADIR/stderr"; then test "$MATCH_3" = "" fi @@ -92,42 +92,42 @@ Server-side repository checking for behind-the-scenes work ---------------------------------------------------------- IMPLEMENTS THEN server-side ([^ ]+) file ([^ ]+) contains (.+) - cd "$($GTT serverlocation $MATCH_1)" + cd "$($GTT serverlocation "$MATCH_1")" grep -q "$MATCH_3" "$MATCH_2" IMPLEMENTS THEN server-side ([^ ]+) file ([^ ]+) exists - cd "$($GTT serverlocation $MATCH_1)" + cd "$($GTT serverlocation "$MATCH_1")" test -e "$MATCH_2" IMPLEMENTS THEN server-side ([^ ]+) has identical refs to ([^ ]+) bash -c 'diff -u <(git ls-remote -ht "$($GTT serverlocation "$MATCH_1")" | sort -k2) <(git ls-remote -ht "$($GTT serverlocation "$MATCH_2")" | sort -k2)' IMPLEMENTS THEN server-side ([^ ]+) has no missing objects - cd "$($GTT serverlocation $MATCH_1)".git + cd "$($GTT serverlocation "$MATCH_1")".git git fsck Clone manipulation ------------------ IMPLEMENTS THEN ([a-z][a-z0-9]*) has a clone of ([^ ]+) - $GTT cloneexists $MATCH_1 "$MATCH_2" + $GTT cloneexists "$MATCH_1" "$MATCH_2" IMPLEMENTS WHEN git pull happens in ([a-z][a-z0-9]*) ([^ ]+) - cd "$($GTT clonelocation $MATCH_1 "$MATCH_2")" + cd "$($GTT clonelocation "$MATCH_1" "$MATCH_2")" git pull IMPLEMENTS THEN ([a-z][a-z0-9]*) ([^ ]+) has a file called (.+) - cd "$($GTT clonelocation $MATCH_1 "$MATCH_2")" + cd "$($GTT clonelocation "$MATCH_1" "$MATCH_2")" test -r "$MATCH_3" IMPLEMENTS THEN ([a-z][a-z0-9]*) ([^ ]+) has no file called (.+) set -x - cd "$($GTT clonelocation $MATCH_1 "$MATCH_2")" + cd "$($GTT clonelocation "$MATCH_1" "$MATCH_2")" if test -r "$MATCH_3"; then false; else true; fi IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) uses git archive to extract the tree of ([a-z][a-z0-9-]*) ([a-z][a-z0-9]*) to ([a-z][a-z0-9]*) mkdir -p "$DATADIR/$MATCH_5" - $GTT gitarchive $MATCH_1 $MATCH_2 $MATCH_3 $MATCH_4 | tar -C "$DATADIR/$MATCH_5" -x + $GTT gitarchive "$MATCH_1" "$MATCH_2" "$MATCH_3" "$MATCH_4" | tar -C "$DATADIR/$MATCH_5" -x rsync manipulation ------------------ @@ -136,136 +136,136 @@ rsync manipulation test "x$GTT_PROTO" = "xssh" IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) rsync'?s (.*) to (.*) - rsync -I --rsh="$GTT rsh $MATCH_1 $MATCH_2" "$DATADIR/$MATCH_3" "dummy:$MATCH_4/$MATCH_3" + rsync -I --rsh="$GTT rsh \"$MATCH_1\" \"$MATCH_2\"" "$DATADIR/$MATCH_3" "dummy:$MATCH_4/$MATCH_3" IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) rsync'?s (.*) from (.*) - rsync -I --rsh="$GTT rsh $MATCH_1 $MATCH_2" "dummy:$MATCH_4/$MATCH_3" "$DATADIR/$MATCH_3" + rsync -I --rsh="$GTT rsh \"$MATCH_1\" \"$MATCH_2\"" "dummy:$MATCH_4/$MATCH_3" "$DATADIR/$MATCH_3" Admin repo manipulation ----------------------- IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? adds user ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) - $GTT runcommand $MATCH_1 $MATCH_2 \ - user add $MATCH_3 $MATCH_3@testinstance "$MATCH_3's real name" > $DATADIR/stdout 2> $DATADIR/stderr - $GTT runcommand $MATCH_1 $MATCH_2 \ - as $MATCH_3 sshkey add default < \ - $($GTT pubkeyfilename $MATCH_4 $MATCH_5) >> $DATADIR/stdout 2>> $DATADIR/stderr + $GTT runcommand "$MATCH_1" "$MATCH_2" \ + user add "$MATCH_3" "$MATCH_3"@testinstance "$MATCH_3's real name" > "$DATADIR/stdout" 2> "$DATADIR/stderr" + $GTT runcommand "$MATCH_1" "$MATCH_2" \ + as "$MATCH_3" sshkey add default < \ + "$($GTT pubkeyfilename "$MATCH_4" "$MATCH_5")" >> "$DATADIR/stdout" 2>> "$DATADIR/stderr" if [ "$GTT_PROTO" = http ]; then printf "%s" "$MATCH_3" | GTT_PROTO=ssh $GTT runcommand \ - $MATCH_1 $MATCH_2 as $MATCH_3 passwd \ - >> $DATADIR/stdout 2>> $DATADIR/stderr + "$MATCH_1" "$MATCH_2" as "$MATCH_3" passwd \ + >> "$DATADIR/stdout" 2>> "$DATADIR/stderr" fi IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? deletes user ([a-z][a-z0-9]*) - TOKEN=$($GTT runcommand $MATCH_1 $MATCH_2 user del $MATCH_3 2>&1 | $GTT findtoken) - $GTT runcommand $MATCH_1 $MATCH_2 user del $MATCH_3 $TOKEN + TOKEN="$($GTT runcommand "$MATCH_1" "$MATCH_2" user del "$MATCH_3" 2>&1 | $GTT findtoken)" + $GTT runcommand "$MATCH_1" "$MATCH_2" user del "$MATCH_3" $TOKEN IMPLEMENTS GIVEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? has patched gitano-admin with (the reverse of )?([^ ]+) - $GTT clone $MATCH_1 $MATCH_2 gitano-admin.git tmp-adminpatch \ - >$DATADIR/stdout 2>$DATADIR/stderr + $GTT clone "$MATCH_1" "$MATCH_2" gitano-admin.git tmp-adminpatch \ + >"$DATADIR/stdout" 2>"$DATADIR/stderr" if test "$MATCH_3" = ""; then - $GTT rungit $MATCH_1 tmp-adminpatch apply -v --cached - <"testing/admin-patches/$MATCH_4" \ - >>$DATADIR/stdout 2>>$DATADIR/stderr + $GTT rungit "$MATCH_1" tmp-adminpatch apply -v --cached - <"testing/admin-patches/$MATCH_4" \ + >>"$DATADIR/stdout" 2>>"$DATADIR/stderr" else - $GTT rungit $MATCH_1 tmp-adminpatch apply -v --cached --reverse - <"testing/admin-patches/$MATCH_4" \ - >>$DATADIR/stdout 2>>$DATADIR/stderr + $GTT rungit "$MATCH_1" tmp-adminpatch apply -v --cached --reverse - <"testing/admin-patches/$MATCH_4" \ + >>"$DATADIR/stdout" 2>>"$DATADIR/stderr" fi - $GTT rungit $MATCH_1 tmp-adminpatch diff --cached \ - >>$DATADIR/stdout 2>>$DATADIR/stderr - $GTT rungit $MATCH_1 tmp-adminpatch commit --allow-empty -m "Apply $MATCH_4 rules change" \ - >>$DATADIR/stdout 2>>$DATADIR/stderr - $GTT rungit $MATCH_1 tmp-adminpatch show HEAD \ - >>$DATADIR/stdout 2>>$DATADIR/stderr - $GTT push $MATCH_1 $MATCH_2 tmp-adminpatch gitano-admin.git \ - >>$DATADIR/stdout 2>>$DATADIR/stderr - rm -r "$($GTT clonelocation $MATCH_1 tmp-adminpatch)" \ - >>$DATADIR/stdout 2>>$DATADIR/stderr + $GTT rungit "$MATCH_1" tmp-adminpatch diff --cached \ + >>"$DATADIR/stdout" 2>>"$DATADIR/stderr" + $GTT rungit "$MATCH_1" tmp-adminpatch commit --allow-empty -m "Apply $MATCH_4 rules change" \ + >>"$DATADIR/stdout" 2>>"$DATADIR/stderr" + $GTT rungit "$MATCH_1" tmp-adminpatch show HEAD \ + >>"$DATADIR/stdout" 2>>"$DATADIR/stderr" + $GTT push "$MATCH_1" "$MATCH_2" tmp-adminpatch gitano-admin.git \ + >>"$DATADIR/stdout" 2>>"$DATADIR/stderr" + rm -r "$($GTT clonelocation "$MATCH_1" tmp-adminpatch)" \ + >>"$DATADIR/stdout" 2>>"$DATADIR/stderr" IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? (expecting failure,? )?pushes an empty commit in ([^ ]+) - $GTT rungit $MATCH_1 $MATCH_4 commit --allow-empty -m "Make an empty commit" - if $GTT push $MATCH_1 $MATCH_2 $MATCH_4 $MATCH_4.git > $DATADIR/stdout 2>$DATADIR/stderr; then + $GTT rungit "$MATCH_1" "$MATCH_4" commit --allow-empty -m "Make an empty commit" + if $GTT push "$MATCH_1" "$MATCH_2" "$MATCH_4" "$MATCH_4".git > "$DATADIR/stdout" 2>"$DATADIR/stderr"; then test "$MATCH_3" = "" fi IMPLEMENTS WHEN ([a-z][a-z0-9]*) (applies|reverts) ([^ ]+) in ([^ ]+) if test "$MATCH_2" = "applies"; then - $GTT rungit $MATCH_1 $MATCH_4 apply --cached - <"testing/content-patches/$MATCH_3" \ - >$DATADIR/stdout 2>$DATADIR/stderr + $GTT rungit "$MATCH_1" "$MATCH_4" apply --cached - <"testing/content-patches/$MATCH_3" \ + >"$DATADIR/stdout" 2>"$DATADIR/stderr" else - $GTT rungit $MATCH_1 $MATCH_4 apply --cached --reverse - <"testing/content-patches/$MATCH_3" \ - >$DATADIR/stdout 2>$DATADIR/stderr + $GTT rungit "$MATCH_1" "$MATCH_4" apply --cached --reverse - <"testing/content-patches/$MATCH_3" \ + >"$DATADIR/stdout" 2>"$DATADIR/stderr" fi - $GTT rungit $MATCH_1 $MATCH_4 commit --allow-empty -m "Apply $MATCH_3 content change" \ - >>$DATADIR/stdout 2>>$DATADIR/stderr + $GTT rungit "$MATCH_1" "$MATCH_4" commit --allow-empty -m "Apply $MATCH_3 content change" \ + >>"$DATADIR/stdout" 2>>"$DATADIR/stderr" Specific commands ----------------- IMPLEMENTS GIVEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) has copied ([^ ]+) to ([^ ]+) - $GTT runcommand $MATCH_1 $MATCH_2 copy $MATCH_3 $MATCH_4 + $GTT runcommand "$MATCH_1" "$MATCH_2" copy "$MATCH_3" "$MATCH_4" IMPLEMENTS GIVEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) has set the owner of ([^ ]+) to ([a-z][a-z0-9]*) - $GTT runcommand $MATCH_1 $MATCH_2 config $MATCH_3 set project.owner $MATCH_4 + $GTT runcommand "$MATCH_1" "$MATCH_2" config "$MATCH_3" set project.owner "$MATCH_4" IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) restores the latest deletion to (.+) - $GTT runcommand $MATCH_1 $MATCH_2 graveyard list >$DATADIR/stdout 2>$DATADIR/stderr - reponame="$(head -n1 $DATADIR/stdout | cut -d' ' -f2)" - $GTT runcommand $MATCH_1 $MATCH_2 graveyard restore "$reponame" "$MATCH_3" + $GTT runcommand "$MATCH_1" "$MATCH_2" graveyard list >"$DATADIR/stdout" 2>"$DATADIR/stderr" + reponame="$(head -n1 "$DATADIR/stdout" | cut -d' ' -f2)" + $GTT runcommand "$MATCH_1" "$MATCH_2" graveyard restore "$reponame" "$MATCH_3" IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) purges the latest deletion - $GTT runcommand $MATCH_1 $MATCH_2 graveyard list >$DATADIR/stdout 2>$DATADIR/stderr - reponame="$(head -n1 $DATADIR/stderr | cut -d' ' -f2)" - $GTT runcommand $MATCH_1 $MATCH_2 graveyard purge "$reponame" + $GTT runcommand "$MATCH_1" "$MATCH_2" graveyard list >"$DATADIR/stdout" 2>"$DATADIR/stderr" + reponame="$(head -n1 "$DATADIR/stderr" | cut -d' ' -f2)" + $GTT runcommand "$MATCH_1" "$MATCH_2" graveyard purge "$reponame" Generic utility methods ----------------------- IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) runs ?(.*) - if ! test -e $DATADIR/stdin; then touch $DATADIR/stdin; fi - $GTT runcommand $MATCH_1 $MATCH_2 $MATCH_3 < $DATADIR/stdin > $DATADIR/stdout 2> $DATADIR/stderr - rm -f $DATADIR/stdin + if ! test -e "$DATADIR/stdin"; then touch "$DATADIR/stdin"; fi + $GTT runcommand "$MATCH_1" "$MATCH_2" $MATCH_3 < "$DATADIR/stdin" > "$DATADIR/stdout" 2> "$DATADIR/stderr" + rm -f "$DATADIR/stdin" IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*),? expecting failure,? runs ?(.*) - if ! test -e $DATADIR/stdin; then touch $DATADIR/stdin; fi - if $GTT runcommand $MATCH_1 $MATCH_2 $MATCH_3 > $DATADIR/stdout 2> $DATADIR/stderr; then + if ! test -e "$DATADIR/stdin"; then touch "$DATADIR/stdin"; fi + if $GTT runcommand "$MATCH_1" "$MATCH_2" $MATCH_3 > "$DATADIR/stdout" 2> "$DATADIR/stderr"; then false fi - rm -f $DATADIR/stdin + rm -f "$DATADIR/stdin" IMPLEMENTS GIVEN ([^ ]+) contains (.+) printf %s "$MATCH_2" >"$DATADIR/$MATCH_1" IMPLEMENTS THEN ([^ ]+) contains (.+) - grep -q "$MATCH_2" $DATADIR/"$MATCH_1" + grep -q "$MATCH_2" "$DATADIR/$MATCH_1" IMPLEMENTS THEN the output contains (.+) - grep -q "$MATCH_1" $DATADIR/stdout $DATADIR/stderr + grep -q "$MATCH_1" "$DATADIR/stdout" "$DATADIR/stderr" IMPLEMENTS THEN ([^ ]+) does not contain (.+) - if grep -q "$MATCH_2" $DATADIR/"$MATCH_1"; then false; else true; fi + if grep -q "$MATCH_2" "$DATADIR/$MATCH_1"; then false; else true; fi IMPLEMENTS THEN the output does not contain (.+) - if grep -q "$MATCH_1" $DATADIR/stdout $DATADIR/stderr; then false; else true; fi + if grep -q "$MATCH_1" "$DATADIR/stdout" "$DATADIR/stderr"; then false; else true; fi IMPLEMENTS THEN ([^ ]+) is empty - if grep -q . $DATADIR/"$MATCH_1"; then false; fi + if grep -q . "$DATADIR/$MATCH_1"; then false; fi IMPLEMENTS THEN ([^ ]+) is not empty - grep -q . $DATADIR/"$MATCH_1" + grep -q . "$DATADIR/$MATCH_1" IMPLEMENTS THEN the output is empty - if grep -q . $DATADIR/stdout $DATADIR/stderr; then false; else true; fi + if grep -q . "$DATADIR/stdout" "$DATADIR/stderr"; then false; else true; fi IMPLEMENTS THEN the output is not empty - grep -q . $DATADIR/stdout $DATADIR/stderr + grep -q . "$DATADIR/stdout" "$DATADIR/stderr" IMPLEMENTS GIVEN the token is saved as (.+) mkdir -p "$DATADIR/saved-tokens" cat "$DATADIR/stdout" "$DATADIR/stderr" | $GTT findtoken >"$DATADIR/saved-tokens/$MATCH_1" IMPLEMENTS THEN failure ensues - cd $DATADIR + cd "$DATADIR" echo "FIND:" find . echo "KEYS:" @@ -289,4 +289,4 @@ can access, these implementations use that `GNUPG_HOME` rather than one inside `DATADIR`. IMPLEMENTS GIVEN gpg key ([0-9A-Fa-f]+) on stdin - $GTT gpg --armor --export $MATCH_1 > $DATADIR/stdin + $GTT gpg --armor --export "$MATCH_1" > "$DATADIR/stdin" |