summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-01-19 11:50:41 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2017-01-19 11:50:41 +0100
commit25a14d4ccfceb2698edce01092bc6a1dbe9fb217 (patch)
tree82eddea84f59333847c594e9fe0a97cd0e4f6176 /test
parent2984d7aec37e09b473c7b99f43d20622c25dc99d (diff)
make the moo reproducible
Normal cows moo every time they feel like it and it might be a "moo", "moo!" or "moo?". This is completely unacceptable behaviour in our super cow through as as a superior being it has to show its superiority over the common cows and the meager easter eggs by being fully reproducible! The second version of Chris' patch is modified to include an array of tests for this feature – which doubles as explanation for some of the moo lines by giving more exact dates – and falling back to current time if the environment is invalid + passing time around instead of having an invalid environment be an unrecoverable error (aka: Guru Meditation) as that is more inline with how apt usually behaves: The wisdom of super cow should be available to everyone, even to the most misfortune users not capable of having a valid environment variable. That makes the code slightly more ugly, so instead of requiring a young follower to produce a third version a high priest of the cult applied the finishing touches as he is used to the pain by now – and another round with the slowpoke high priest would have been a serious threat to the Debian release schedule which the cow would not approve. Closes: #848721 Signed-off-by: Super Cow Thanks: Chris Lamb for initial patch and guru meditation
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-00-commands-have-help22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/integration/test-00-commands-have-help b/test/integration/test-00-commands-have-help
index 699cdef15..87c3be6b4 100755
--- a/test/integration/test-00-commands-have-help
+++ b/test/integration/test-00-commands-have-help
@@ -63,3 +63,25 @@ testsuccess aptget moo moo moo
testsuccess aptget moo moo moo -q=2
testsuccess aptget moo moo moo moo
testsuccess aptget moo moo moo moo -q=2
+
+export SOURCE_DATE_EPOCH=moo
+testwarningmsg 'W: Environment variable SOURCE_DATE_EPOCH was ignored as it has an invalid value: "moo"' apt moo
+testmoo() {
+ export SOURCE_DATE_EPOCH="$(date -d "$1" +'%s')"
+ testsuccess aptget moo
+ cp rootdir/tmp/testsuccess.output moo.output
+ testsuccess grep "$2" moo.output
+ testsuccessequal "$2" apt moo -qqq
+ unset SOURCE_DATE_EPOCH
+}
+testmoo '@0' 'Have you mooed today?'
+testmoo '0-12-25' 'Happy package management day!'
+testmoo '1930-02-18' "It's a Bird ... It's a Plane ... It's Super Cow!"
+testmoo '1966-11-07' 'Whoever needs milk, bows to the animal.'
+testmoo '1988-03-29' 'Have you mooed today?'
+testmoo '1993-08-16' 'Three moos for Debian!'
+testmoo '1998-04-01' 'Have you smashed some milk today?'
+testmoo '@1484822790' 'Have you mooed today?'
+testmoo '@1484822791' 'Have you mooed today?'
+testmoo '@1484822792' 'Have you mooed today?'
+testmoo '@1484822793' 'Have you mooed today?'