##// END OF EJS Templates
tests: add phase testing to test-push-http-bundle1.t...
Gregory Szorc -
r36317:e978e0c1 stable
parent child Browse files
Show More
@@ -1,203 +1,216 b''
1 1 #require killdaemons
2 2
3 3 This test checks behavior related to bundle1 that changed or is likely
4 4 to change with bundle2. Feel free to factor out any part of the test
5 5 which does not need to exist to keep bundle1 working.
6 6
7 7 $ cat << EOF >> $HGRCPATH
8 8 > [devel]
9 9 > # This test is dedicated to interaction through old bundle
10 10 > legacy.exchange = bundle1
11 11 > EOF
12 12
13 13 $ hg init test
14 14 $ cd test
15 15 $ echo a > a
16 16 $ hg ci -Ama
17 17 adding a
18 18 $ cd ..
19 19 $ hg clone test test2
20 20 updating to branch default
21 21 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 22 $ cd test2
23 23 $ echo a >> a
24 24 $ hg ci -mb
25 25 $ req() {
26 26 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
27 27 > cat hg.pid >> $DAEMON_PIDS
28 28 > hg --cwd ../test2 push http://localhost:$HGPORT/
29 29 > exitstatus=$?
30 30 > killdaemons.py
31 31 > echo % serve errors
32 32 > cat errors.log
33 33 > return $exitstatus
34 34 > }
35 35 $ cd ../test
36 36
37 37 expect ssl error
38 38
39 39 $ req
40 40 pushing to http://localhost:$HGPORT/
41 41 searching for changes
42 42 abort: HTTP Error 403: ssl required
43 43 % serve errors
44 44 [255]
45 45
46 46 expect authorization error
47 47
48 48 $ echo '[web]' > .hg/hgrc
49 49 $ echo 'push_ssl = false' >> .hg/hgrc
50 50 $ req
51 51 pushing to http://localhost:$HGPORT/
52 52 searching for changes
53 53 abort: authorization failed
54 54 % serve errors
55 55 [255]
56 56
57 57 expect authorization error: must have authorized user
58 58
59 59 $ echo 'allow_push = unperson' >> .hg/hgrc
60 60 $ req
61 61 pushing to http://localhost:$HGPORT/
62 62 searching for changes
63 63 abort: authorization failed
64 64 % serve errors
65 65 [255]
66 66
67 67 expect success
68 68
69 $ cat > $TESTTMP/hook.sh <<'EOF'
70 > echo "phase-move: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE"
71 > EOF
72
69 73 $ cat >> .hg/hgrc <<EOF
70 74 > allow_push = *
71 75 > [hooks]
72 76 > changegroup = sh -c "printenv.py changegroup 0"
73 77 > pushkey = sh -c "printenv.py pushkey 0"
78 > txnclose-phase.test = sh $TESTTMP/hook.sh
74 79 > EOF
75 80 $ req
76 81 pushing to http://localhost:$HGPORT/
77 82 searching for changes
78 83 remote: adding changesets
79 84 remote: adding manifests
80 85 remote: adding file changes
81 86 remote: added 1 changesets with 1 changes to 1 files
87 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
88 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
82 89 remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
83 90 % serve errors
84 91 $ hg rollback
85 92 repository tip rolled back to revision 0 (undo serve)
86 93
87 94 expect success, server lacks the httpheader capability
88 95
89 96 $ CAP=httpheader
90 97 $ . "$TESTDIR/notcapable"
91 98 $ req
92 99 pushing to http://localhost:$HGPORT/
93 100 searching for changes
94 101 remote: adding changesets
95 102 remote: adding manifests
96 103 remote: adding file changes
97 104 remote: added 1 changesets with 1 changes to 1 files
105 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
106 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
98 107 remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
99 108 % serve errors
100 109 $ hg rollback
101 110 repository tip rolled back to revision 0 (undo serve)
102 111
103 112 expect success, server lacks the unbundlehash capability
104 113
105 114 $ CAP=unbundlehash
106 115 $ . "$TESTDIR/notcapable"
107 116 $ req
108 117 pushing to http://localhost:$HGPORT/
109 118 searching for changes
110 119 remote: adding changesets
111 120 remote: adding manifests
112 121 remote: adding file changes
113 122 remote: added 1 changesets with 1 changes to 1 files
123 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
124 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
114 125 remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
115 126 % serve errors
116 127 $ hg rollback
117 128 repository tip rolled back to revision 0 (undo serve)
118 129
119 130 expect success, pre-d1b16a746db6 server supports the unbundle capability, but
120 131 has no parameter
121 132
122 133 $ cat <<EOF > notcapable-unbundleparam.py
123 134 > from mercurial import extensions, httppeer
124 135 > def capable(orig, self, name):
125 136 > if name == 'unbundle':
126 137 > return True
127 138 > return orig(self, name)
128 139 > def uisetup(ui):
129 140 > extensions.wrapfunction(httppeer.httppeer, 'capable', capable)
130 141 > EOF
131 142 $ cp $HGRCPATH $HGRCPATH.orig
132 143 $ cat <<EOF >> $HGRCPATH
133 144 > [extensions]
134 145 > notcapable-unbundleparam = `pwd`/notcapable-unbundleparam.py
135 146 > EOF
136 147 $ req
137 148 pushing to http://localhost:$HGPORT/
138 149 searching for changes
139 150 remote: adding changesets
140 151 remote: adding manifests
141 152 remote: adding file changes
142 153 remote: added 1 changesets with 1 changes to 1 files
154 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
155 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
143 156 remote: changegroup hook: * (glob)
144 157 % serve errors
145 158 $ hg rollback
146 159 repository tip rolled back to revision 0 (undo serve)
147 160 $ mv $HGRCPATH.orig $HGRCPATH
148 161
149 162 expect push success, phase change failure
150 163
151 164 $ cat > .hg/hgrc <<EOF
152 165 > [web]
153 166 > push_ssl = false
154 167 > allow_push = *
155 168 > [hooks]
156 169 > prepushkey = sh -c "printenv.py prepushkey 1"
157 170 > EOF
158 171 $ req
159 172 pushing to http://localhost:$HGPORT/
160 173 searching for changes
161 174 remote: adding changesets
162 175 remote: adding manifests
163 176 remote: adding file changes
164 177 remote: added 1 changesets with 1 changes to 1 files
165 178 % serve errors
166 179
167 180 expect phase change success
168 181
169 182 $ cat >> .hg/hgrc <<EOF
170 183 > prepushkey = sh -c "printenv.py prepushkey 0"
171 184 > EOF
172 185 $ req
173 186 pushing to http://localhost:$HGPORT/
174 187 searching for changes
175 188 no changes found
176 189 % serve errors
177 190 [1]
178 191 $ hg rollback
179 192 repository tip rolled back to revision 0 (undo serve)
180 193
181 194 expect authorization error: all users denied
182 195
183 196 $ echo '[web]' > .hg/hgrc
184 197 $ echo 'push_ssl = false' >> .hg/hgrc
185 198 $ echo 'deny_push = *' >> .hg/hgrc
186 199 $ req
187 200 pushing to http://localhost:$HGPORT/
188 201 searching for changes
189 202 abort: authorization failed
190 203 % serve errors
191 204 [255]
192 205
193 206 expect authorization error: some users denied, users must be authenticated
194 207
195 208 $ echo 'deny_push = unperson' >> .hg/hgrc
196 209 $ req
197 210 pushing to http://localhost:$HGPORT/
198 211 searching for changes
199 212 abort: authorization failed
200 213 % serve errors
201 214 [255]
202 215
203 216 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now