summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@gmail.com>2017-01-02 12:11:56 +0000
committerRichard Maw <richard.maw@gmail.com>2017-01-02 12:34:26 +0000
commit40b9f6e0280053f1dbefddb3edc5000530b6269e (patch)
tree7f1585141e5df2bf47efe0a824815e0dc3d54059 /testing
parente4e4a4fc0dfcce2d2aea47a7f862e1b375e7e098 (diff)
downloadgitano-40b9f6e0280053f1dbefddb3edc5000530b6269e.tar.gz
testing: Reformat yarns
We got some weird indentations because some code editors normalise whitespace and do so to different levels. This also took the opportunity to re-justify the text too.
Diffstat (limited to 'testing')
-rw-r--r--testing/01-basics.yarn118
-rw-r--r--testing/02-commands-config.yarn10
-rw-r--r--testing/02-commands-git-upload-archive.yarn12
-rw-r--r--testing/02-commands-graveyard.yarn58
-rw-r--r--testing/02-commands-group.yarn4
-rw-r--r--testing/02-commands-help.yarn112
-rw-r--r--testing/02-commands-keyring.yarn8
-rw-r--r--testing/02-commands-ls.yarn18
-rw-r--r--testing/02-commands-rename.yarn62
-rw-r--r--testing/02-commands-rsync.yarn21
-rw-r--r--testing/02-commands-sshkey.yarn59
-rw-r--r--testing/02-commands-user.yarn66
-rw-r--r--testing/02-commands-whoami.yarn22
-rw-r--r--testing/03-cgit-support.yarn2
-rw-r--r--testing/03-shallow-push.yarn18
-rw-r--r--testing/library.yarn290
16 files changed, 463 insertions, 417 deletions
diff --git a/testing/01-basics.yarn b/testing/01-basics.yarn
index 36f0ce5..4384bbe 100644
--- a/testing/01-basics.yarn
+++ b/testing/01-basics.yarn
@@ -15,30 +15,31 @@ we can create a user, give it an ssh key, that the user's creation is reflected
in the `gitano-admin` repository and that we can remove the user and the
removal is also reflected.
- SCENARIO Verification of basic behaviour
-
+ SCENARIO Verification of basic behaviour
+
Step 1 is to create a standard instance and clone `gitano-admin`
- GIVEN a standard instance
- WHEN testinstance, using adminkey, clones gitano-admin as gitano-admin
- THEN testinstance has a clone of gitano-admin
+ GIVEN a standard instance
+ WHEN testinstance, using adminkey, clones gitano-admin as gitano-admin
+ THEN testinstance has a clone of gitano-admin
Next we create the user (alice) and verify that `gitano-admin` shows her.
- GIVEN a unix user called alice
- AND alice has keys called main
- WHEN testinstance, using adminkey, adds user alice, using alice main
- AND git pull happens in testinstance gitano-admin
- THEN testinstance gitano-admin has a file called users/alice/user.conf
- AND testinstance gitano-admin has a file called users/alice/default.key
+ GIVEN a unix user called alice
+ AND alice has keys called main
+ WHEN testinstance, using adminkey, adds user alice, using alice main
+ AND git pull happens in testinstance gitano-admin
+ THEN testinstance gitano-admin has a file called users/alice/user.conf
+ AND testinstance gitano-admin has a file called users/alice/default.key
Finally we remove that user and verify that `gitano-admin` reflects that too.
- WHEN testinstance, using adminkey, deletes user alice
- 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
+ WHEN testinstance, using adminkey, deletes user alice
+ 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
-------------------------------------
@@ -47,21 +48,22 @@ In this scenario we take a standard instance and ensure that the `testinstance`
user can access their user information (their `whoami` output) and that
information lists the `gitano-admin` group which they should be a member of.
- SCENARIO whoami shows the gitano-admin group
+ SCENARIO whoami shows the gitano-admin group
- GIVEN a standard instance
- WHEN testinstance adminkey runs whoami
- THEN stdout contains gitano-admin
+ GIVEN a standard instance
+ WHEN testinstance adminkey runs whoami
+ THEN stdout contains gitano-admin
Then, just to be sure, we create a new user and ensure that it does not have
membership of `gitano-admin`
- GIVEN a unix user called alice
- AND alice has keys called main
- 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
+ GIVEN a unix user called alice
+ AND alice has keys called main
+ 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
--------------------------------------------------------
@@ -70,17 +72,18 @@ In this scenario we take a standard instance, add a user to it, and verify that
when the new user runs 'ls' it doesn't get to see `gitano-admin` but that the
`testinstance` user gets to see it and has `RW` privs.
- SCENARIO ls will not show repositories you have no access to
+ SCENARIO ls will not show repositories you have no access to
- GIVEN a standard instance
- AND a unix user called alice
- AND alice has keys called main
- WHEN testinstance, using adminkey, adds user alice, using alice main
- AND alice main runs ls
- THEN stdout does not contain gitano-admin
- WHEN testinstance adminkey runs ls
- THEN stdout contains RW \ gitano-admin
- FINALLY the instance is torn down
+ GIVEN a standard instance
+ AND a unix user called alice
+ AND alice has keys called main
+ WHEN testinstance, using adminkey, adds user alice, using alice main
+ AND alice main runs ls
+ 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
-------------------------
@@ -89,25 +92,26 @@ In a default configuration, the only user who will be able to create
repositories. However creation can hand off ownership which means that we can
test that a new user who has a repository created for them can see it in ls.
- SCENARIO delegated repository creation works
+ SCENARIO delegated repository creation works
- GIVEN a standard instance
- AND a unix user called alice
- AND alice has keys called main
- WHEN testinstance, using adminkey, adds user alice, using alice main
- AND testinstance adminkey runs create somerepo alice
- AND alice main runs ls
- THEN stdout contains RW \ somerepo
+ GIVEN a standard instance
+ AND a unix user called alice
+ AND alice has keys called main
+ WHEN testinstance, using adminkey, adds user alice, using alice main
+ AND testinstance adminkey runs create somerepo alice
+ AND alice main runs ls
+ THEN stdout contains RW \ somerepo
And just to check, if the `testinstance` user created a non-delegated repo then
the `alice` user cannot see it.
- WHEN testinstance adminkey runs create anotherrepo
- AND testinstance adminkey runs ls
- THEN stdout contains RW \ anotherrepo
- WHEN alice main runs ls
- THEN stdout does not contain anotherrepo
- FINALLY the instance is torn down
+ WHEN testinstance adminkey runs create anotherrepo
+ AND testinstance adminkey runs ls
+ 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,11 +121,13 @@ Normally when using SSH without a command you get a shell,
however this isn't the standard use of SSH,
so when you haven't provided a command you get an error message.
- SCENARIO handling empty commands
- 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
+ SCENARIO handling empty commands
+
+ 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
--------------------
@@ -130,6 +136,7 @@ When the bypass user is used, Gitano should whine strongly in order to
discourage the human doing this.
SCENARIO using bypass warns loudly
+
GIVEN a standard instance
WHEN testinstance bypasskey runs ls
THEN the output contains ALERT
@@ -143,4 +150,5 @@ 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-config.yarn b/testing/02-commands-config.yarn
index 1ffca23..2dbdf21 100644
--- a/testing/02-commands-config.yarn
+++ b/testing/02-commands-config.yarn
@@ -20,7 +20,7 @@ repository when created. `HEAD` is defaulted to `refs/heads/master` but the
owner can be set via the person running the create.
SCENARIO Viewing initial `config` for a repo
-
+
GIVEN a standard instance
WHEN testinstance adminkey runs create testrepo
AND testinstance adminkey runs config testrepo show
@@ -38,7 +38,7 @@ we configure a test repository with a value which is not default and then check
for it.
SCENARIO Configuration changes stick
-
+
GIVEN a standard instance
WHEN testinstance adminkey runs create testrepo
AND testinstance adminkey runs config testrepo set project.head refs/heads/trunk
@@ -69,7 +69,7 @@ when changing configuration, all relevant hook sections are run to update the
outside world.
SCENARIO Changes to `HEAD` and description hit the filesystem
-
+
GIVEN a standard instance
WHEN testinstance adminkey runs create testrepo
AND testinstance adminkey runs config testrepo set project.head refs/heads/trunk
@@ -86,7 +86,7 @@ Clod can contain lists in values. Lists are always one-level and can have
new items appended...
SCENARIO Manipulating list values is possible
-
+
GIVEN a standard instance
WHEN testinstance adminkey runs create testrepo
AND testinstance adminkey runs config testrepo set foo.* hello
@@ -102,7 +102,7 @@ new items appended...
AND testinstance adminkey runs config testrepo show
THEN stderr is empty
AND stdout contains foo.i_1: world
-
+
WHEN testinstance adminkey runs config testrepo rm foo.i_1
AND testinstance adminkey runs config testrepo show
THEN stderr is empty
diff --git a/testing/02-commands-git-upload-archive.yarn b/testing/02-commands-git-upload-archive.yarn
index 797a605..1e3bbd9 100644
--- a/testing/02-commands-git-upload-archive.yarn
+++ b/testing/02-commands-git-upload-archive.yarn
@@ -6,8 +6,10 @@ An appropriately configured git server
can also serve the contents of a git repository directly through git-archive,
which is useful for providing snapshots.
- SCENARIO Performing git-archive operations
- 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
+ SCENARIO Performing git-archive operations
+
+ 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 e5bdb3d..06be518 100644
--- a/testing/02-commands-graveyard.yarn
+++ b/testing/02-commands-graveyard.yarn
@@ -1,44 +1,46 @@
<!-- -*- markdown -*- -->
- SCENARIO graveyard
- GIVEN a standard instance
- AND testinstance using adminkey has patched gitano-admin with personal-repo-create.patch
- AND a unix user called alice
- AND alice has keys called main
- WHEN testinstance, using adminkey, adds user alice, using alice main
- AND alice main runs create personal/alice/testrepo
- AND alice main runs ls
- THEN stdout contains personal/alice/testrepo
- WHEN alice main runs destroy personal/alice/testrepo --force
- AND alice main runs ls
- THEN stdout does not contain personal/alice/testrepo
+ SCENARIO graveyard
+
+ GIVEN a standard instance
+ AND testinstance using adminkey has patched gitano-admin with personal-repo-create.patch
+ AND a unix user called alice
+ AND alice has keys called main
+ WHEN testinstance, using adminkey, adds user alice, using alice main
+ AND alice main runs create personal/alice/testrepo
+ AND alice main runs ls
+ THEN stdout contains personal/alice/testrepo
+ WHEN alice main runs destroy personal/alice/testrepo --force
+ AND alice main runs ls
+ THEN stdout does not contain personal/alice/testrepo
When a repository is deleted it is put in the graveyard.
By default only admin users may browse the graveyard and restore repositories.
- WHEN alice main, expecting failure, runs graveyard list
- THEN stderr contains CRIT: You may not perform site administration
- WHEN testinstance adminkey runs graveyard list
- THEN stdout contains personal.alice.testrepo.*\.destroyed
+ WHEN alice main, expecting failure, runs graveyard list
+ THEN stderr contains CRIT: You may not perform site administration
+ WHEN testinstance adminkey runs graveyard list
+ THEN stdout contains personal.alice.testrepo.*\.destroyed
When a repository is restored it is owned by the original owner.
- WHEN testinstance adminkey restores the latest deletion to personal/alice/testrepo
- AND testinstance adminkey runs config personal/alice/testrepo show project.owner
- THEN stdout contains project\.owner: alice
+ WHEN testinstance adminkey restores the latest deletion to personal/alice/testrepo
+ AND testinstance adminkey runs config personal/alice/testrepo show project.owner
+ THEN stdout contains project\.owner: alice
It is thus fully usable by the user who deleted it.
- WHEN alice main runs ls
- THEN stdout contains personal/alice/testrepo
- WHEN alice main runs config personal/alice/testrepo show project.owner
- THEN stdout contains project\.owner: alice
+ WHEN alice main runs ls
+ THEN stdout contains personal/alice/testrepo
+ WHEN alice main runs config personal/alice/testrepo show project.owner
+ THEN stdout contains project\.owner: alice
Disk space is finite, so when a repository is no longer wanted
then it has to be purged from the graveyard as well.
- WHEN alice main runs destroy personal/alice/testrepo --force
- 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
+ WHEN alice main runs destroy personal/alice/testrepo --force
+ 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 5be6828..6cb6922 100644
--- a/testing/02-commands-group.yarn
+++ b/testing/02-commands-group.yarn
@@ -4,7 +4,9 @@ TODO: Expand this beyond these simple regression checks
=======================================================
SCENARIO group add with slashes causes error
+
GIVEN a standard instance
- WHEN testinstance adminkey, expecting failure, runs group add foo/bar bananas
+ 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 d152a24..65111cb 100644
--- a/testing/02-commands-help.yarn
+++ b/testing/02-commands-help.yarn
@@ -1,57 +1,59 @@
<!-- -*- markdown -*- -->
- SCENARIO help is given
- GIVEN a standard instance
- WHEN testinstance adminkey runs help
- THEN the output is not empty
- WHEN testinstance adminkey runs help admin
- THEN the output is not empty
- WHEN testinstance adminkey runs help all
- THEN the output is not empty
- WHEN testinstance adminkey runs help help
- THEN the output is not empty
- WHEN testinstance adminkey runs help as
- THEN the output is not empty
- WHEN testinstance adminkey runs help config
- THEN the output is not empty
- WHEN testinstance adminkey runs help copy
- THEN the output is not empty
- WHEN testinstance adminkey runs help count-objects
- THEN the output is not empty
- WHEN testinstance adminkey runs help create
- THEN the output is not empty
- WHEN testinstance adminkey runs help destroy
- THEN the output is not empty
- WHEN testinstance adminkey runs help fsck
- THEN the output is not empty
- WHEN testinstance adminkey runs help gc
- THEN the output is not empty
- WHEN testinstance adminkey runs help git-receive-pack
- THEN the output is not empty
- WHEN testinstance adminkey runs help git-upload-archive
- THEN the output is not empty
- WHEN testinstance adminkey runs help git-upload-pack
- THEN the output is not empty
- WHEN testinstance adminkey runs help graveyard
- THEN the output is not empty
- WHEN testinstance adminkey runs help group
- THEN the output is not empty
- WHEN testinstance adminkey runs help keyring
- THEN the output is not empty
- WHEN testinstance adminkey runs help ls
- THEN the output is not empty
- WHEN testinstance adminkey runs help passwd
- THEN the output is not empty
- WHEN testinstance adminkey runs help rename
- THEN the output is not empty
- WHEN testinstance adminkey runs help rsync
- THEN the output is not empty
- WHEN testinstance adminkey runs help sshkey
- THEN the output is not empty
- WHEN testinstance adminkey runs help user
- THEN the output is not empty
- WHEN testinstance adminkey runs help whoami
- THEN the output is not empty
- WHEN testinstance adminkey runs help demo
- THEN the output is not empty
- FINALLY the instance is torn down
+ SCENARIO help is given
+
+ GIVEN a standard instance
+ WHEN testinstance adminkey runs help
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help admin
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help all
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help help
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help as
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help config
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help copy
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help count-objects
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help create
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help destroy
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help fsck
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help gc
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help git-receive-pack
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help git-upload-archive
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help git-upload-pack
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help graveyard
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help group
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help keyring
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help ls
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help passwd
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help rename
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help rsync
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help sshkey
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help user
+ THEN the output is not empty
+ WHEN testinstance adminkey runs help whoami
+ 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 d9ffa11..d0a7f1d 100644
--- a/testing/02-commands-keyring.yarn
+++ b/testing/02-commands-keyring.yarn
@@ -13,16 +13,19 @@ Firstly, we ensure that with a standard instance, there are no keyrings. As
a gitano-admin we have full access to the keyrings by default...
SCENARIO Verify empty keyring set
+
GIVEN a standard instance
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.
SCENARIO Verify keyrings come and go
+
GIVEN a standard instance
WHEN testinstance adminkey runs keyring create jeff
AND testinstance adminkey runs keyring list
@@ -32,6 +35,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
@@ -42,6 +46,7 @@ the fingerprint `32CD66C9C4E07D2D2A48B9D8DAEE518EFD8A5932` and is available
from our test GPG home.
SCENARIO Keyrings can gain and lose keys
+
GIVEN a standard instance
WHEN testinstance adminkey runs keyring create jeff
AND testinstance adminkey runs keyring list
@@ -52,10 +57,11 @@ from our test GPG home.
AND testinstance adminkey runs keyring show jeff
THEN stdout contains 32CD66C9C4E07D2D2A48B9D8DAEE518EFD8A5932
AND stderr is empty
- WHEN testinstance adminkey runs keyring delkey jeff 32CD66C9C4E07D2D2A48B9D8DAEE518EFD8A5932 --force
+ WHEN testinstance adminkey runs keyring delkey jeff 32CD66C9C4E07D2D2A48B9D8DAEE518EFD8A5932 --force
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 2df035f..eda68bc 100644
--- a/testing/02-commands-ls.yarn
+++ b/testing/02-commands-ls.yarn
@@ -14,12 +14,14 @@ Firstly, we verify the basic operation of ls, that as a gitano-admin we have
read access (at least) to everything and as such we can list all the
repositories.
- SCENARIO Basic operation of ls
- GIVEN a standard instance
- WHEN testinstance adminkey runs ls
- THEN stdout contains RW \ gitano-admin
- AND stderr is empty
- FINALLY the instance is torn down
+ SCENARIO Basic operation of ls
+
+ GIVEN a standard instance
+ 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
=============================
@@ -28,6 +30,7 @@ If you have no read or write access to a repository, it should not show up
when you run `ls`.
SCENARIO No access means no show in ls
+
GIVEN a standard instance
AND testinstance has keys called other
WHEN testinstance, using adminkey, adds user other, using testinstance other
@@ -35,6 +38,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
@@ -44,6 +48,7 @@ When a repository is marked as archived, it should not show up when you
run `ls` even if you have access, unless you pass `--all` to the ls command.
SCENARIO Archived repositories do not show in ls
+
GIVEN a standard instance
WHEN testinstance adminkey runs ls
THEN stdout contains gitano-admin
@@ -55,6 +60,7 @@ 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 dcef14a..bf0d922 100644
--- a/testing/02-commands-rename.yarn
+++ b/testing/02-commands-rename.yarn
@@ -1,45 +1,49 @@
<!-- -*- markdown -*- -->
- SCENARIO rename content
- GIVEN a standard instance
- WHEN testinstance adminkey runs copy gitano-admin public/testrepo
- THEN server-side public/testrepo has identical refs to gitano-admin
+ SCENARIO rename content
+
+ GIVEN a standard instance
+ WHEN testinstance adminkey runs copy gitano-admin public/testrepo
+ THEN server-side public/testrepo has identical refs to gitano-admin
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
+ 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
- SCENARIO rename permissions
- GIVEN a standard instance
- AND testinstance using adminkey has patched gitano-admin with personal-repo-create.patch
- GIVEN a unix user called alice
- AND alice has keys called main
- WHEN testinstance, using adminkey, adds user alice, using alice main
+ SCENARIO rename permissions
- WHEN alice main runs create personal/alice/testrepo
- WHEN alice main runs create personal/alice/testrepo2
- AND alice main runs ls
- THEN stdout contains personal/alice/testrepo
- AND stdout contains personal/alice/testrepo2
+ GIVEN a standard instance
+ AND testinstance using adminkey has patched gitano-admin with personal-repo-create.patch
+ GIVEN a unix user called alice
+ AND alice has keys called main
+ WHEN testinstance, using adminkey, adds user alice, using alice main
- WHEN alice main, expecting failure, runs rename personal/alice/testrepo personal/alice/testrepo2
- THEN stderr contains CRIT: Destination location is in use
+ WHEN alice main runs create personal/alice/testrepo
+ WHEN alice main runs create personal/alice/testrepo2
+ AND alice main runs ls
+ THEN stdout contains personal/alice/testrepo
+ AND stdout contains personal/alice/testrepo2
- WHEN alice main, expecting failure, runs rename personal/alice/testrepo3 personal/alice/testrepo4
- THEN stderr contains CRIT: Cannot rename a repository which does not exist
+ WHEN alice main, expecting failure, runs rename personal/alice/testrepo personal/alice/testrepo2
+ THEN stderr contains CRIT: Destination location is in use
+
+ WHEN alice main, expecting failure, runs rename personal/alice/testrepo3 personal/alice/testrepo4
+ THEN stderr contains CRIT: Cannot rename a repository which does not exist
If a user is not permitted to see a repository they can't rename it,
and it does not reveal the existence of the repository.
- WHEN alice main, expecting failure, runs rename personal/alice/testrepo gitano-admin
- THEN stderr contains CRIT: Ruleset denied action.
- AND stderr does not contain CRIT: Destination location is in use
+ WHEN alice main, expecting failure, runs rename personal/alice/testrepo gitano-admin
+ THEN stderr contains CRIT: Ruleset denied action.
+ AND stderr does not contain CRIT: Destination location is in use
+
+ 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
- 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
+ FINALLY the instance is torn down
diff --git a/testing/02-commands-rsync.yarn b/testing/02-commands-rsync.yarn
index c9111b9..c39cb19 100644
--- a/testing/02-commands-rsync.yarn
+++ b/testing/02-commands-rsync.yarn
@@ -5,24 +5,25 @@ rsync - Access per-repository rsync space
Gitano will accept rsync server commands when the rsync plugin is enabled.
- SCENARIO rsync
- ASSUMING rsync is possible
+ SCENARIO rsync
+ ASSUMING rsync is possible
Files may be copied into this space with
`rsync filename gituser@gitanoserver:repository/filename`.
- GIVEN a standard instance
- AND testfile contains foo
- WHEN testinstance adminkey rsync's testfile to gitano-admin.git
+ GIVEN a standard instance
+ AND testfile contains foo
+ WHEN testinstance adminkey rsync's testfile to gitano-admin.git
This copies into the `rsync` directory in the git repository on the server.
- THEN server-side gitano-admin.git file rsync/testfile contains foo
+ THEN server-side gitano-admin.git file rsync/testfile contains foo
Files may be copied back out again as you normally would with rsync
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
+ 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 ed470b6..7fdc73a 100644
--- a/testing/02-commands-sshkey.yarn
+++ b/testing/02-commands-sshkey.yarn
@@ -1,44 +1,46 @@
<!-- -*- markdown -*- -->
- SCENARIO user key management
- GIVEN a standard instance
+ SCENARIO user key management
+
+ GIVEN a standard instance
The key we authenticate with is displayed as part of `whoami`.
- WHEN testinstance adminkey runs whoami
- THEN stdout contains adminkey
+ WHEN testinstance adminkey runs whoami
+ THEN stdout contains adminkey
This information is also shown in `sshkey list`.
- WHEN testinstance adminkey runs sshkey list
- THEN the output contains adminkey
+ WHEN testinstance adminkey runs sshkey list
+ THEN the output contains adminkey
New keys can be added.
- GIVEN testinstance has keys called newkey
- WHEN testinstance uses their ssh public key called newkey as stdin
- AND testinstance adminkey runs sshkey add newkey
- THEN the output contains SSH authorised key file updated
+ GIVEN testinstance has keys called newkey
+ WHEN testinstance uses their ssh public key called newkey as stdin
+ AND testinstance adminkey runs sshkey add newkey
+ THEN the output contains SSH authorised key file updated
We should also be able to add keys with underscores and/or dashes in the tag
name.
- GIVEN testinstance has keys called testkey
- WHEN testinstance uses their ssh public key called testkey as stdin
- AND testinstance adminkey runs sshkey add test-key_
- THEN the output contains SSH authorised key file updated
+ GIVEN testinstance has keys called testkey
+ WHEN testinstance uses their ssh public key called testkey as stdin
+ AND testinstance adminkey runs sshkey add test-key_
+ THEN the output contains SSH authorised key file updated
Verify the new keys are listed for the user.
- WHEN testinstance adminkey runs sshkey list
- THEN the output contains newkey
- AND the output contains test-key_
+ WHEN testinstance adminkey runs sshkey list
+ THEN the output contains newkey
+ AND the output contains test-key_
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
+ WHEN testinstance newkey runs sshkey del adminkey
+ THEN the output contains SSH authorised key file updated
+
+ FINALLY the instance is torn down
@@ -46,24 +48,25 @@ When we interact with gitano through ssh it tracks which key was used,
which is convenient when a user has multiple keys
and it matters which key is being used.
- SCENARIO gitano key awareness
- ASSUMING gitano is being accessed over ssh
- GIVEN a standard instance
+ SCENARIO gitano key awareness
+ ASSUMING gitano is being accessed over ssh
+
+ GIVEN a standard instance
When using the `whoami` and `sshkey list` commands
gitano appends "[*]" to the entry for the key that is in use.
- WHEN testinstance adminkey runs sshkey list
- THEN the output contains adminkey.*\[\*\]$
+ WHEN testinstance adminkey runs sshkey list
+ THEN the output contains adminkey.*\[\*\]$
This is not just informational. Gitano uses this information
to prevent you removing the key that is being used to authenticate
as a protection against accidentally locking yourself out.
- WHEN testinstance adminkey, expecting failure, runs sshkey del adminkey
- THEN stderr contains is in use
+ WHEN testinstance adminkey, expecting failure, runs sshkey del adminkey
+ THEN stderr contains is in use
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
+ FINALLY the instance is torn down
diff --git a/testing/02-commands-user.yarn b/testing/02-commands-user.yarn
index c209228..3ee3beb 100644
--- a/testing/02-commands-user.yarn
+++ b/testing/02-commands-user.yarn
@@ -1,63 +1,67 @@
<!-- -*- markdown -*- -->
- SCENARIO user management
- GIVEN a standard instance
+ SCENARIO user management
+
+ GIVEN a standard instance
By default, normal users may not create users.
- GIVEN a unix user called alice
- AND alice has keys called main
- WHEN testinstance, using adminkey, adds user alice, using alice main
- AND alice main, expecting failure, runs user add bob bob@testinstance Bob Bobertson
- THEN stderr contains CRIT: You may not perform site administration
+ GIVEN a unix user called alice
+ AND alice has keys called main
+ WHEN testinstance, using adminkey, adds user alice, using alice main
+ AND alice main, expecting failure, runs user add bob bob@testinstance Bob Bobertson
+ THEN stderr contains CRIT: You may not perform site administration
Privileged users may create other users though.
- WHEN testinstance adminkey runs user add bob bob@testinstance Bob Bobertson
- AND testinstance adminkey runs user list
- THEN stdout contains ^bob
+ WHEN testinstance adminkey runs user add bob bob@testinstance Bob Bobertson
+ AND testinstance adminkey runs user list
+ THEN stdout contains ^bob
The e-mail address and real name provided in the create command are also listed.
- AND stdout contains ^bob.*bob@testinstance
- AND stdout contains ^bob.*Bob Bobertson
+ THEN stdout contains ^bob.*bob@testinstance
+ AND stdout contains ^bob.*Bob Bobertson
The e-mail address can be changed,
which is handy for if the user changes e-mail provider.
- WHEN testinstance adminkey runs user email bob bob@example.com
- AND testinstance adminkey runs user list
- THEN stdout contains ^bob.*bob@example.com
+ WHEN testinstance adminkey runs user email bob bob@example.com
+ AND testinstance adminkey runs user list
+ THEN stdout contains ^bob.*bob@example.com
A user's real name may also be changed.
- WHEN testinstance adminkey runs user name bob Robert Robertson
- AND testinstance adminkey runs user list
- THEN stdout contains ^bob.*Robert Robertson
+ WHEN testinstance adminkey runs user name bob Robert Robertson
+ AND testinstance adminkey runs user list
+ THEN stdout contains ^bob.*Robert Robertson
Privileged users may also rename other users.
- WHEN testinstance adminkey runs user rename bob robert --force
- THEN the output contains SSH authorised key file updated
- AND the output contains Committed: Rename user bob to robert
- WHEN testinstance adminkey runs user list
- THEN stdout contains ^robert
- THEN stdout does not contain ^bob
+ WHEN testinstance adminkey runs user rename bob robert --force
+ THEN the output contains SSH authorised key file updated
+ AND the output contains Committed: Rename user bob to robert
+ WHEN testinstance adminkey runs user list
+ THEN stdout contains ^robert
+ THEN stdout does not contain ^bob
Privileged users may delete other users.
- WHEN testinstance adminkey runs user del robert --force
- THEN the output contains SSH authorised key file updated
- 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
+ WHEN testinstance adminkey runs user del robert --force
+ THEN the output contains SSH authorised key file updated
+ 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
=================
SCENARIO user add with slashes causes error
+
GIVEN a standard instance
- WHEN testinstance adminkey, expecting failure, runs user add foo/bar foo@bar bananas
+ 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 beb5dd4..8e06c39 100644
--- a/testing/02-commands-whoami.yarn
+++ b/testing/02-commands-whoami.yarn
@@ -1,13 +1,15 @@
<!-- -*- markdown -*- -->
- SCENARIO user introspection
- GIVEN a standard instance
- AND a unix user called alice
- AND alice has keys called main
- WHEN testinstance, using adminkey, adds user alice, using alice main
- AND alice main runs whoami
- 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
+ SCENARIO user introspection
+
+ GIVEN a standard instance
+ AND a unix user called alice
+ AND alice has keys called main
+ WHEN testinstance, using adminkey, adds user alice, using alice main
+ AND alice main runs whoami
+ 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 ade8d76..e9a33d8 100644
--- a/testing/03-cgit-support.yarn
+++ b/testing/03-cgit-support.yarn
@@ -12,7 +12,9 @@ we test that Gitano produces the right config,
rather than starting a CGit instance and inspecting its UI.
SCENARIO Gitano configures CGit to hide archived repositories
+
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 8df9468..dc029bd 100644
--- a/testing/03-shallow-push.yarn
+++ b/testing/03-shallow-push.yarn
@@ -3,18 +3,20 @@
Pushing from shallow clones
===========================
- SCENARIO Pushing shallow history
- GIVEN a standard instance
- WHEN testinstance, using adminkey, clones gitano-admin.git as local-shallow with depth 1
+ SCENARIO Pushing shallow history
+
+ GIVEN a standard instance
+ WHEN testinstance, using adminkey, clones gitano-admin.git as local-shallow with depth 1
To push you need to set `git.receive.shallowUpdate=true`
after the repository is created.
- WHEN testinstance adminkey runs create remote-shallow.git
- AND testinstance adminkey runs config remote-shallow.git set git.receive.shallowUpdate true
+ WHEN testinstance adminkey runs create remote-shallow.git
+ AND testinstance adminkey runs config remote-shallow.git set git.receive.shallowUpdate true
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
+ 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/library.yarn b/testing/library.yarn
index 253202c..03971cf 100644
--- a/testing/library.yarn
+++ b/testing/library.yarn
@@ -17,92 +17,92 @@ comes to cloning, pushing, etc.
Managing the fake unix users
----------------------------
- IMPLEMENTS GIVEN a unix user called ([a-z][a-z0-9]*)
- $GTT createunixuser $MATCH_1
+ IMPLEMENTS GIVEN a unix user called ([a-z][a-z0-9]*)
+ $GTT createunixuser $MATCH_1
- IMPLEMENTS GIVEN ([a-z][a-z0-9]*) has keys called ([a-z][a-z0-9]*)
- $GTT createsshkey $MATCH_1 $MATCH_2
+ IMPLEMENTS GIVEN ([a-z][a-z0-9]*) has keys called ([a-z][a-z0-9]*)
+ $GTT createsshkey $MATCH_1 $MATCH_2
- IMPLEMENTS WHEN ([a-z][a-z0-9]*) uses their ssh public key called ([a-z][a-z0-9]*) as stdin
- cp "$DATADIR/user-home-$MATCH_1/.ssh/$MATCH_2.pub" "$DATADIR/stdin"
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*) uses their ssh public key called ([a-z][a-z0-9]*) as stdin
+ cp "$DATADIR/user-home-$MATCH_1/.ssh/$MATCH_2.pub" "$DATADIR/stdin"
General instance management
---------------------------
- IMPLEMENTS GIVEN a standard instance
- $GTT createunixuser testinstance
- $GTT createsshkey testinstance adminkey
- $GTT createsshkey testinstance bypasskey
- $GTT setupstandard testinstance adminkey bypasskey
- if [ "$GTT_PROTO" = http ]; then
- printf "%s" admin | GTT_PROTO=ssh $GTT runcommand \
- testinstance adminkey as admin passwd \
- >> $DATADIR/stdout 2>> $DATADIR/stderr
- printf "%s" gitano-bypass | GTT_PROTO=ssh $GTT runcommand \
- testinstance bypasskey as gitano-bypass passwd \
- >> $DATADIR/stdout 2>> $DATADIR/stderr
- fi
-
- IMPLEMENTS FINALLY the instance is torn down
- $GTT teardownstandard
+ IMPLEMENTS GIVEN a standard instance
+ $GTT createunixuser testinstance
+ $GTT createsshkey testinstance adminkey
+ $GTT createsshkey testinstance bypasskey
+ $GTT setupstandard testinstance adminkey bypasskey
+ if [ "$GTT_PROTO" = http ]; then
+ printf "%s" admin | GTT_PROTO=ssh $GTT runcommand \
+ testinstance adminkey as admin passwd \
+ >> $DATADIR/stdout 2>> $DATADIR/stderr
+ printf "%s" gitano-bypass | GTT_PROTO=ssh $GTT runcommand \
+ testinstance bypasskey as gitano-bypass passwd \
+ >> $DATADIR/stdout 2>> $DATADIR/stderr
+ fi
+
+ IMPLEMENTS FINALLY the instance is torn down
+ $GTT teardownstandard
Repository access
-----------------
- IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? clones ([^ ]+) as ([^ ]+)( with depth (\d+))?
- $GTT clone $MATCH_1 $MATCH_2 "$MATCH_3" "$MATCH_4" ${MATCH_5:+ --no-local --depth="$MATCH_6"} \
- >$DATADIR/stdout 2>$DATADIR/stderr
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? clones ([^ ]+) as ([^ ]+)( with depth (\d+))?
+ $GTT clone $MATCH_1 $MATCH_2 "$MATCH_3" "$MATCH_4" ${MATCH_5:+ --no-local --depth="$MATCH_6"} \
+ >$DATADIR/stdout 2>$DATADIR/stderr
- IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? pushes ([^ ]+) to ([^ ]+)
- $GTT push $MATCH_1 $MATCH_2 "$MATCH_3" "$MATCH_4"
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? pushes ([^ ]+) to ([^ ]+)
+ $GTT push $MATCH_1 $MATCH_2 "$MATCH_3" "$MATCH_4"
- IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? (expecting failure,? )?destroys ([^ ]+) using the (.+) token
- if $GTT runcommand $MATCH_1 $MATCH_2 \
- destroy $MATCH_4 "$(cat "$DATADIR/saved-tokens/$MATCH_5")" \
- >$DATADIR/stdout 2>$DATADIR/stderr; then
- test "$MATCH_3" = ""
- fi
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? (expecting failure,? )?destroys ([^ ]+) using the (.+) token
+ if $GTT runcommand $MATCH_1 $MATCH_2 \
+ destroy $MATCH_4 "$(cat "$DATADIR/saved-tokens/$MATCH_5")" \
+ >$DATADIR/stdout 2>$DATADIR/stderr; then
+ test "$MATCH_3" = ""
+ fi
Server-side repository checking for behind-the-scenes work
----------------------------------------------------------
- IMPLEMENTS THEN server-side ([^ ]+) file ([^ ]+) contains (.+)
- cd "$($GTT serverlocation $MATCH_1)"
- grep -q "$MATCH_3" "$MATCH_2"
+ IMPLEMENTS THEN server-side ([^ ]+) file ([^ ]+) contains (.+)
+ cd "$($GTT serverlocation $MATCH_1)"
+ grep -q "$MATCH_3" "$MATCH_2"
- IMPLEMENTS THEN server-side ([^ ]+) file ([^ ]+) exists
- cd "$($GTT serverlocation $MATCH_1)"
- test -e "$MATCH_2"
-
- IMPLEMENTS THEN server-side ([^ ]+) has identical refs to ([^ ]+)
- bash -c 'diff -u <(git ls-remote -ht "$($GTT serverlocation "$MATCH_1")" | sort -k2) <(git ls-remote -ht "$($GTT serverlocation "$MATCH_2")" | sort -k2)'
+ IMPLEMENTS THEN server-side ([^ ]+) file ([^ ]+) exists
+ cd "$($GTT serverlocation $MATCH_1)"
+ test -e "$MATCH_2"
- IMPLEMENTS THEN server-side ([^ ]+) has no missing objects
- cd "$($GTT serverlocation $MATCH_1)".git
- git fsck
+ IMPLEMENTS THEN server-side ([^ ]+) has identical refs to ([^ ]+)
+ bash -c 'diff -u <(git ls-remote -ht "$($GTT serverlocation "$MATCH_1")" | sort -k2) <(git ls-remote -ht "$($GTT serverlocation "$MATCH_2")" | sort -k2)'
+
+ IMPLEMENTS THEN server-side ([^ ]+) has no missing objects
+ cd "$($GTT serverlocation $MATCH_1)".git
+ git fsck
Clone manipulation
------------------
- IMPLEMENTS THEN ([a-z][a-z0-9]*) has a clone of ([^ ]+)
- $GTT cloneexists $MATCH_1 "$MATCH_2"
+ IMPLEMENTS THEN ([a-z][a-z0-9]*) has a clone of ([^ ]+)
+ $GTT cloneexists $MATCH_1 "$MATCH_2"
- IMPLEMENTS WHEN git pull happens in ([a-z][a-z0-9]*) ([^ ]+)
- cd "$($GTT clonelocation $MATCH_1 "$MATCH_2")"
- git pull
+ IMPLEMENTS WHEN git pull happens in ([a-z][a-z0-9]*) ([^ ]+)
+ cd "$($GTT clonelocation $MATCH_1 "$MATCH_2")"
+ git pull
- IMPLEMENTS THEN ([a-z][a-z0-9]*) ([^ ]+) has a file called (.+)
- cd "$($GTT clonelocation $MATCH_1 "$MATCH_2")"
- test -r "$MATCH_3"
+ IMPLEMENTS THEN ([a-z][a-z0-9]*) ([^ ]+) has a file called (.+)
+ cd "$($GTT clonelocation $MATCH_1 "$MATCH_2")"
+ test -r "$MATCH_3"
- IMPLEMENTS THEN ([a-z][a-z0-9]*) ([^ ]+) has no file called (.+)
- set -x
- cd "$($GTT clonelocation $MATCH_1 "$MATCH_2")"
- if test -r "$MATCH_3"; then false; else true; fi
+ IMPLEMENTS THEN ([a-z][a-z0-9]*) ([^ ]+) has no file called (.+)
+ set -x
+ cd "$($GTT clonelocation $MATCH_1 "$MATCH_2")"
+ if test -r "$MATCH_3"; then false; else true; fi
- IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) uses git archive to extract the tree of ([a-z][a-z0-9-]*) ([a-z][a-z0-9]*) to ([a-z][a-z0-9]*)
- mkdir -p "$DATADIR/$MATCH_5"
- $GTT gitarchive $MATCH_1 $MATCH_2 $MATCH_3 $MATCH_4 | tar -C "$DATADIR/$MATCH_5" -x
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) uses git archive to extract the tree of ([a-z][a-z0-9-]*) ([a-z][a-z0-9]*) to ([a-z][a-z0-9]*)
+ mkdir -p "$DATADIR/$MATCH_5"
+ $GTT gitarchive $MATCH_1 $MATCH_2 $MATCH_3 $MATCH_4 | tar -C "$DATADIR/$MATCH_5" -x
rsync manipulation
------------------
@@ -110,127 +110,127 @@ rsync manipulation
IMPLEMENTS ASSUMING rsync is possible
test "x$GTT_PROTO" = "xssh"
- IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) rsync'?s (.*) to (.*)
- rsync -I --rsh="$GTT rsh $MATCH_1 $MATCH_2" "$DATADIR/$MATCH_3" "dummy:$MATCH_4/$MATCH_3"
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) rsync'?s (.*) to (.*)
+ rsync -I --rsh="$GTT rsh $MATCH_1 $MATCH_2" "$DATADIR/$MATCH_3" "dummy:$MATCH_4/$MATCH_3"
- IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) rsync'?s (.*) from (.*)
- rsync -I --rsh="$GTT rsh $MATCH_1 $MATCH_2" "dummy:$MATCH_4/$MATCH_3" "$DATADIR/$MATCH_3"
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) rsync'?s (.*) from (.*)
+ rsync -I --rsh="$GTT rsh $MATCH_1 $MATCH_2" "dummy:$MATCH_4/$MATCH_3" "$DATADIR/$MATCH_3"
Admin repo manipulation
-----------------------
- IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? adds user ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*) ([a-z][a-z0-9]*)
- $GTT runcommand $MATCH_1 $MATCH_2 \
- user add $MATCH_3 $MATCH_3@testinstance "$MATCH_3's real name" > $DATADIR/stdout 2> $DATADIR/stderr
- $GTT runcommand $MATCH_1 $MATCH_2 \
- as $MATCH_3 sshkey add default < \
- $($GTT pubkeyfilename $MATCH_4 $MATCH_5) >> $DATADIR/stdout 2>> $DATADIR/stderr
- if [ "$GTT_PROTO" = http ]; then
- printf "%s" "$MATCH_3" | GTT_PROTO=ssh $GTT runcommand \
- $MATCH_1 $MATCH_2 as $MATCH_3 passwd \
- >> $DATADIR/stdout 2>> $DATADIR/stderr
- fi
-
- IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? deletes user ([a-z][a-z0-9]*)
- TOKEN=$($GTT runcommand $MATCH_1 $MATCH_2 user del $MATCH_3 2>&1 | $GTT findtoken)
- $GTT runcommand $MATCH_1 $MATCH_2 user del $MATCH_3 $TOKEN
-
- IMPLEMENTS GIVEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? has patched gitano-admin with ([^ ]+)
- $GTT clone $MATCH_1 $MATCH_2 gitano-admin.git tmp-adminpatch
- $GTT rungit $MATCH_1 tmp-adminpatch apply --cached - <"testing/admin-patches/$MATCH_3"
- $GTT rungit $MATCH_1 tmp-adminpatch commit --allow-empty -m "Apply $MATCH_3 rules change"
- $GTT push $MATCH_1 $MATCH_2 tmp-adminpatch gitano-admin.git
- rm -r "$($GTT clonelocation $MATCH_1 tmp-adminpatch)"
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? adds user ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*) ([a-z][a-z0-9]*)
+ $GTT runcommand $MATCH_1 $MATCH_2 \
+ user add $MATCH_3 $MATCH_3@testinstance "$MATCH_3's real name" > $DATADIR/stdout 2> $DATADIR/stderr
+ $GTT runcommand $MATCH_1 $MATCH_2 \
+ as $MATCH_3 sshkey add default < \
+ $($GTT pubkeyfilename $MATCH_4 $MATCH_5) >> $DATADIR/stdout 2>> $DATADIR/stderr
+ if [ "$GTT_PROTO" = http ]; then
+ printf "%s" "$MATCH_3" | GTT_PROTO=ssh $GTT runcommand \
+ $MATCH_1 $MATCH_2 as $MATCH_3 passwd \
+ >> $DATADIR/stdout 2>> $DATADIR/stderr
+ fi
+
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? deletes user ([a-z][a-z0-9]*)
+ TOKEN=$($GTT runcommand $MATCH_1 $MATCH_2 user del $MATCH_3 2>&1 | $GTT findtoken)
+ $GTT runcommand $MATCH_1 $MATCH_2 user del $MATCH_3 $TOKEN
+
+ IMPLEMENTS GIVEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? has patched gitano-admin with ([^ ]+)
+ $GTT clone $MATCH_1 $MATCH_2 gitano-admin.git tmp-adminpatch
+ $GTT rungit $MATCH_1 tmp-adminpatch apply --cached - <"testing/admin-patches/$MATCH_3"
+ $GTT rungit $MATCH_1 tmp-adminpatch commit --allow-empty -m "Apply $MATCH_3 rules change"
+ $GTT push $MATCH_1 $MATCH_2 tmp-adminpatch gitano-admin.git
+ rm -r "$($GTT clonelocation $MATCH_1 tmp-adminpatch)"
IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? pushes an empty commit in ([^ ]+)
$GTT rungit $MATCH_1 $MATCH_3 commit --allow-empty -m "Make an empty commit"
- $GTT push $MATCH_1 $MATCH_2 $MATCH_3 gitano-admin.git > $DATADIR/stdout 2>$DATADIR/stderr
+ $GTT push $MATCH_1 $MATCH_2 $MATCH_3 gitano-admin.git > $DATADIR/stdout 2>$DATADIR/stderr
Specific commands
-----------------
- IMPLEMENTS GIVEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) has copied ([^ ]+) to ([^ ]+)
- $GTT runcommand $MATCH_1 $MATCH_2 copy $MATCH_3 $MATCH_4
+ IMPLEMENTS GIVEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) has copied ([^ ]+) to ([^ ]+)
+ $GTT runcommand $MATCH_1 $MATCH_2 copy $MATCH_3 $MATCH_4
- IMPLEMENTS GIVEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) has set the owner of ([^ ]+) to ([a-z][a-z0-9]*)
- $GTT runcommand $MATCH_1 $MATCH_2 config $MATCH_3 set project.owner $MATCH_4
+ IMPLEMENTS GIVEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) has set the owner of ([^ ]+) to ([a-z][a-z0-9]*)
+ $GTT runcommand $MATCH_1 $MATCH_2 config $MATCH_3 set project.owner $MATCH_4
- IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) restores the latest deletion to (.+)
- $GTT runcommand $MATCH_1 $MATCH_2 graveyard list >$DATADIR/stdout 2>$DATADIR/stderr
- reponame="$(head -n1 $DATADIR/stdout | cut -d' ' -f2)"
- $GTT runcommand $MATCH_1 $MATCH_2 graveyard restore "$reponame" "$MATCH_3"
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) restores the latest deletion to (.+)
+ $GTT runcommand $MATCH_1 $MATCH_2 graveyard list >$DATADIR/stdout 2>$DATADIR/stderr
+ reponame="$(head -n1 $DATADIR/stdout | cut -d' ' -f2)"
+ $GTT runcommand $MATCH_1 $MATCH_2 graveyard restore "$reponame" "$MATCH_3"
- IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) purges the latest deletion
- $GTT runcommand $MATCH_1 $MATCH_2 graveyard list >$DATADIR/stdout 2>$DATADIR/stderr
- reponame="$(head -n1 $DATADIR/stderr | cut -d' ' -f2)"
- $GTT runcommand $MATCH_1 $MATCH_2 graveyard purge "$reponame"
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) purges the latest deletion
+ $GTT runcommand $MATCH_1 $MATCH_2 graveyard list >$DATADIR/stdout 2>$DATADIR/stderr
+ reponame="$(head -n1 $DATADIR/stderr | cut -d' ' -f2)"
+ $GTT runcommand $MATCH_1 $MATCH_2 graveyard purge "$reponame"
Generic utility methods
-----------------------
- IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) runs ?(.*)
- if ! test -e $DATADIR/stdin; then touch $DATADIR/stdin; fi
- $GTT runcommand $MATCH_1 $MATCH_2 $MATCH_3 < $DATADIR/stdin > $DATADIR/stdout 2> $DATADIR/stderr
- rm -f $DATADIR/stdin
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) runs ?(.*)
+ if ! test -e $DATADIR/stdin; then touch $DATADIR/stdin; fi
+ $GTT runcommand $MATCH_1 $MATCH_2 $MATCH_3 < $DATADIR/stdin > $DATADIR/stdout 2> $DATADIR/stderr
+ rm -f $DATADIR/stdin
- IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*),? expecting failure,? runs ?(.*)
- if ! test -e $DATADIR/stdin; then touch $DATADIR/stdin; fi
- if $GTT runcommand $MATCH_1 $MATCH_2 $MATCH_3 > $DATADIR/stdout 2> $DATADIR/stderr; then
- false
- fi
- rm -f $DATADIR/stdin
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*),? expecting failure,? runs ?(.*)
+ if ! test -e $DATADIR/stdin; then touch $DATADIR/stdin; fi
+ if $GTT runcommand $MATCH_1 $MATCH_2 $MATCH_3 > $DATADIR/stdout 2> $DATADIR/stderr; then
+ false
+ fi
+ rm -f $DATADIR/stdin
- IMPLEMENTS GIVEN ([^ ]+) contains (.+)
- printf %s "$MATCH_2" >"$DATADIR/$MATCH_1"
+ IMPLEMENTS GIVEN ([^ ]+) contains (.+)
+ printf %s "$MATCH_2" >"$DATADIR/$MATCH_1"
- IMPLEMENTS THEN ([^ ]+) contains (.+)
- grep -q "$MATCH_2" $DATADIR/"$MATCH_1"
+ IMPLEMENTS THEN ([^ ]+) contains (.+)
+ grep -q "$MATCH_2" $DATADIR/"$MATCH_1"
IMPLEMENTS THEN the output contains (.+)
- grep -q "$MATCH_1" $DATADIR/stdout $DATADIR/stderr
+ grep -q "$MATCH_1" $DATADIR/stdout $DATADIR/stderr
- IMPLEMENTS THEN ([^ ]+) does not contain (.+)
- if grep -q "$MATCH_2" $DATADIR/"$MATCH_1"; then false; else true; fi
+ IMPLEMENTS THEN ([^ ]+) does not contain (.+)
+ if grep -q "$MATCH_2" $DATADIR/"$MATCH_1"; then false; else true; fi
IMPLEMENTS THEN the output does not contain (.+)
- if grep -q "$MATCH_1" $DATADIR/stdout $DATADIR/stderr; then false; else true; fi
+ if grep -q "$MATCH_1" $DATADIR/stdout $DATADIR/stderr; then false; else true; fi
- IMPLEMENTS THEN ([^ ]+) is empty
- if grep -q . $DATADIR/"$MATCH_1"; then false; fi
+ IMPLEMENTS THEN ([^ ]+) is empty
+ if grep -q . $DATADIR/"$MATCH_1"; then false; fi
- IMPLEMENTS THEN ([^ ]+) is not empty
- grep -q . $DATADIR/"$MATCH_1"
+ IMPLEMENTS THEN ([^ ]+) is not empty
+ grep -q . $DATADIR/"$MATCH_1"
- IMPLEMENTS THEN the output is empty
- if grep -q . $DATADIR/stdout $DATADIR/stderr; then false; else true; fi
+ IMPLEMENTS THEN the output is empty
+ if grep -q . $DATADIR/stdout $DATADIR/stderr; then false; else true; fi
- IMPLEMENTS THEN the output is not empty
- grep -q . $DATADIR/stdout $DATADIR/stderr
+ IMPLEMENTS THEN the output is not empty
+ grep -q . $DATADIR/stdout $DATADIR/stderr
- IMPLEMENTS GIVEN the token is saved as (.+)
- mkdir -p "$DATADIR/saved-tokens"
- cat "$DATADIR/stdout" "$DATADIR/stderr" | $GTT findtoken >"$DATADIR/saved-tokens/$MATCH_1"
+ IMPLEMENTS GIVEN the token is saved as (.+)
+ mkdir -p "$DATADIR/saved-tokens"
+ cat "$DATADIR/stdout" "$DATADIR/stderr" | $GTT findtoken >"$DATADIR/saved-tokens/$MATCH_1"
- IMPLEMENTS THEN failure ensues
- cd $DATADIR
- echo "FIND:"
- find .
- echo "KEYS:"
- cat user-home-testinstance/.ssh/authorized_keys
- echo "OUT":
- if test -r stdout; then cat stdout; fi
- echo "ERR":
- if test -r stderr; then cat stderr; fi
- echo "LASTPROG:"
- cat last-program
- /bin/false
+ IMPLEMENTS THEN failure ensues
+ cd $DATADIR
+ echo "FIND:"
+ find .
+ echo "KEYS:"
+ cat user-home-testinstance/.ssh/authorized_keys
+ echo "OUT":
+ if test -r stdout; then cat stdout; fi
+ echo "ERR":
+ if test -r stderr; then cat stderr; fi
+ echo "LASTPROG:"
+ cat last-program
+ /bin/false
- IMPLEMENTS ASSUMING gitano is being accessed over ([^ ]+)
- test "$GTT_PROTO" = "$MATCH_1"
+ IMPLEMENTS ASSUMING gitano is being accessed over ([^ ]+)
+ test "$GTT_PROTO" = "$MATCH_1"
GPG Keyring related helpers
---------------------------
- IMPLEMENTS GIVEN gpg key ([0-9A-Fa-f]+) on stdin
- $GTT gpg --armor --export $MATCH_1 > $DATADIR/stdin
+ IMPLEMENTS GIVEN gpg key ([0-9A-Fa-f]+) on stdin
+ $GTT gpg --armor --export $MATCH_1 > $DATADIR/stdin