Skip to content

Commit 2f4e846

Browse files
committed
ssh test suite improvements for running on CentOS
1 parent 9ebf1a5 commit 2f4e846

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

tests/README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,19 @@ SSH test setups:
1414
# run this
1515
./fixtures/remote-ssh-home/init-git.sh
1616

17-
# add this to ~/.ssh/config (create the ~/.ssh/localhost identity first)
18-
Host localhost
19-
HostName localhost
20-
User mjuric
21-
IdentityFile ~/.ssh/localhost
17+
# create identities
18+
ssh-keygen -C git-clone-completion -N '' -f ~/.ssh/git-clone-completion
2219

20+
# add this to ~/.ssh/config (create the ~/.ssh/git-clone-completion identity first)
2321
Host test-dummy-*
2422
HostName localhost
2523
User mjuric
26-
IdentityFile ~/.ssh/localhost
24+
IdentitiesOnly yes
25+
IdentityFile ~/.ssh/git-clone-completion
2726

2827
# add this to ~/.ssh/authorized_keys
29-
```
30-
command="~/projects/github.com/mjuric/git-clone-completion/tests/ssh-preflight.sh" ...public-key...
28+
# echo "command=\"~/projects/github.com/mjuric/git-clone-completion/tests/ssh-preflight.sh\" $(cat ~/.ssh/git-clone-completion.pub)" >> ~/.ssh/authorized_keys
29+
command="~/projects/github.com/mjuric/git-clone-completion/tests/ssh-preflight.sh" ...contents of ~/.ssh/git-clone-completion.pub...
3130
```
3231

3332
## Running

tests/test_ssh.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
class TestSSH:
66
def test_basic(self, bash):
77
for cmdline, expected_result in [
8-
("git clone loc", []), # initially has no autocompletions
9-
("git clone localhost:f", ['oo/']),
10-
("git clone localhost:foo/", ['rep ']),
11-
("git clone lo", ['calhost:']) # should remembe the hostnme after a successful login
8+
("git clone test-dummy-loc", []), # initially has no autocompletions
9+
("git clone test-dummy-localhost:f", ['oo/']),
10+
("git clone test-dummy-localhost:foo/", ['rep ']),
11+
("git clone test-dummy-lo", ['calhost:']) # should remembe the hostnme after a successful login
1212
]:
1313
expected_result.sort()
1414

@@ -17,10 +17,10 @@ def test_basic(self, bash):
1717

1818
def test_weird(self, bash):
1919
for cmdline, expected_result in [
20-
("git clone localhost:w", [ 'eird/' ]),
21-
("git clone localhost:weird/", [ r'weird/a\ b\ c/', r'weird/x\ \&\ \[\]\ \:\ \$\ xx\ \?/', r'weird/bar/', r'weird/x\ \=\ y/']),
22-
("git clone localhost:weird/x\\ \\", [ r'weird/x\ \&\ \[\]\ \:\ \$\ xx\ \?/', r'weird/x\ \=\ y/']), # test completion on escaped character
23-
(r"git clone localhost:weird/x\ \=\ ", [ r'y/' ]),
20+
("git clone test-dummy-localhost:w", [ 'eird/' ]),
21+
("git clone test-dummy-localhost:weird/", [ r'weird/a\ b\ c/', r'weird/x\ \&\ \[\]\ \:\ \$\ xx\ \?/', r'weird/bar/', r'weird/x\ \=\ y/']),
22+
("git clone test-dummy-localhost:weird/x\\ \\", [ r'weird/x\ \&\ \[\]\ \:\ \$\ xx\ \?/', r'weird/x\ \=\ y/']), # test completion on escaped character
23+
(r"git clone test-dummy-localhost:weird/x\ \=\ ", [ r'y/' ]),
2424
]:
2525
expected_result.sort()
2626

@@ -46,7 +46,7 @@ def test_cache_expiration(self, bash):
4646

4747
# verify that re-adding localhost won't squeeze test-dummy-0 out of the cache
4848
# and that test-dummy-1 got squeezed out
49-
assert bash.complete("git clone localhost:f") == [ 'oo/' ], f"Unexpected completion for `{cmdline}`"
49+
assert bash.complete("git clone test-dummy-localhost:f") == [ 'oo/' ], f"Unexpected completion for `{cmdline}`"
5050
assert bash.complete("git clone test-dummy-0") == [ ':' ], f"Unexpected completion for `{cmdline}`"
5151
assert bash.complete("git clone test-dummy-1") == [], f"Didn't expire a host from cache"
5252
except:

0 commit comments

Comments
 (0)