annotate tests/wireprotohelpers.sh @ 37482:fa9faf58959d

tests: extract wire protocol shell helpers to standalone file This will make it easier for other tests to get up and running without the boilerplate. Differential Revision: https://phab.mercurial-scm.org/D3176
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 26 Mar 2018 15:34:52 -0700
parents
children 61e405fb6372
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37482
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1 HTTPV2=exp-http-v2-0001
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
2 MEDIATYPE=application/mercurial-exp-framing-0003
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
3
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
4 sendhttpraw() {
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
5 hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
6 }
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
7
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
8 cat > dummycommands.py << EOF
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
9 from mercurial import (
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
10 wireprototypes,
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
11 wireproto,
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
12 )
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
13
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
14 @wireproto.wireprotocommand('customreadonly', permission='pull')
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
15 def customreadonly(repo, proto):
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
16 return wireprototypes.bytesresponse(b'customreadonly bytes response')
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
17
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
18 @wireproto.wireprotocommand('customreadwrite', permission='push')
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
19 def customreadwrite(repo, proto):
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
20 return wireprototypes.bytesresponse(b'customreadwrite bytes response')
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
21 EOF
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
22
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
23 cat >> $HGRCPATH << EOF
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
24 [extensions]
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
25 drawdag = $TESTDIR/drawdag.py
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
26 EOF
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
27
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
28 enabledummycommands() {
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
29 cat >> $HGRCPATH << EOF
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
30 [extensions]
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
31 dummycommands = $TESTTMP/dummycommands.py
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
32 EOF
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
33 }
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
34
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
35 enablehttpv2() {
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
36 cat >> $1/.hg/hgrc << EOF
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
37 [experimental]
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
38 web.apiserver = true
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
39 web.api.http-v2 = true
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
40 EOF
fa9faf58959d tests: extract wire protocol shell helpers to standalone file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
41 }