1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

Merge pull request #12311 from NixOS/mergify/bp/2.24-maintenance/pr-12302

tests: Wait for network *online* and multi-user targets (backport #12302)
This commit is contained in:
Eelco Dolstra 2025-01-20 18:27:50 +01:00 committed by GitHub
commit d8872fce2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 5 deletions

View file

@ -39,11 +39,13 @@
client.succeed("chmod 600 /root/.ssh/id_ed25519") client.succeed("chmod 600 /root/.ssh/id_ed25519")
# Install the SSH key on the builders. # 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.succeed("mkdir -p -m 700 /root/.ssh")
remote.copy_from_host("key.pub", "/root/.ssh/authorized_keys") remote.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
remote.wait_for_unit("sshd") 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'") client.succeed(f"ssh -o StrictHostKeyChecking=no {remote.name} 'echo hello world'")
remote.succeed(""" remote.succeed("""

View file

@ -48,7 +48,10 @@ in {
server.succeed("mkdir -m 700 /root/.ssh") server.succeed("mkdir -m 700 /root/.ssh")
server.copy_from_host("key.pub", "/root/.ssh/authorized_keys") server.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
server.wait_for_unit("sshd") 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'") client.succeed(f"ssh -o StrictHostKeyChecking=no {server.name} 'echo hello world'")
# Copy the closure of package A from the client to the server. # Copy the closure of package A from the client to the server.

View file

@ -55,7 +55,10 @@ in {
start_all() start_all()
server.wait_for_unit("sshd") 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("getty@tty1.service") client.wait_for_unit("getty@tty1.service")
# Either the prompt: ]# # Either the prompt: ]#
# or an OCR misreading of it: 1# # or an OCR misreading of it: 1#

View file

@ -89,10 +89,13 @@ in
client.succeed("chmod 600 /root/.ssh/id_ed25519") client.succeed("chmod 600 /root/.ssh/id_ed25519")
# Install the SSH key on the builder. # 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.succeed("mkdir -p -m 700 /root/.ssh")
builder.copy_from_host("key.pub", "/root/.ssh/authorized_keys") builder.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
builder.wait_for_unit("sshd") 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'") client.succeed(f"ssh -o StrictHostKeyChecking=no {builder.name} 'echo hello world'")
# Perform a build # Perform a build

View file

@ -99,11 +99,12 @@ in
client.succeed("chmod 600 /root/.ssh/id_ed25519") client.succeed("chmod 600 /root/.ssh/id_ed25519")
# Install the SSH key on the builders. # 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]: for builder in [builder1, builder2]:
builder.succeed("mkdir -p -m 700 /root/.ssh") builder.succeed("mkdir -p -m 700 /root/.ssh")
builder.copy_from_host("key.pub", "/root/.ssh/authorized_keys") builder.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
builder.wait_for_unit("sshd") builder.wait_for_unit("sshd")
builder.wait_for_unit("network-online.target")
# Make sure the builder can handle our login correctly # Make sure the builder can handle our login correctly
builder.wait_for_unit("multi-user.target") builder.wait_for_unit("multi-user.target")
# Make sure there's no funny business on the client either # Make sure there's no funny business on the client either