Mercurial > hg
annotate tests/test-wireproto-command-pushkey.t @ 37611:ae8730877371
httppeer: basic implementation of capabilities interface
This is a bit crude. The capabilities mechanism for version 2 of
the wire protocol is a bit different from version 1. And code
in core is relying on strings passed to capable() matching strings
advertised by the "capabilities" wire protocol command. I may
refactor the internal checking mechanism to be a bit more
abstract or based on interfaces. Time will tell...
Differential Revision: https://phab.mercurial-scm.org/D3256
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 10 Apr 2018 19:09:35 -0700 |
parents | be5d4749edc0 |
children | 72b0982cd509 |
rev | line source |
---|---|
37537
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 $ . $TESTDIR/wireprotohelpers.sh |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 $ hg init server |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 $ enablehttpv2 server |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 $ cd server |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 $ cat >> .hg/hgrc << EOF |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 > [web] |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 > push_ssl = false |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 > allow-push = * |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
10 > EOF |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 $ hg debugdrawdag << EOF |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 > C D |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 > |/ |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
14 > B |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
15 > | |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 > A |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 > EOF |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 $ cat hg.pid > $DAEMON_PIDS |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 pushkey for a bookmark works |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 $ sendhttpv2peer << EOF |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 > command pushkey |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 > namespace bookmarks |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 > key @ |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 > old |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
29 > new 426bada5c67598ca65036d57d9e4b64b0c1ce7a0 |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 > EOF |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
31 creating http peer for wire protocol version 2 |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 sending pushkey command |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 s> *\r\n (glob) |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 s> Accept-Encoding: identity\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
35 s> accept: application/mercurial-exp-framing-0003\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
36 s> content-type: application/mercurial-exp-framing-0003\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 s> content-length: 105\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
38 s> host: $LOCALIP:$HGPORT\r\n (glob) |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 s> user-agent: Mercurial debugwireproto\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 s> \r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 s> a\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa4CkeyA@CnewX(426bada5c67598ca65036d57d9e4b64b0c1ce7a0Cold@InamespaceIbookmarksDnameGpushkey |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 s> makefile('rb', None) |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 s> HTTP/1.1 200 OK\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 s> Server: testing stub value\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 s> Date: $HTTP_DATE$\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
46 s> Content-Type: application/mercurial-exp-framing-0003\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
47 s> Transfer-Encoding: chunked\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
48 s> \r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
49 s> 9\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
50 s> *\x00\x01\x00\x02\x01F (glob) |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
51 s> \xf5 |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
52 s> \r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
53 received frame(size=*; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) (glob) |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
54 s> 0\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
55 s> \r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
56 response: [] |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
57 |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
58 $ sendhttpv2peer << EOF |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
59 > command listkeys |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
60 > namespace bookmarks |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 > EOF |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
62 creating http peer for wire protocol version 2 |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
63 sending listkeys command |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
64 s> POST /api/exp-http-v2-0001/ro/listkeys HTTP/1.1\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
65 s> Accept-Encoding: identity\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
66 s> accept: application/mercurial-exp-framing-0003\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
67 s> content-type: application/mercurial-exp-framing-0003\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
68 s> content-length: 49\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
69 s> host: $LOCALIP:$HGPORT\r\n (glob) |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
70 s> user-agent: Mercurial debugwireproto\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
71 s> \r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
72 s> )\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa1InamespaceIbookmarksDnameHlistkeys |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
73 s> makefile('rb', None) |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
74 s> HTTP/1.1 200 OK\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
75 s> Server: testing stub value\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
76 s> Date: $HTTP_DATE$\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
77 s> Content-Type: application/mercurial-exp-framing-0003\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
78 s> Transfer-Encoding: chunked\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
79 s> \r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
80 s> 35\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
81 s> -\x00\x00\x01\x00\x02\x01F |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
82 s> \xa1A@X(426bada5c67598ca65036d57d9e4b64b0c1ce7a0 |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
83 s> \r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
84 received frame(size=45; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
85 s> 0\r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
86 s> \r\n |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
87 response: [{b'@': b'426bada5c67598ca65036d57d9e4b64b0c1ce7a0'}] |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
88 |
be5d4749edc0
wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
89 $ cat error.log |