summaryrefslogtreecommitdiff
path: root/testing/library.yarn
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2017-07-31 14:39:54 -0400
committerDaniel Silverstone <dsilvers@digital-scurf.org>2017-07-31 16:58:58 -0400
commitab55ba5174097b25fe7227d1aa4e6559cc40b978 (patch)
treee7ea6061d364204760cd612b0ea4c7deb3a822ec /testing/library.yarn
parent5a3619ec799578f4aaf57e164a27648bf86ae077 (diff)
downloadgitano-ab55ba5174097b25fe7227d1aa4e6559cc40b978.tar.gz
Test suite properly runs gitano-command.cgi
In order to make this work, I had to rework password handling in the test suite, and also redo the http unwrapper to use wget instead of executing the cgi directly. All yarn IMPLEMENTs which use $GTT runcommand and don't pass the stdin, *MUST* explicitly use </dev/null to prevent hangs in http mode.
Diffstat (limited to 'testing/library.yarn')
-rw-r--r--testing/library.yarn32
1 files changed, 16 insertions, 16 deletions
diff --git a/testing/library.yarn b/testing/library.yarn
index a370bfe..88f6142 100644
--- a/testing/library.yarn
+++ b/testing/library.yarn
@@ -23,10 +23,10 @@ General instance management
$GTT createsshkey testinstance bypasskey
$GTT setupstandard testinstance adminkey bypasskey
if [ "$GTT_PROTO" = http ]; then
- printf "%s" admin | GTT_PROTO=ssh $GTT runcommand \
+ printf "%s" $($GTT getpasswd testinstance) | GTT_PROTO=ssh $GTT runcommand \
testinstance adminkey as admin passwd \
>> "$DATADIR/stdout" 2>> "$DATADIR/stderr"
- printf "%s" gitano-bypass | GTT_PROTO=ssh $GTT runcommand \
+ printf "%s" $($GTT getpasswd testinstance) | GTT_PROTO=ssh $GTT runcommand \
testinstance bypasskey as gitano-bypass passwd \
>> "$DATADIR/stdout" 2>> "$DATADIR/stderr"
fi
@@ -57,12 +57,12 @@ of the user inside Gitano.
$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"
+ user add "$MATCH_3" "$MATCH_3"@testinstance "$MATCH_3's real name" < "/dev/null" > "$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 \
+ printf "%s" $($GTT getpasswd "$MATCH_3") | GTT_PROTO=ssh $GTT runcommand \
"$MATCH_1" "$MATCH_2" as "$MATCH_3" passwd \
>> "$DATADIR/stdout" 2>> "$DATADIR/stderr"
fi
@@ -84,7 +84,7 @@ Repository access
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
+ < /dev/null >"$DATADIR/stdout" 2>"$DATADIR/stderr"; then
test "$MATCH_3" = ""
fi
@@ -146,19 +146,19 @@ 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"
+ user add "$MATCH_3" "$MATCH_3"@testinstance "$MATCH_3's real name" < "/dev/null" > "$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 \
+ printf "%s" $($GTT getpasswd "$MATCH_4") | GTT_PROTO=ssh $GTT runcommand \
"$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 < /dev/null | $GTT findtoken)"
+ $GTT runcommand "$MATCH_1" "$MATCH_2" user del "$MATCH_3" $TOKEN </dev/null >"$DATADIR/stdout" 2>"$DATADIR/stderr"
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 \
@@ -205,20 +205,20 @@ 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" </dev/null >"$DATADIR/stdout" 2>"$DATADIR/stderr"
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" </dev/null >"$DATADIR/stdout" 2>"$DATADIR/stderr"
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"
+ $GTT runcommand "$MATCH_1" "$MATCH_2" graveyard list </dev/null >"$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 restore "$reponame" "$MATCH_3" </dev/null
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"
+ $GTT runcommand "$MATCH_1" "$MATCH_2" graveyard list </dev/null >"$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 purge "$reponame" </dev/null
Generic utility methods
-----------------------
@@ -230,7 +230,7 @@ Generic utility methods
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 $GTT runcommand "$MATCH_1" "$MATCH_2" $MATCH_3 < "$DATADIR/stdin" > "$DATADIR/stdout" 2> "$DATADIR/stderr"; then
false
fi
rm -f "$DATADIR/stdin"