summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2016-12-03 16:06:30 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2016-12-03 16:06:49 +0000
commiteb2f5c42f9f57de71d7d52075fdba5e8f453a492 (patch)
treedcdc7293e4460a36b85a1a2b15a68d3024868aeb /testing
parent00c1817dacfae3be2749f199000a2db25b5c8a43 (diff)
downloadgitano-eb2f5c42f9f57de71d7d52075fdba5e8f453a492.tar.gz
Support whining for supple, and clean up a few bits
Diffstat (limited to 'testing')
-rw-r--r--testing/01-basics.yarn19
-rw-r--r--testing/library.yarn10
-rw-r--r--testing/rules-patches/post-receive-alert.patch11
3 files changed, 34 insertions, 6 deletions
diff --git a/testing/01-basics.yarn b/testing/01-basics.yarn
index 7ab9668..eb876da 100644
--- a/testing/01-basics.yarn
+++ b/testing/01-basics.yarn
@@ -122,13 +122,20 @@ Bypass user alerting
--------------------
When the bypass user is used, Gitano should whine strongly in order to
-discourage the human doing this. In addition this whine is sent to stdout
-in order to discourage the human from automating bypasses instead.
+discourage the human doing this.
SCENARIO using bypass warns loudly
GIVEN a standard instance
WHEN testinstance bypasskey runs ls
- THEN stdout contains ALERT
- AND stdout contains DO NOT DO THIS
- AND stdout contains DANGER
- AND stdout contains VERY RISKY
+ THEN the output contains ALERT
+ AND the output contains DO NOT DO THIS
+ AND the output contains DANGER
+ AND the output contains VERY RISKY
+ GIVEN testinstance using adminkey has patched rules with post-receive-alert.patch
+ WHEN testinstance using adminkey clones gitano-admin.git as gitano-admin
+ AND testinstance using adminkey pushes an empty commit in gitano-admin
+ WHEN testinstance using bypasskey pushes an empty commit in gitano-admin
+ THEN the output contains PERIL
+ AND the output contains CRITICAL FAILURE
+ AND the output does not contain XYZZY
+ THEN failure ensues
diff --git a/testing/library.yarn b/testing/library.yarn
index c3c39ea..5fa4e61 100644
--- a/testing/library.yarn
+++ b/testing/library.yarn
@@ -122,6 +122,10 @@ Admin repo manipulation
$GTT pushviassh $MATCH_1 $MATCH_2 tmp-rulepatch gitano-admin.git
rm -r "$($GTT clonelocation $MATCH_1 tmp-rulepatch)"
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? pushes an empty commit in ([^ ]+)
+ $GTT rungit $MATCH_1 $MATCH_3 commit --allow-empty -m "Make an empty commit"
+ $GTT pushviassh $MATCH_1 $MATCH_2 $MATCH_3 gitano-admin.git > $DATADIR/stdout 2>$DATADIR/stderr
+
Specific commands
-----------------
@@ -162,9 +166,15 @@ Generic utility methods
IMPLEMENTS THEN ([^ ]+) contains (.+)
grep -q "$MATCH_2" $DATADIR/"$MATCH_1"
+ IMPLEMENTS THEN the output contains (.+)
+ 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
+ IMPLEMENTS THEN the output does not contain (.+)
+ 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
diff --git a/testing/rules-patches/post-receive-alert.patch b/testing/rules-patches/post-receive-alert.patch
new file mode 100644
index 0000000..5785567
--- /dev/null
+++ b/testing/rules-patches/post-receive-alert.patch
@@ -0,0 +1,11 @@
+diff --git a/global-hooks/post-receive.lua b/global-hooks/post-receive.lua
+new file mode 100644
+index 0000000..77df072
+--- /dev/null
++++ a/global-hooks/post-receive.lua
+@@ -0,0 +1,5 @@
++(function (hookf, ...)
++ log.state("XYZZY XYZZY HOOK RUN XYZZY XYZZY")
++ return hookf(...)
++end)(...)
++