diff options
author | Richard Maw <richard.maw@gmail.com> | 2016-12-18 15:15:20 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@gmail.com> | 2016-12-18 15:28:17 +0000 |
commit | c354461cd3b07da30b0edd0e0b56341b8e02345c (patch) | |
tree | 771ded0e59bbc6cdff7a94e0d30b955553ae25bc /testing | |
parent | dacd657430f4b8107d97e52c9c32694fa548feb1 (diff) | |
download | gitano-c354461cd3b07da30b0edd0e0b56341b8e02345c.tar.gz |
testing: Add teardown step to all scenarios
Diffstat (limited to 'testing')
24 files changed, 68 insertions, 0 deletions
diff --git a/testing/01-basics.yarn b/testing/01-basics.yarn index 3cc9afc..581a1e3 100644 --- a/testing/01-basics.yarn +++ b/testing/01-basics.yarn @@ -38,6 +38,7 @@ Finally we remove that user and verify that `gitano-admin` reflects that too. AND git pull happens in testinstance gitano-admin THEN testinstance gitano-admin has no file called users/alice/user.conf AND testinstance gitano-admin has no file called users/alice/default.key + FINALLY the instance is torn down Users can see what groups they are in ------------------------------------- @@ -60,6 +61,7 @@ membership of `gitano-admin` WHEN testinstance, using adminkey, adds user alice, using alice main AND alice main runs whoami THEN stdout does not contain gitano-admin + FINALLY the instance is torn down Non-admin users cannot see the `gitano-admin` repository -------------------------------------------------------- @@ -78,6 +80,7 @@ when the new user runs 'ls' it doesn't get to see `gitano-admin` but that the THEN stdout does not contain gitano-admin WHEN testinstance adminkey runs ls THEN stdout contains RW \ gitano-admin + FINALLY the instance is torn down Basic repository creation ------------------------- @@ -95,6 +98,7 @@ test that a new user who has a repository created for them can see it in ls. AND testinstance adminkey runs create somerepo alice AND alice main runs ls THEN stdout contains RW \ somerepo + FINALLY the instance is torn down And just to check, if the `testinstance` user created a non-delegated repo then the `alice` user cannot see it. @@ -104,6 +108,7 @@ the `alice` user cannot see it. THEN stdout contains RW \ anotherrepo WHEN alice main runs ls THEN stdout does not contain anotherrepo + FINALLY the instance is torn down Basic command handling ---------------------- @@ -117,6 +122,7 @@ so when you haven't provided a command you get an error message. GIVEN a standard instance WHEN testinstance adminkey, expecting failure, runs THEN stderr contains FATAL: No command provided, cannot continue + FINALLY the instance is torn down Bypass user alerting -------------------- @@ -138,3 +144,4 @@ discourage the human doing this. THEN the output contains PERIL AND the output contains CRITICAL FAILURE AND the output does not contain XYZZY + FINALLY the instance is torn down diff --git a/testing/02-commands-as.yarn b/testing/02-commands-as.yarn index ce8afbf..44d21da 100644 --- a/testing/02-commands-as.yarn +++ b/testing/02-commands-as.yarn @@ -37,6 +37,8 @@ The final trivial case is that a user which can run `as` cannot use it to run AND stderr contains Validation of command line failed AND stderr contains exit:1 + FINALLY the instance is torn down + Security-related cases for `as` invocation ------------------------------------------ @@ -70,3 +72,5 @@ manages to typo a username, they get a useful error message. AND stderr contains does not exist AND stderr contains exit:1 AND stdout is empty + + FINALLY the instance is torn down diff --git a/testing/02-commands-config.yarn b/testing/02-commands-config.yarn index 71e7cdd..1ffca23 100644 --- a/testing/02-commands-config.yarn +++ b/testing/02-commands-config.yarn @@ -28,6 +28,8 @@ owner can be set via the person running the create. AND stdout contains project.owner: admin AND stdout contains project.head: refs/heads/master + FINALLY the instance is torn down + Configuration changes stick --------------------------- @@ -57,6 +59,8 @@ but we can change this after it has been created. AND testinstance adminkey runs config testrepo show THEN stdout contains project.owner: alice + FINALLY the instance is torn down + Changes to `HEAD` and description hit the filesystem ---------------------------------------------------- @@ -73,6 +77,8 @@ outside world. THEN server-side testrepo.git file description contains foobar AND server-side testrepo.git file HEAD contains refs/heads/trunk + FINALLY the instance is torn down + Manipulating list values is possible ------------------------------------ @@ -102,4 +108,6 @@ new items appended... THEN stderr is empty AND stdout does not contain foo.i_ + FINALLY the instance is torn down + FIXME: Once we have ruleset control, add more here perhaps diff --git a/testing/02-commands-copy.yarn b/testing/02-commands-copy.yarn index fed2a7c..89a1d0a 100644 --- a/testing/02-commands-copy.yarn +++ b/testing/02-commands-copy.yarn @@ -50,3 +50,5 @@ and are not informed if the path already exists if they cannot read it. WHEN alice main, expecting failure, runs copy user/alice/testrepo gitano-admin THEN stderr does not contain ERROR: Repository gitano-admin already exists + + FINALLY the instance is torn down diff --git a/testing/02-commands-count-objects.yarn b/testing/02-commands-count-objects.yarn index 1f200d6..eb7e74e 100644 --- a/testing/02-commands-count-objects.yarn +++ b/testing/02-commands-count-objects.yarn @@ -15,3 +15,5 @@ since that would be an information leak that the repository exists. WHEN testinstance adminkey runs count-objects gitano-admin THEN stdout contains objects AND stdout contains bytes + + FINALLY the instance is torn down diff --git a/testing/02-commands-create.yarn b/testing/02-commands-create.yarn index e131ca6..d62bf18 100644 --- a/testing/02-commands-create.yarn +++ b/testing/02-commands-create.yarn @@ -15,3 +15,5 @@ May not create repositories elsewhere. WHEN alice main, expecting failure, runs create personal/testintance/testrepo THEN stderr contains CRIT: Repository creation is not permitted. + + FINALLY the instance is torn down diff --git a/testing/02-commands-destroy.yarn b/testing/02-commands-destroy.yarn index b2ba340..9ea9a44 100644 --- a/testing/02-commands-destroy.yarn +++ b/testing/02-commands-destroy.yarn @@ -49,3 +49,5 @@ which will do the delete if the token is still valid when passed to destroy. This is to prevent deleting a repository that someone has just pushed to and losing their changes. + + FINALLY the instance is torn down diff --git a/testing/02-commands-fsck.yarn b/testing/02-commands-fsck.yarn index 115bbc6..a3585e5 100644 --- a/testing/02-commands-fsck.yarn +++ b/testing/02-commands-fsck.yarn @@ -27,6 +27,8 @@ exist... THEN stdout is empty AND stderr contains repository does not exist + FINALLY the instance is torn down + Attempting to `fsck` when you have no write access -------------------------------------------------- @@ -43,6 +45,8 @@ something. THEN stdout is empty AND stderr contains Ruleset denied action + FINALLY the instance is torn down + Passing commands through to `fsck` ---------------------------------- @@ -63,3 +67,5 @@ We check for `git fsck`'s usage message: And also we see that Gitano has caught the error AND stderr contains Unable to continue + + FINALLY the instance is torn down diff --git a/testing/02-commands-gc.yarn b/testing/02-commands-gc.yarn index d1cff46..499684d 100644 --- a/testing/02-commands-gc.yarn +++ b/testing/02-commands-gc.yarn @@ -20,6 +20,8 @@ definitely exists which means they always have the rights to do so. THEN stderr is empty AND stdout is empty + FINALLY the instance is torn down + We can then ensure that if the repository does not exist, we get a useful error message back: @@ -30,6 +32,8 @@ message back: THEN stdout is empty AND stderr contains repository does not exist + FINALLY the instance is torn down + Write access checks ------------------- @@ -46,6 +50,8 @@ permissions and trying to get that user to run `gc` on it. THEN stdout is empty AND stderr contains Ruleset denied action + FINALLY the instance is torn down + Passing arguments to `git gc` ----------------------------- @@ -67,3 +73,5 @@ These are the `git gc` errors And this demonstrates that Gitano detected the error properly AND stderr contains Unable to continue + + FINALLY the instance is torn down diff --git a/testing/02-commands-git-upload-archive.yarn b/testing/02-commands-git-upload-archive.yarn index a16a0ca..797a605 100644 --- a/testing/02-commands-git-upload-archive.yarn +++ b/testing/02-commands-git-upload-archive.yarn @@ -10,3 +10,4 @@ which is useful for providing snapshots. GIVEN a standard instance WHEN testinstance adminkey uses git archive to extract the tree of gitano-admin HEAD to test THEN test/site.conf contains site_name "Gitano Test Instance" + FINALLY the instance is torn down diff --git a/testing/02-commands-graveyard.yarn b/testing/02-commands-graveyard.yarn index 739540a..e5bdb3d 100644 --- a/testing/02-commands-graveyard.yarn +++ b/testing/02-commands-graveyard.yarn @@ -41,3 +41,4 @@ then it has to be purged from the graveyard as well. WHEN testinstance adminkey purges the latest deletion AND testinstance adminkey runs graveyard list THEN stdout does not contain personal.alice.testrepo + FINALLY the instance is torn down diff --git a/testing/02-commands-group.yarn b/testing/02-commands-group.yarn index 0d84c2f..5be6828 100644 --- a/testing/02-commands-group.yarn +++ b/testing/02-commands-group.yarn @@ -7,3 +7,4 @@ TODO: Expand this beyond these simple regression checks GIVEN a standard instance WHEN testinstance adminkey, expecting failure, runs group add foo/bar bananas THEN stderr contains group name .foo/bar. not valid + FINALLY the instance is torn down diff --git a/testing/02-commands-help.yarn b/testing/02-commands-help.yarn index 670fb77..2a3d801 100644 --- a/testing/02-commands-help.yarn +++ b/testing/02-commands-help.yarn @@ -56,3 +56,4 @@ THEN the output is not empty WHEN testinstance adminkey runs help demo THEN the output is not empty + FINALLY the instance is torn down diff --git a/testing/02-commands-keyring.yarn b/testing/02-commands-keyring.yarn index 27a6ddf..d9ffa11 100644 --- a/testing/02-commands-keyring.yarn +++ b/testing/02-commands-keyring.yarn @@ -17,6 +17,7 @@ a gitano-admin we have full access to the keyrings by default... WHEN testinstance adminkey runs keyring list THEN stdout is empty AND stderr is empty + FINALLY the instance is torn down Now let's check that we can create a keyring and it'll show, and vanish again when we remove it. @@ -31,6 +32,7 @@ when we remove it. AND testinstance adminkey runs keyring list THEN stdout is empty AND stderr is empty + FINALLY the instance is torn down More complex keyring operations =============================== @@ -54,5 +56,6 @@ from our test GPG home. AND testinstance adminkey runs keyring show jeff THEN stdout is empty AND stderr is empty + FINALLY the instance is torn down TODO: Add more tests when we have rule control to govern things a little more. diff --git a/testing/02-commands-ls.yarn b/testing/02-commands-ls.yarn index ad6fd08..2df035f 100644 --- a/testing/02-commands-ls.yarn +++ b/testing/02-commands-ls.yarn @@ -19,6 +19,7 @@ repositories. WHEN testinstance adminkey runs ls THEN stdout contains RW \ gitano-admin AND stderr is empty + FINALLY the instance is torn down General access control for ls ============================= @@ -34,6 +35,7 @@ when you run `ls`. AND testinstance other runs ls THEN stdout does not contain stoat AND stderr is empty + FINALLY the instance is torn down Check listing of archived repositories ====================================== @@ -53,5 +55,6 @@ run `ls` even if you have access, unless you pass `--all` to the ls command. WHEN testinstance adminkey runs ls --all THEN stdout contains RWA gitano-admin AND stderr is empty + FINALLY the instance is torn down TODO: Add more tests when we have rule control to govern things a little more. diff --git a/testing/02-commands-rename.yarn b/testing/02-commands-rename.yarn index c8b16a9..dcef14a 100644 --- a/testing/02-commands-rename.yarn +++ b/testing/02-commands-rename.yarn @@ -9,6 +9,7 @@ When a repository is renamed it does not modify any of the refs. WHEN testinstance adminkey runs rename public/testrepo public/testrepo2 THEN server-side public/testrepo2 has identical refs to gitano-admin + FINALLY the instance is torn down @@ -41,3 +42,4 @@ and it does not reveal the existence of the repository. WHEN alice main, expecting failure, runs rename testrepo personal/alice/gitano-admin THEN stderr contains CRIT: The ruleset didn't provide access. AND stderr does not contain ERROR: Cannot rename testrepo as it does not exist + FINALLY the instance is torn down diff --git a/testing/02-commands-rsync.yarn b/testing/02-commands-rsync.yarn index 672145d..c9111b9 100644 --- a/testing/02-commands-rsync.yarn +++ b/testing/02-commands-rsync.yarn @@ -25,3 +25,4 @@ i.e. `rsync gituser@gitanoserver:repository/filename filename`. GIVEN testfile contains bar WHEN testinstance adminkey rsync's testfile from gitano-admin.git THEN testfile contains foo + FINALLY the instance is torn down diff --git a/testing/02-commands-sshkey.yarn b/testing/02-commands-sshkey.yarn index 028a32f..ed470b6 100644 --- a/testing/02-commands-sshkey.yarn +++ b/testing/02-commands-sshkey.yarn @@ -38,6 +38,7 @@ We can delete the old key and proceed with the new key in future. WHEN testinstance newkey runs sshkey del adminkey THEN the output contains SSH authorised key file updated + FINALLY the instance is torn down @@ -64,3 +65,5 @@ as a protection against accidentally locking yourself out. If it is necessary to remove a key, then a new key must be added first and the delete must be issued with that key. + + FINALLY the instance is torn down diff --git a/testing/02-commands-user.yarn b/testing/02-commands-user.yarn index f0c0f72..c209228 100644 --- a/testing/02-commands-user.yarn +++ b/testing/02-commands-user.yarn @@ -51,6 +51,7 @@ Privileged users may delete other users. THEN the output contains Committed: Delete user robert WHEN testinstance adminkey runs user list THEN stdout does not contain ^bob + FINALLY the instance is torn down regression checks ================= @@ -59,3 +60,4 @@ regression checks GIVEN a standard instance WHEN testinstance adminkey, expecting failure, runs user add foo/bar foo@bar bananas THEN stderr contains user name .foo/bar. not valid + FINALLY the instance is torn down diff --git a/testing/02-commands-whoami.yarn b/testing/02-commands-whoami.yarn index 529ab7a..beb5dd4 100644 --- a/testing/02-commands-whoami.yarn +++ b/testing/02-commands-whoami.yarn @@ -9,4 +9,5 @@ THEN stdout contains User name: alice THEN stdout contains Real name: alice's real name THEN stdout contains Email address: alice@testinstance + FINALLY the instance is torn down diff --git a/testing/03-cgit-support.yarn b/testing/03-cgit-support.yarn index ffc2e91..ade8d76 100644 --- a/testing/03-cgit-support.yarn +++ b/testing/03-cgit-support.yarn @@ -15,3 +15,4 @@ rather than starting a CGit instance and inspecting its UI. GIVEN a standard instance WHEN testinstance adminkey runs config gitano-admin set project.archived true THEN server-side gitano-admin.git file cgitrc contains hide=1 + FINALLY the instance is torn down diff --git a/testing/03-shallow-push.yarn b/testing/03-shallow-push.yarn index 7a30a06..8df9468 100644 --- a/testing/03-shallow-push.yarn +++ b/testing/03-shallow-push.yarn @@ -17,3 +17,4 @@ Then pushing shallow history succeeds. WHEN testinstance, using adminkey, pushes local-shallow to remote-shallow.git THEN server-side remote-shallow.git file shallow exists + FINALLY the instance is torn down diff --git a/testing/gitano-test-tool.in b/testing/gitano-test-tool.in index 2cff2e3..4056935 100644 --- a/testing/gitano-test-tool.in +++ b/testing/gitano-test-tool.in @@ -191,6 +191,9 @@ function cmd_setupstandard(owning_user, master_key, bypass_key) } end +function cmd_teardownstandard() +end + function cmd_cloneviassh(user, key, repo, localname, ...) local exturl = generate_exturl(user, key, repo) run_program { diff --git a/testing/library.yarn b/testing/library.yarn index 6e0b1c9..5a812fa 100644 --- a/testing/library.yarn +++ b/testing/library.yarn @@ -35,6 +35,9 @@ General instance management $GTT createsshkey testinstance bypasskey $GTT setupstandard testinstance adminkey bypasskey + IMPLEMENTS FINALLY the instance is torn down + $GTT teardownstandard testinstance adminkey bypasskey + Repository access ----------------- |