chiark / gitweb /
tests: drs-push-rejects: some failure cases; generate tags in script
[dgit.git] / tests / tests / drs-push-rejects
1 #!/bin/bash
2 set -e
3 . tests/lib
4
5 t-drs
6 t-git-none
7
8 p=pari-extra
9 t-worktree drs
10
11 cd $p
12
13 mustfail () {
14         local wantmsg="$1"; shift
15         set +e
16         git push origin "$@" 2>&1 |tee $tmp/mustfail.txt
17         ps="${PIPESTATUS[*]}"
18         set -e
19         case $ps in
20         "0 0")  fail "push unexpectedly succeeded: $*" ;;
21         *" 0")  ;;
22         *)      fail "tee failed"  ;;
23         esac
24         if ! fgrep "$wantmsg" $tmp/mustfail.txt >/dev/null; then
25                 fail "error message not found"
26         fi
27 }
28
29 mktag1 () {
30         local suite=$1
31         local csuite=$2
32         tag_signer='-u Senatus'
33         tag_message="$p release $version for $suite ($csuite) [dgit]"
34         tag_name=debian/3-2_dummy1
35         push_spec1="HEAD:refs/dgit/$csuite"
36         push_spec2="refs/tags/$tag_name"
37         push_spec="$push_spec1 $push_spec2"
38 }
39 mktag2 () {
40         git tag -f $tag_signer -m "$tag_message" $tag_name "$@"
41 }
42
43
44 version=3-2_dummy1
45
46 mktag1 unstable sid
47 tag_signer='-a'
48 mktag2
49 mustfail 'missing signature' $push_spec
50
51 mktag1 unstable sid
52 tag_message='something'
53 mktag2
54 mustfail 'tag message not in expected format' $push_spec
55
56 mktag1 unstable sid
57 mktag2
58
59 mustfail 'sid != sponge' HEAD:refs/dgit/sponge $push_spec2
60
61 git push origin $push_spec
62
63 mktag2
64
65 mustfail 'not replacing previously-pushed version' $push_spec
66
67 echo ok.