Mercurial > hg > mercurial-source
annotate tests/test-pull.t @ 37003:1ee1a42bfdae
tests: test using both versions of SSH protocol
Now that the version 2 of the SSH protocol is usable in core, we
can start actively testing it more widely outside of low-level
protocol tests.
We add #testcases variants to a handful of tests so we exercise both
version 1 and version 2 of the SSH protocol when testing. This will
allow us to more easily find regressions and variances as protocol 2
is developed. It will also make it easier to continue testing with
protocol version 1 once version 2 is enabled by default.
There are a handful of tests using ssh:// that should also gain test
variances. One - test-push-race.t - already has a #testcases. This
would require combinatorial cases. I didn't want to go down that
rabbit hole, so that test is unchanged. Thinking aloud, there is
probably an opportunity to automatically run tests with multiple
server/protocol implementations. Ideally any test that performed
server interaction would run with all supported server implementations
and protocols so we could find variances between servers and protocols.
But this has been a long-standing issue with our test harness. I
don't think it is an easily solved problem. But it would be nice...
Differential Revision: https://phab.mercurial-scm.org/D2206
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 12 Feb 2018 16:35:06 -0800 |
parents | eb586ed5d8ce |
children | 6639ac97ec3b |
rev | line source |
---|---|
22046
7a9cbb315d84
tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents:
17486
diff
changeset
|
1 #require serve |
15446
c5c9ca3719f9
tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents:
13956
diff
changeset
|
2 |
37003
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
35444
diff
changeset
|
3 #testcases sshv1 sshv2 |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
35444
diff
changeset
|
4 |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
35444
diff
changeset
|
5 #if sshv2 |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
35444
diff
changeset
|
6 $ cat >> $HGRCPATH << EOF |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
35444
diff
changeset
|
7 > [experimental] |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
35444
diff
changeset
|
8 > sshpeer.advertise-v2 = true |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
35444
diff
changeset
|
9 > sshserver.support-v2 = true |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
35444
diff
changeset
|
10 > EOF |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
35444
diff
changeset
|
11 #endif |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
35444
diff
changeset
|
12 |
13956
ffb5c09ba822
tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents:
13826
diff
changeset
|
13 $ hg init test |
12279 | 14 $ cd test |
15 | |
16 $ echo foo>foo | |
17 $ hg addremove | |
18 adding foo | |
19 $ hg commit -m 1 | |
20 | |
21 $ hg verify | |
22 checking changesets | |
23 checking manifests | |
24 crosschecking files in changesets and manifests | |
25 checking files | |
26 1 files, 1 changesets, 1 total revisions | |
336 | 27 |
12279 | 28 $ hg serve -p $HGPORT -d --pid-file=hg.pid |
29 $ cat hg.pid >> $DAEMON_PIDS | |
30 $ cd .. | |
31 | |
12367
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12334
diff
changeset
|
32 $ hg clone --pull http://foo:bar@localhost:$HGPORT/ copy |
12279 | 33 requesting all changes |
34 adding changesets | |
35 adding manifests | |
36 adding file changes | |
37 added 1 changesets with 1 changes to 1 files | |
35444
eb586ed5d8ce
transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
34427
diff
changeset
|
38 new changesets 340e38bdcde4 |
12279 | 39 updating to branch default |
40 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
41 | |
42 $ cd copy | |
43 $ hg verify | |
44 checking changesets | |
45 checking manifests | |
46 crosschecking files in changesets and manifests | |
47 checking files | |
48 1 files, 1 changesets, 1 total revisions | |
336 | 49 |
12279 | 50 $ hg co |
51 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
52 $ cat foo | |
53 foo | |
54 | |
55 $ hg manifest --debug | |
56 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo | |
57 | |
12367
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12334
diff
changeset
|
58 $ hg pull |
15552
62c9183a0bbb
clone: don't save user's password in .hg/hgrc (Issue3122)
Augie Fackler <durin42@gmail.com>
parents:
13956
diff
changeset
|
59 pulling from http://foo@localhost:$HGPORT/ |
12279 | 60 searching for changes |
61 no changes found | |
62 | |
12367
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12334
diff
changeset
|
63 $ hg rollback --dry-run --verbose |
13446
1e497df514e2
rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents:
12643
diff
changeset
|
64 repository tip rolled back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/) |
12279 | 65 |
27244
a3fcc8e3136b
context: don't hex encode all unknown 20 char revision specs (issue4890)
Mads Kiilerich <madski@unity3d.com>
parents:
24276
diff
changeset
|
66 Test pull of non-existing 20 character revision specification, making sure plain ascii identifiers |
a3fcc8e3136b
context: don't hex encode all unknown 20 char revision specs (issue4890)
Mads Kiilerich <madski@unity3d.com>
parents:
24276
diff
changeset
|
67 not are encoded like a node: |
a3fcc8e3136b
context: don't hex encode all unknown 20 char revision specs (issue4890)
Mads Kiilerich <madski@unity3d.com>
parents:
24276
diff
changeset
|
68 |
a3fcc8e3136b
context: don't hex encode all unknown 20 char revision specs (issue4890)
Mads Kiilerich <madski@unity3d.com>
parents:
24276
diff
changeset
|
69 $ hg pull -r 'xxxxxxxxxxxxxxxxxxxy' |
a3fcc8e3136b
context: don't hex encode all unknown 20 char revision specs (issue4890)
Mads Kiilerich <madski@unity3d.com>
parents:
24276
diff
changeset
|
70 pulling from http://foo@localhost:$HGPORT/ |
a3fcc8e3136b
context: don't hex encode all unknown 20 char revision specs (issue4890)
Mads Kiilerich <madski@unity3d.com>
parents:
24276
diff
changeset
|
71 abort: unknown revision 'xxxxxxxxxxxxxxxxxxxy'! |
a3fcc8e3136b
context: don't hex encode all unknown 20 char revision specs (issue4890)
Mads Kiilerich <madski@unity3d.com>
parents:
24276
diff
changeset
|
72 [255] |
a3fcc8e3136b
context: don't hex encode all unknown 20 char revision specs (issue4890)
Mads Kiilerich <madski@unity3d.com>
parents:
24276
diff
changeset
|
73 $ hg pull -r 'xxxxxxxxxxxxxxxxxx y' |
a3fcc8e3136b
context: don't hex encode all unknown 20 char revision specs (issue4890)
Mads Kiilerich <madski@unity3d.com>
parents:
24276
diff
changeset
|
74 pulling from http://foo@localhost:$HGPORT/ |
a3fcc8e3136b
context: don't hex encode all unknown 20 char revision specs (issue4890)
Mads Kiilerich <madski@unity3d.com>
parents:
24276
diff
changeset
|
75 abort: unknown revision '7878787878787878787878787878787878782079'! |
a3fcc8e3136b
context: don't hex encode all unknown 20 char revision specs (issue4890)
Mads Kiilerich <madski@unity3d.com>
parents:
24276
diff
changeset
|
76 [255] |
a3fcc8e3136b
context: don't hex encode all unknown 20 char revision specs (issue4890)
Mads Kiilerich <madski@unity3d.com>
parents:
24276
diff
changeset
|
77 |
12399
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12378
diff
changeset
|
78 Issue622: hg init && hg pull -u URL doesn't checkout default branch |
4888
2d545b98a7bc
issue 622: pull/unbundle -u updates to default branch if repo was empty
Bryan O'Sullivan <bos@serpentine.com>
parents:
3736
diff
changeset
|
79 |
12279 | 80 $ cd .. |
81 $ hg init empty | |
82 $ cd empty | |
83 $ hg pull -u ../test | |
84 pulling from ../test | |
85 requesting all changes | |
86 adding changesets | |
87 adding manifests | |
88 adding file changes | |
89 added 1 changesets with 1 changes to 1 files | |
35444
eb586ed5d8ce
transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
34427
diff
changeset
|
90 new changesets 340e38bdcde4 |
12279 | 91 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
9996
2770d03ae49f
handle file URIs correctly, according to RFC 2396 (issue1153)
Sune Foldager <cryo@cyanite.org>
parents:
5384
diff
changeset
|
92 |
12279 | 93 Test 'file:' uri handling: |
94 | |
17486 | 95 $ hg pull -q file://../test-does-not-exist |
13823
ad179644750f
hg: look up schemes using url.url
Brodie Rao <brodie@bitheap.org>
parents:
13817
diff
changeset
|
96 abort: file:// URLs can only refer to localhost |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
97 [255] |
12279 | 98 |
13826
e574207e3bcd
url: refactor util.drop_scheme() and hg.localpath() into url.localpath()
Brodie Rao <brodie@bitheap.org>
parents:
13823
diff
changeset
|
99 $ hg pull -q file://../test |
e574207e3bcd
url: refactor util.drop_scheme() and hg.localpath() into url.localpath()
Brodie Rao <brodie@bitheap.org>
parents:
13823
diff
changeset
|
100 abort: file:// URLs can only refer to localhost |
e574207e3bcd
url: refactor util.drop_scheme() and hg.localpath() into url.localpath()
Brodie Rao <brodie@bitheap.org>
parents:
13823
diff
changeset
|
101 [255] |
e574207e3bcd
url: refactor util.drop_scheme() and hg.localpath() into url.localpath()
Brodie Rao <brodie@bitheap.org>
parents:
13823
diff
changeset
|
102 |
32550
5e92ba77793c
test-serve: disable unfixable tests on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
27244
diff
changeset
|
103 MSYS changes 'file:' into 'file;' |
5e92ba77793c
test-serve: disable unfixable tests on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
27244
diff
changeset
|
104 |
5e92ba77793c
test-serve: disable unfixable tests on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
27244
diff
changeset
|
105 #if no-msys |
24276
abcb1ee3b20a
check-code: allow disabling msys path check
Matt Mackall <mpm@selenic.com>
parents:
22947
diff
changeset
|
106 $ hg pull -q file:../test # no-msys |
32550
5e92ba77793c
test-serve: disable unfixable tests on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
27244
diff
changeset
|
107 #endif |
12279 | 108 |
12334
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
109 It's tricky to make file:// URLs working on every platform with |
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
110 regular shell commands. |
12279 | 111 |
22947
c63a09b6b337
tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents:
22046
diff
changeset
|
112 $ URL=`$PYTHON -c "import os; print 'file://foobar' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test'"` |
12279 | 113 $ hg pull -q "$URL" |
13817
7f18bab2c0b0
url: abort on file:// URLs with non-localhost hosts
Brodie Rao <brodie@bitheap.org>
parents:
13446
diff
changeset
|
114 abort: file:// URLs can only refer to localhost |
7f18bab2c0b0
url: abort on file:// URLs with non-localhost hosts
Brodie Rao <brodie@bitheap.org>
parents:
13446
diff
changeset
|
115 [255] |
12279 | 116 |
22947
c63a09b6b337
tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents:
22046
diff
changeset
|
117 $ URL=`$PYTHON -c "import os; print 'file://localhost' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test'"` |
13817
7f18bab2c0b0
url: abort on file:// URLs with non-localhost hosts
Brodie Rao <brodie@bitheap.org>
parents:
13446
diff
changeset
|
118 $ hg pull -q "$URL" |
16912
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
16107
diff
changeset
|
119 |
34421
92b583e3e522
pull: add tests for unsafe ssh url (SEC)
Sean Farley <sean@farley.io>
parents:
32550
diff
changeset
|
120 SEC: check for unsafe ssh url |
92b583e3e522
pull: add tests for unsafe ssh url (SEC)
Sean Farley <sean@farley.io>
parents:
32550
diff
changeset
|
121 |
34427
943c91326b23
ssh: unban the use of pipe character in user@host:port string
Yuya Nishihara <yuya@tcha.org>
parents:
34421
diff
changeset
|
122 $ cat >> $HGRCPATH << EOF |
943c91326b23
ssh: unban the use of pipe character in user@host:port string
Yuya Nishihara <yuya@tcha.org>
parents:
34421
diff
changeset
|
123 > [ui] |
943c91326b23
ssh: unban the use of pipe character in user@host:port string
Yuya Nishihara <yuya@tcha.org>
parents:
34421
diff
changeset
|
124 > ssh = sh -c "read l; read l; read l" |
943c91326b23
ssh: unban the use of pipe character in user@host:port string
Yuya Nishihara <yuya@tcha.org>
parents:
34421
diff
changeset
|
125 > EOF |
943c91326b23
ssh: unban the use of pipe character in user@host:port string
Yuya Nishihara <yuya@tcha.org>
parents:
34421
diff
changeset
|
126 |
34421
92b583e3e522
pull: add tests for unsafe ssh url (SEC)
Sean Farley <sean@farley.io>
parents:
32550
diff
changeset
|
127 $ hg pull 'ssh://-oProxyCommand=touch${IFS}owned/path' |
92b583e3e522
pull: add tests for unsafe ssh url (SEC)
Sean Farley <sean@farley.io>
parents:
32550
diff
changeset
|
128 pulling from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path |
92b583e3e522
pull: add tests for unsafe ssh url (SEC)
Sean Farley <sean@farley.io>
parents:
32550
diff
changeset
|
129 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' |
92b583e3e522
pull: add tests for unsafe ssh url (SEC)
Sean Farley <sean@farley.io>
parents:
32550
diff
changeset
|
130 [255] |
92b583e3e522
pull: add tests for unsafe ssh url (SEC)
Sean Farley <sean@farley.io>
parents:
32550
diff
changeset
|
131 $ hg pull 'ssh://%2DoProxyCommand=touch${IFS}owned/path' |
92b583e3e522
pull: add tests for unsafe ssh url (SEC)
Sean Farley <sean@farley.io>
parents:
32550
diff
changeset
|
132 pulling from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path |
92b583e3e522
pull: add tests for unsafe ssh url (SEC)
Sean Farley <sean@farley.io>
parents:
32550
diff
changeset
|
133 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' |
92b583e3e522
pull: add tests for unsafe ssh url (SEC)
Sean Farley <sean@farley.io>
parents:
32550
diff
changeset
|
134 [255] |
34427
943c91326b23
ssh: unban the use of pipe character in user@host:port string
Yuya Nishihara <yuya@tcha.org>
parents:
34421
diff
changeset
|
135 $ hg pull 'ssh://fakehost|touch${IFS}owned/path' |
943c91326b23
ssh: unban the use of pipe character in user@host:port string
Yuya Nishihara <yuya@tcha.org>
parents:
34421
diff
changeset
|
136 pulling from ssh://fakehost%7Ctouch%24%7BIFS%7Downed/path |
943c91326b23
ssh: unban the use of pipe character in user@host:port string
Yuya Nishihara <yuya@tcha.org>
parents:
34421
diff
changeset
|
137 abort: no suitable response from remote hg! |
34421
92b583e3e522
pull: add tests for unsafe ssh url (SEC)
Sean Farley <sean@farley.io>
parents:
32550
diff
changeset
|
138 [255] |
34427
943c91326b23
ssh: unban the use of pipe character in user@host:port string
Yuya Nishihara <yuya@tcha.org>
parents:
34421
diff
changeset
|
139 $ hg pull 'ssh://fakehost%7Ctouch%20owned/path' |
943c91326b23
ssh: unban the use of pipe character in user@host:port string
Yuya Nishihara <yuya@tcha.org>
parents:
34421
diff
changeset
|
140 pulling from ssh://fakehost%7Ctouch%20owned/path |
943c91326b23
ssh: unban the use of pipe character in user@host:port string
Yuya Nishihara <yuya@tcha.org>
parents:
34421
diff
changeset
|
141 abort: no suitable response from remote hg! |
34421
92b583e3e522
pull: add tests for unsafe ssh url (SEC)
Sean Farley <sean@farley.io>
parents:
32550
diff
changeset
|
142 [255] |
92b583e3e522
pull: add tests for unsafe ssh url (SEC)
Sean Farley <sean@farley.io>
parents:
32550
diff
changeset
|
143 |
34427
943c91326b23
ssh: unban the use of pipe character in user@host:port string
Yuya Nishihara <yuya@tcha.org>
parents:
34421
diff
changeset
|
144 $ [ ! -f owned ] || echo 'you got owned' |
943c91326b23
ssh: unban the use of pipe character in user@host:port string
Yuya Nishihara <yuya@tcha.org>
parents:
34421
diff
changeset
|
145 |
16912
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
16107
diff
changeset
|
146 $ cd .. |