Skip to content

Commit 4adb579

Browse files
authored
Merge pull request #12302 from NixOS/nixos-tests-network
tests: Wait for network *online* and multi-user targets
2 parents dccabc8 + 15073e8 commit 4adb579

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

tests/nixos/git-submodules.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@
3939
client.succeed("chmod 600 /root/.ssh/id_ed25519")
4040
4141
# Install the SSH key on the builders.
42-
client.wait_for_unit("network.target")
42+
client.wait_for_unit("network-online.target")
4343
4444
remote.succeed("mkdir -p -m 700 /root/.ssh")
4545
remote.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
4646
remote.wait_for_unit("sshd")
47+
remote.wait_for_unit("multi-user.target")
48+
remote.wait_for_unit("network-online.target")
4749
client.succeed(f"ssh -o StrictHostKeyChecking=no {remote.name} 'echo hello world'")
4850
4951
remote.succeed("""

tests/nixos/nix-copy-closure.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ in {
4848
server.succeed("mkdir -m 700 /root/.ssh")
4949
server.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
5050
server.wait_for_unit("sshd")
51-
client.wait_for_unit("network.target")
51+
server.wait_for_unit("multi-user.target")
52+
server.wait_for_unit("network-online.target")
53+
54+
client.wait_for_unit("network-online.target")
5255
client.succeed(f"ssh -o StrictHostKeyChecking=no {server.name} 'echo hello world'")
5356
5457
# Copy the closure of package A from the client to the server.

tests/nixos/nix-copy.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ in {
5656
start_all()
5757
5858
server.wait_for_unit("sshd")
59-
client.wait_for_unit("network.target")
59+
server.wait_for_unit("multi-user.target")
60+
server.wait_for_unit("network-online.target")
61+
62+
client.wait_for_unit("network-online.target")
6063
client.wait_for_unit("[email protected]")
6164
# Either the prompt: ]#
6265
# or an OCR misreading of it: 1#

tests/nixos/remote-builds-ssh-ng.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,13 @@ in
8989
client.succeed("chmod 600 /root/.ssh/id_ed25519")
9090
9191
# Install the SSH key on the builder.
92-
client.wait_for_unit("network.target")
92+
client.wait_for_unit("network-online.target")
9393
builder.succeed("mkdir -p -m 700 /root/.ssh")
9494
builder.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
9595
builder.wait_for_unit("sshd")
96+
builder.wait_for_unit("multi-user.target")
97+
builder.wait_for_unit("network-online.target")
98+
9699
client.succeed(f"ssh -o StrictHostKeyChecking=no {builder.name} 'echo hello world'")
97100
98101
# Perform a build

tests/nixos/remote-builds.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,12 @@ in
112112
client.succeed("chmod 600 /root/.ssh/id_ed25519")
113113
114114
# Install the SSH key on the builders.
115-
client.wait_for_unit("network.target")
115+
client.wait_for_unit("network-online.target")
116116
for builder in [builder1, builder2]:
117117
builder.succeed("mkdir -p -m 700 /root/.ssh")
118118
builder.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
119119
builder.wait_for_unit("sshd")
120+
builder.wait_for_unit("network-online.target")
120121
# Make sure the builder can handle our login correctly
121122
builder.wait_for_unit("multi-user.target")
122123
# Make sure there's no funny business on the client either

0 commit comments

Comments
 (0)