diff options
Diffstat (limited to 'testing/02-commands-fsck.yarn')
-rw-r--r-- | testing/02-commands-fsck.yarn | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/testing/02-commands-fsck.yarn b/testing/02-commands-fsck.yarn index f282cb0..115bbc6 100644 --- a/testing/02-commands-fsck.yarn +++ b/testing/02-commands-fsck.yarn @@ -1 +1,65 @@ <!-- -*- markdown -*- --> +fsck ---- Perform a fsck operation on a repository (Takes a repo) +================================================================= + +The `fsck` command is a basic pass-through to the underlying `git fsck` 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 fsck`. + +Simple `fsck` usage +------------------- + +In the simple case a `gitano-admin` runs `fsck` against a repository which +definitely exists and as they are `gitano-admin` they have write access. + + SCENARIO Simple `fsck` cases + + GIVEN a standard instance + WHEN testinstance adminkey runs fsck gitano-admin + THEN stdout is empty + AND stderr is empty + +No matter how powerful you are, you cannot `fsck` a repository which does not +exist... + + WHEN testinstance adminkey, expecting failure, runs fsck somethingelse + THEN stdout is empty + AND stderr contains repository does not exist + +Attempting to `fsck` when you have no write access +-------------------------------------------------- + +Since any non-`gitano-admin` member cannot see `gitano-admin` we can use that +as a test case for ensuring that you must have write access in order to `fsck` +something. + + SCENARIO lowly accolyte fails to fsck + + GIVEN a standard instance + AND testinstance has keys called other + WHEN testinstance, using adminkey, adds user other, using testinstance other + AND testinstance other, expecting failure, runs fsck gitano-admin + THEN stdout is empty + AND stderr contains Ruleset denied action + +Passing commands through to `fsck` +---------------------------------- + +It is possible to pass arguments through to the `git fsck` subprocess. By +passing through a bad option, we get to see this in action + + SCENARIO passing arguments to `fsck` + + GIVEN a standard instance + WHEN testinstance adminkey, expecting failure, runs fsck gitano-admin --bad-option + THEN stdout is empty + +We check for `git fsck`'s usage message: + + AND stderr contains error: unknown option + AND stderr contains usage: git fsck + +And also we see that Gitano has caught the error + + AND stderr contains Unable to continue |