Skip to content

Commit

Permalink
Merge pull request #12311 from NixOS/mergify/bp/2.24-maintenance/pr-1…
Browse files Browse the repository at this point in the history
…2302

tests: Wait for network *online* and multi-user targets (backport #12302)
  • Loading branch information
edolstra authored Jan 20, 2025
2 parents 2967697 + 12c90a0 commit d8872fc
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
4 changes: 3 additions & 1 deletion tests/nixos/git-submodules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@
client.succeed("chmod 600 /root/.ssh/id_ed25519")
# Install the SSH key on the builders.
client.wait_for_unit("network.target")
client.wait_for_unit("network-online.target")
remote.succeed("mkdir -p -m 700 /root/.ssh")
remote.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
remote.wait_for_unit("sshd")
remote.wait_for_unit("multi-user.target")
remote.wait_for_unit("network-online.target")
client.succeed(f"ssh -o StrictHostKeyChecking=no {remote.name} 'echo hello world'")
remote.succeed("""
Expand Down
5 changes: 4 additions & 1 deletion tests/nixos/nix-copy-closure.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ in {
server.succeed("mkdir -m 700 /root/.ssh")
server.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
server.wait_for_unit("sshd")
client.wait_for_unit("network.target")
server.wait_for_unit("multi-user.target")
server.wait_for_unit("network-online.target")
client.wait_for_unit("network-online.target")
client.succeed(f"ssh -o StrictHostKeyChecking=no {server.name} 'echo hello world'")
# Copy the closure of package A from the client to the server.
Expand Down
5 changes: 4 additions & 1 deletion tests/nixos/nix-copy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ in {
start_all()
server.wait_for_unit("sshd")
client.wait_for_unit("network.target")
server.wait_for_unit("multi-user.target")
server.wait_for_unit("network-online.target")
client.wait_for_unit("network-online.target")
client.wait_for_unit("[email protected]")
# Either the prompt: ]#
# or an OCR misreading of it: 1#
Expand Down
5 changes: 4 additions & 1 deletion tests/nixos/remote-builds-ssh-ng.nix
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@ in
client.succeed("chmod 600 /root/.ssh/id_ed25519")
# Install the SSH key on the builder.
client.wait_for_unit("network.target")
client.wait_for_unit("network-online.target")
builder.succeed("mkdir -p -m 700 /root/.ssh")
builder.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
builder.wait_for_unit("sshd")
builder.wait_for_unit("multi-user.target")
builder.wait_for_unit("network-online.target")
client.succeed(f"ssh -o StrictHostKeyChecking=no {builder.name} 'echo hello world'")
# Perform a build
Expand Down
3 changes: 2 additions & 1 deletion tests/nixos/remote-builds.nix
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ in
client.succeed("chmod 600 /root/.ssh/id_ed25519")
# Install the SSH key on the builders.
client.wait_for_unit("network.target")
client.wait_for_unit("network-online.target")
for builder in [builder1, builder2]:
builder.succeed("mkdir -p -m 700 /root/.ssh")
builder.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
builder.wait_for_unit("sshd")
builder.wait_for_unit("network-online.target")
# Make sure the builder can handle our login correctly
builder.wait_for_unit("multi-user.target")
# Make sure there's no funny business on the client either
Expand Down

0 comments on commit d8872fc

Please sign in to comment.