summaryrefslogtreecommitdiff
path: root/tests/tests/mirror
blob: 6f6300e298456e026a8fc5f16c75b4e3bb77a5db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
set -e
. tests/lib
. $troot/lib-mirror

t-drs

: ---- "basic test" ----

t-tstunt-parsechangelog
t-prep-newpackage example 1.0

t-mirror-setup

cd $p
revision=1
t-dgit build
t-dgit push --new

t-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

t-mirror-set rsyncssh=$tmp/stunt-ssh
t-mirror-set remoterepos=HOST:$reposmirror

# mirror should fail due to lack of stunt-ssh-sentinel

t-commit-build-push-expect-log "stunt ssh test" \
	E:'mirror hook failed: .*exited'

ls -al $queuedir/$p.a
t-check-not-mirrored

touch $sentinel

t-mirror-hook backlog
t-check-mirrored

: ----- "stall timeout test" -----

rm -f $sentinel ${sentinel}2
mkfifo $sentinel ${sentinel}2

t-mirror-set hooktimeout=5

t-commit-build-push-expect-log "stall timeout test" \
	E:'mirror hook failed: .*timeout'

t-check-not-mirrored

exec 3<>$sentinel
exec 3>&-
cat ${sentinel}2

t-check-mirrored

echo done.