From 28a18ae39390cf4b70d557601c3ca35b797e1aa1 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 14 Oct 2017 19:57:38 +0300 Subject: Add: yarn for holywood --- 900-implements.yarn | 15 ++++++++++++++- holywood.yarn | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 holywood.yarn diff --git a/900-implements.yarn b/900-implements.yarn index 4fae633..c2578cc 100644 --- a/900-implements.yarn +++ b/900-implements.yarn @@ -41,6 +41,19 @@ vars['stdout'] = out vars['stderr'] = err + IMPLEMENTS WHEN user runs ssh server (.*) + address = os.environ['ADDRESS'] + sshkey = os.environ['SSH_KEY'] + cmd = get_next_match() + argv = [ + 'ssh', '-oIdentitiesOnly=yes', '-i', sshkey, address + ] + cmd.split() + exit, out, err = cliapp.runcmd_unchecked(argv) + vars['argv'] = argv + vars['exit'] = int(exit) + vars['stdout'] = out + vars['stderr'] = err + IMPLEMENTS WHEN user clones the (\S+) repository over git:// address = os.environ['ADDRESS'] repo = get_next_match() @@ -59,7 +72,7 @@ IMPLEMENTS THEN standard output matches "(.+)" pattern = get_next_match() stdout = vars['stdout'] - m = re.search(pattern, stdout) + m = re.search(pattern, stdout, re.M) print 'pattern:', repr(pattern) print 'argv:', repr(vars['argv']) print 'stdout:', repr(stdout) diff --git a/holywood.yarn b/holywood.yarn new file mode 100644 index 0000000..55745e2 --- /dev/null +++ b/holywood.yarn @@ -0,0 +1,52 @@ +--- +title: System tests for holywood +author: Lars Wirzenius +version: 2017-04-21 +... + +# Introduction + +This is a system test suite written in [yarn][]. They test the various +aspects of my file server, called `holywood`. + +[yarn]: http://liw.fi/cmdtest/ + + +## Configuration and running the test suite + +To run the test suite, specify the server address that is to be +tested. In order to be able to run these tests against a new server, +before DNS gets updated, the domain names are not hardcoded. Instead, +you need to specify the address (IP address or DNS name) of the +server, and the tests pretend it has whatever service names in DNS +that need to be updated. + +Do this with: + + EXAMPLE + yarn --env ADDRESS=new.example.com ... + + +# holywood scenario test + + SCENARIO holywood + GIVEN server is also known as holywood + + WHEN user runs ssh server -l ansible id -un + THEN standard output matches "^ansible$" + + WHEN user runs ssh server -l ansible sudo id -un + THEN standard output matches "^root$" + + WHEN user runs ssh server id -un + THEN standard output matches "^liw$" + + WHEN user runs ssh server ls -ld /mnt/soile/pupu + THEN standard output matches "^drwxrwxr-x" + + WHEN user runs ssh server ls -ld /mnt/holybackup/restic + THEN standard output matches "^drwx------.* root root" + + WHEN user runs ssh server -l ansible sudo showmount -e + THEN standard output matches "^/mnt/Ella" + AND standard output matches "^/mnt/soile/pupu" -- cgit v1.2.1