diff options
author | Florian Klink <flokli@flokli.de> | 2020-12-03 12:13:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-03 12:13:07 +0100 |
commit | 84f417d29beab8e5045a4471a3a288ca3c10c0b9 (patch) | |
tree | 329afdf25e3c5f5c695b55deef2dc9739a5a0902 | |
parent | c1695ade0b3d63241a718f2d3293cfcdf73c7143 (diff) | |
parent | bcc196cae87dace4cb358a0e87f25145232771ba (diff) |
Merge pull request #105469 from kisik21/fix-cloud-init-test
nixos/tests/cloud-init: fix the erroring out
-rw-r--r-- | nixos/tests/cloud-init.nix | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/nixos/tests/cloud-init.nix b/nixos/tests/cloud-init.nix index a127be6dd85f..d59d222974b5 100644 --- a/nixos/tests/cloud-init.nix +++ b/nixos/tests/cloud-init.nix @@ -51,29 +51,31 @@ in makeTest { networking.hostName = ""; }; testScript = '' - machine.wait_for_unit("cloud-init.service") - machine.succeed("cat /tmp/cloudinit-write-file | grep -q 'cloudinit'") + # To wait until cloud-init terminates its run + unnamed.wait_for_unit("cloud-final.service") + + unnamed.succeed("cat /tmp/cloudinit-write-file | grep -q 'cloudinit'") # install snakeoil ssh key and provision .ssh/config file - machine.succeed("mkdir -p ~/.ssh") - machine.succeed( + unnamed.succeed("mkdir -p ~/.ssh") + unnamed.succeed( "cat ${snakeOilPrivateKey} > ~/.ssh/id_snakeoil" ) - machine.succeed("chmod 600 ~/.ssh/id_snakeoil") + unnamed.succeed("chmod 600 ~/.ssh/id_snakeoil") - machine.wait_for_unit("sshd.service") + unnamed.wait_for_unit("sshd.service") # we should be able to log in as the root user, as well as the created nixos user - machine.succeed( + unnamed.succeed( "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentityFile=~/.ssh/id_snakeoil root@localhost 'true'" ) - machine.succeed( + unnamed.succeed( "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentityFile=~/.ssh/id_snakeoil nixos@localhost 'true'" ) # test changing hostname via cloud-init worked assert ( - machine.succeed( + unnamed.succeed( "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentityFile=~/.ssh/id_snakeoil nixos@localhost 'hostname'" ).strip() == "test" |