diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2015-12-04 16:07:16 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2015-12-04 16:07:16 +0000 |
commit | 3789d955ef6f3d752f93db610a7de2c33851863b (patch) | |
tree | b556e9584c61882e75d8dcca4acf6d96c10ab559 | |
parent | 0d484da0bd746eb79e608ad1e8cde056d7f89d65 (diff) | |
download | gitano-3789d955ef6f3d752f93db610a7de2c33851863b.tar.bz2 |
testing: Add tests for rsync plugin
It's an interesting plugin,
that may not hang around since its intended user disappeared.
It has some value as an example of gitano extensibility,
but not sufficient to rewrite it if it becomes broken.
However we won't know when it becomes broken and a candidate for removal
unless we test it regularly.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | testing/02-commands-rsync.yarn | 26 | ||||
-rw-r--r-- | testing/gitano-test-tool.in | 4 | ||||
-rw-r--r-- | testing/library.yarn | 12 |
4 files changed, 43 insertions, 1 deletions
@@ -34,7 +34,7 @@ TESTS := 01-basics 02-commands-as 02-commands-config 02-commands-copy \ 02-commands-count-objects 02-commands-create 02-commands-destroy \ 02-commands-fsck 02-commands-gc 02-commands-graveyard \ 02-commands-git-upload-archive 02-commands-group 02-commands-help \ - 02-commands-ls 02-commands-readme 02-commands-rename \ + 02-commands-ls 02-commands-readme 02-commands-rename 02-commands-rsync \ 02-commands-sshkey 02-commands-user 02-commands-whoami 03-cgit-support diff --git a/testing/02-commands-rsync.yarn b/testing/02-commands-rsync.yarn new file mode 100644 index 0000000..83ee30c --- /dev/null +++ b/testing/02-commands-rsync.yarn @@ -0,0 +1,26 @@ +<!-- -*- markdown -*- --> + +rsync - Access per-repository rsync space +========================================= + +Gitano will accept rsync server commands when the rsync plugin is enabled. + + SCENARIO rsync + +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 + +This copies into the `rsync` directory in the git repository on the server. + + 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 diff --git a/testing/gitano-test-tool.in b/testing/gitano-test-tool.in index 3fc6599..8ed7546 100644 --- a/testing/gitano-test-tool.in +++ b/testing/gitano-test-tool.in @@ -187,6 +187,10 @@ function cmd_runcommand(user, key, ...) run_program(cmdline) end +function cmd_rsh(user, key, dummy, ...) + return cmd_runcommand(user, key, ...) +end + function cmd_clonelocation(user, localname) print(user_home(user) .. "/" .. localname) end diff --git a/testing/library.yarn b/testing/library.yarn index edd659b..bda2aa5 100644 --- a/testing/library.yarn +++ b/testing/library.yarn @@ -68,6 +68,15 @@ Clone manipulation mkdir -p "$DATADIR/$MATCH_5" $GTT gitarchive $MATCH_1 $MATCH_2 $MATCH_3 $MATCH_4 | tar -C "$DATADIR/$MATCH_5" -x +rsync manipulation +------------------ + + 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" + Admin repo manipulation ----------------------- @@ -93,6 +102,9 @@ Generic utility methods false fi + IMPLEMENTS GIVEN ([^ ]+) contains (.+) + printf %s "$MATCH_2" >"$DATADIR/$MATCH_1" + IMPLEMENTS THEN ([^ ]+) contains (.+) grep -q "$MATCH_2" $DATADIR/"$MATCH_1" |