chiark / gitweb /
Mirroring: Tests: Break out various functions (nfc overall)
[dgit.git] / tests / tests / mirror
1 #!/bin/bash
2 set -e
3 . tests/lib
4 . $troot/lib-mirror
5
6 t-drs
7
8 : ---- "basic test" ----
9
10 t-tstunt-parsechangelog
11 t-prep-newpackage example 1.0
12
13 t-mirror-setup
14
15 cd $p
16 revision=1
17 t-dgit build
18 t-dgit push --new
19
20 t-check-mirrored
21
22 : ---- "stunt ssh test" ----
23
24 sentinel=$tmp/stunt-ssh-sentinel
25
26 cat <<END >$tmp/stunt-ssh
27 #!/bin/sh
28 set -ex
29 : $sentinel
30 cat >&2 $sentinel
31 shift # eat HOST
32 sh -c "\$*"
33 : ${sentinel}2
34 date >${sentinel}2
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 ${sentinel}2
57 mkfifo $sentinel ${sentinel}2
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 cat ${sentinel}2
69
70 t-check-mirrored
71
72 echo done.