chiark / gitweb /
test suite: lib-gdr: Break out t-gdr-prep-new-upstream
[dgit.git] / tests / tests / mirror
1 #!/bin/bash
2 set -e
3 . tests/lib
4 . $troot/lib-mirror
5
6 t-dependencies rsync
7
8 t-drs
9
10 : ---- "basic test" ----
11
12 t-tstunt-parsechangelog
13 t-prep-newpackage example 1.0
14
15 t-mirror-setup
16
17 cd $p
18 revision=1
19 t-dgit build
20 t-dgit push --new
21
22 t-check-mirrored
23
24 : ---- "stunt ssh test" ----
25
26 sentinel=$tmp/stunt-ssh-sentinel
27
28 cat <<END >$tmp/stunt-ssh
29 #!/bin/sh
30 set -ex
31 : $sentinel
32 cat >&2 $sentinel
33 shift # eat HOST
34 sh -c "\$*"
35 END
36 chmod +x $tmp/stunt-ssh
37
38 t-mirror-set rsyncssh=$tmp/stunt-ssh
39 t-mirror-set remoterepos=HOST:$reposmirror
40
41 # mirror should fail due to lack of stunt-ssh-sentinel
42
43 t-commit-build-push-expect-log "stunt ssh test" \
44         E:'mirror hook failed: .*exited'
45
46 ls -al $queuedir/$p.a
47 t-check-not-mirrored
48
49 touch $sentinel
50
51 t-mirror-hook backlog
52 t-check-mirrored
53
54 : ----- "stall timeout test" -----
55
56 rm -f $sentinel
57 mkfifo $sentinel
58
59 t-mirror-set hooktimeout=5
60
61 t-commit-build-push-expect-log "stall timeout test" \
62         E:'mirror hook failed: .*timeout'
63
64 t-check-not-mirrored
65
66 exec 3<>$sentinel
67 exec 3>&-
68
69 attempts=100
70 while [ -f $queuedir/$p.lock ]; do
71         if [ $attempts = 0 ]; then \
72                 fail "timed out waiting for lock to go away"
73         fi
74         attempts=$(( $attempts - 1 ))
75         sleep 0.1
76 done
77
78 t-check-mirrored
79
80 t-ok