Skip to content

Commit f1343cd

Browse files
committed
Fix other broken test
Signed-off-by: Fabrice Normandin <[email protected]>
1 parent ca73ede commit f1343cd

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

tests/cli/test_init_command.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,18 @@ def test_setup_windows_ssh_config_from_wsl_copies_keys(
892892
monkeypatch: pytest.MonkeyPatch,
893893
input_stream: io.StringIO,
894894
):
895+
# The references to the linux SSH keys in "home" need to be adjusted to point to the
896+
# home during testing.
897+
# This way, we can check that running the function will correctly change the
898+
# identityfile from linux to windows home.
899+
linux_ssh_config.path.write_text(
900+
linux_ssh_config.path.read_text()
901+
.replace("~", str(linux_home))
902+
# Real home directory:
903+
.replace(os.environ["HOME"], str(linux_home))
904+
)
905+
linux_ssh_config = SSHConfig(linux_ssh_config.path)
906+
895907
linux_public_key_path, linux_private_key_path = fake_linux_ssh_keypair
896908
prompt_inputs = [
897909
"y", # accept creating the Windows config file

tests/cli/test_init_command/test_setup_windows_ssh_config_from_wsl_reject_.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Host mila
88
ServerAliveInterval 120
99
ServerAliveCountMax 5
1010
User bob
11-
IdentityFile ~/.ssh/id_rsa_mila
11+
IdentityFile <WSL_HOME>/.ssh/id_rsa_mila
1212
1313
Host mila-cpu
1414
Port 2222
@@ -22,70 +22,70 @@ Host mila-cpu
2222
ProxyCommand ssh mila "/cvmfs/config.mila.quebec/scripts/milatools/slurm-proxy.sh mila-cpu --mem=8G"
2323
RemoteCommand /cvmfs/config.mila.quebec/scripts/milatools/entrypoint.sh mila-cpu
2424
User bob
25-
IdentityFile ~/.ssh/id_rsa_mila
25+
IdentityFile <WSL_HOME>/.ssh/id_rsa_mila
2626
2727
Host *.server.mila.quebec !*login.server.mila.quebec
2828
ProxyJump mila
2929
User bob
30-
IdentityFile ~/.ssh/id_rsa_mila
30+
IdentityFile <WSL_HOME>/.ssh/id_rsa_mila
3131
3232
Host cn-????
3333
ProxyJump mila
3434
User bob
35-
IdentityFile ~/.ssh/id_rsa_mila
35+
IdentityFile <WSL_HOME>/.ssh/id_rsa_mila
3636
3737
Host narval rorqual fir nibi trillium trillium-gpu tamia killarney vulcan
3838
HostName %h.alliancecan.ca
3939
ControlMaster auto
40-
ControlPath ~/.cache/ssh/%r@%h:%p
40+
ControlPath <WSL_HOME>/.cache/ssh/%r@%h:%p
4141
ControlPersist yes
4242
User bob
43-
IdentityFile ~/.ssh/id_rsa_drac
43+
IdentityFile <WSL_HOME>/.ssh/id_rsa_drac
4444
4545
Host nc????? ng?????
4646
ProxyJump narval
4747
User bob
48-
IdentityFile ~/.ssh/id_rsa_drac
48+
IdentityFile <WSL_HOME>/.ssh/id_rsa_drac
4949
5050
Host rc????? rg????? rl?????
5151
ProxyJump rorqual
5252
User bob
53-
IdentityFile ~/.ssh/id_rsa_drac
53+
IdentityFile <WSL_HOME>/.ssh/id_rsa_drac
5454
5555
Host fc????? fb?????
5656
ProxyJump fir
5757
User bob
58-
IdentityFile ~/.ssh/id_rsa_drac
58+
IdentityFile <WSL_HOME>/.ssh/id_rsa_drac
5959
6060
Host c? c?? c??? g? g?? l? l?? m? m?? u?
6161
ProxyJump nibi
6262
User bob
63-
IdentityFile ~/.ssh/id_rsa_drac
63+
IdentityFile <WSL_HOME>/.ssh/id_rsa_drac
6464
6565
Host tg????? tc?????
6666
ProxyJump tamia
6767
User bob
68-
IdentityFile ~/.ssh/id_rsa_drac
68+
IdentityFile <WSL_HOME>/.ssh/id_rsa_drac
6969
7070
Host kn???
7171
ProxyJump killarney
7272
User bob
73-
IdentityFile ~/.ssh/id_rsa_drac
73+
IdentityFile <WSL_HOME>/.ssh/id_rsa_drac
7474
7575
Host rack??-??
7676
ProxyJump vulcan
7777
User bob
78-
IdentityFile ~/.ssh/id_rsa_drac
78+
IdentityFile <WSL_HOME>/.ssh/id_rsa_drac
7979
8080
Host !trillium tri????
8181
ProxyJump trillium
8282
User bob
83-
IdentityFile ~/.ssh/id_rsa_drac
83+
IdentityFile <WSL_HOME>/.ssh/id_rsa_drac
8484
8585
Host !trillium trig????
8686
ProxyJump trillium-gpu
8787
User bob
88-
IdentityFile ~/.ssh/id_rsa_drac
88+
IdentityFile <WSL_HOME>/.ssh/id_rsa_drac
8989
```
9090

9191

0 commit comments

Comments
 (0)