summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2013-06-23 08:48:09 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2013-06-23 08:48:09 +0100
commit51d33c73fd2291dbba12832b7a012fbf64e26f91 (patch)
tree4abdae7e36f6b07b2d5db58938e02942b31b26de
parente98156c549fd5a67fe7ab0a5bcaf72a1f51330ce (diff)
downloadgitano-51d33c73fd2291dbba12832b7a012fbf64e26f91.tar.bz2
Add checks for 'gc'
-rw-r--r--testing/02-commands-gc.yarn68
1 files changed, 68 insertions, 0 deletions
diff --git a/testing/02-commands-gc.yarn b/testing/02-commands-gc.yarn
index f282cb0..d1cff46 100644
--- a/testing/02-commands-gc.yarn
+++ b/testing/02-commands-gc.yarn
@@ -1 +1,69 @@
<!-- -*- markdown -*- -->
+gc ---- Invoke git gc on your repository (Takes a repo)
+=======================================================
+
+The `gc` command is a basic pass-through to the underlying `git gc` being run
+on the remote repository. Apart from ensuring that the caller has `write`
+access, to a repository which exists, no other checks are done and any spare
+arguments are passed through to `git gc`.
+
+Using `gc` in the simple case
+-----------------------------
+
+So the simple case is that a `gitano-admin` runs `gc` on a repository which
+definitely exists which means they always have the rights to do so.
+
+ SCENARIO Simple case `gc` usage
+
+ GIVEN a standard instance
+ WHEN testinstance adminkey runs gc gitano-admin
+ THEN stderr is empty
+ AND stdout is empty
+
+We can then ensure that if the repository does not exist, we get a useful error
+message back:
+
+ SCENARIO Simple failure case `gc` usage
+
+ GIVEN a standard instance
+ WHEN testinstance adminkey, expecting failure, runs gc something
+ THEN stdout is empty
+ AND stderr contains repository does not exist
+
+Write access checks
+-------------------
+
+A more complex case involves creating a repository to which a user has no write
+permissions and trying to get that user to run `gc` on it.
+
+ SCENARIO Write access checks for `gc` usage
+
+ GIVEN a standard instance
+ AND testinstance has keys called other
+ WHEN testinstance, using adminkey, adds user other, using testinstance other
+ AND testinstance adminkey runs create testrepo
+ AND testinstance other, expecting failure, runs gc testrepo
+ THEN stdout is empty
+ AND stderr contains Ruleset denied action
+
+Passing arguments to `git gc`
+-----------------------------
+
+Any spare arguments given to `gc` are passed through to `git gc` untouched. We
+can verify that arguments are passed through by passing a bad argument through
+and seeing if we get an error message from the underlying `git gc` instance:
+
+ SCENARIO Passing arguments through to `git gc`
+
+ GIVEN a standard instance
+ WHEN testinstance adminkey, expecting failure, runs gc gitano-admin --not-valid
+ THEN stdout is empty
+
+These are the `git gc` errors
+
+ AND stderr contains error: unknown option
+ AND stderr contains usage: git gc
+
+And this demonstrates that Gitano detected the error properly
+
+ AND stderr contains Unable to continue