diff options
author | Florian Klink <flokli@flokli.de> | 2020-10-15 00:24:39 +0200 |
---|---|---|
committer | Florian Klink <flokli@flokli.de> | 2020-10-15 01:03:13 +0200 |
commit | a299fc23515d50d8161027af87b649eca27662d8 (patch) | |
tree | 7e3fdf6958aaf213e5756fefaee6f8989f5dcfaa /nixos | |
parent | 00347e9537d6e6ddef599094429a1ac5392d6f28 (diff) |
nixosTests.cloud-init: test changing hostname actually works
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/tests/cloud-init.nix | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nixos/tests/cloud-init.nix b/nixos/tests/cloud-init.nix index d23e9c64b373..a127be6dd85f 100644 --- a/nixos/tests/cloud-init.nix +++ b/nixos/tests/cloud-init.nix @@ -48,7 +48,7 @@ in makeTest { virtualisation.qemu.options = [ "-cdrom" "${metadataDrive}/metadata.iso" ]; services.cloud-init.enable = true; services.openssh.enable = true; - + networking.hostName = ""; }; testScript = '' machine.wait_for_unit("cloud-init.service") @@ -70,5 +70,13 @@ in makeTest { machine.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( + "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentityFile=~/.ssh/id_snakeoil nixos@localhost 'hostname'" + ).strip() + == "test" + ) ''; } |