diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-07-11 00:28:17 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-07-11 14:24:13 +0100 |
commit | ff142bf101bd67db5414ab613787812f9ba99d8c (patch) | |
tree | ca6a2623f1eb8592167403221a0dea65bfb60061 /tests/tests/mirror | |
parent | 7de3df349f56e05723b3eeb7972aaea4d9fc1000 (diff) |
Mirroring: Tests: Run some tests
Diffstat (limited to 'tests/tests/mirror')
-rwxr-xr-x | tests/tests/mirror | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/tests/tests/mirror b/tests/tests/mirror new file mode 100755 index 0000000..874120e --- /dev/null +++ b/tests/tests/mirror @@ -0,0 +1,105 @@ +#!/bin/bash +set -e +. tests/lib + +t-drs + +: ---- "setup up the mirror hook in a basic way" ---- + +reposmirror=$tmp/git-mirror +queuedir=$tmp/git/_mirror-queue +mkdir $reposmirror + +mhook=$drs_dispatch/mirror-hook +ln -sf ${DGIT_INFRA_PFX}dgit-mirror-rsync $mhook +mhook () { + "$mhook" "$drs_dispatch" "$@" +} + +>$drs_dispatch/mirror-settings +mset () { echo >>$drs_dispatch/mirror-settings "$1"; } + +mset remoterepos="$reposmirror" + +check-mirrored () { + t-reporefs master + t-reporefs mirror $pmirror + diff $tmp/show-refs.{master,mirror} + cat $queuedir/$p.log + t-files-notexist $queuedir/$p.{n,a,lock,err} +} + +check-not-mirrored () { + # uses previous t-reporefs-master + t-reporefs mirror $pmirror + diff $tmp/show-refs.{master,mirror} +} + +: ---- "basic test" ---- + +t-tstunt-parsechangelog +t-prep-newpackage example 1.0 + +pmirror=$reposmirror/$p.git +mhook setup + +cd $p +revision=1 +t-dgit build +t-dgit push --new + +check-mirrored + + +: ---- "stunt ssh test" ---- + +sentinel=$tmp/stunt-ssh-sentinel + +cat <<END >$tmp/stunt-ssh +#!/bin/sh +set -ex +: $sentinel +cat >&2 $sentinel +shift # eat HOST +sh -c "\$*" +: ${sentinel}2 +date >${sentinel}2 +END +chmod +x $tmp/stunt-ssh + +mset rsyncssh=$tmp/stunt-ssh +mset remoterepos=HOST:$reposmirror + +t-commit "stunt ssh test" +t-dgit build +t-dgit push --new +# ^ mirror should fail due to lack of stunt-ssh-sentinel + +ls -al $queuedir/$p.a +check-not-mirrored + +touch $sentinel + +mhook backlog +check-mirrored + +: ----- "stall timeout test" ----- + +rm -f $sentinel ${sentinel}2 +mkfifo $sentinel ${sentinel}2 + +mset hooktimeout=5 + +t-commit "stall timeout test" +t-dgit build +t-dgit push --new + +check-not-mirrored + +exec 3<>$sentinel +exec 3>&- +cat ${sentinel}2 + +check-mirrored + +echo done. |