actually including nixos-facter + nixos test
This commit is contained in:
parent
1420644027
commit
8650b1df8f
2 changed files with 8 additions and 1 deletions
|
@ -34,7 +34,7 @@
|
|||
# for copying extra files of nixos-anywhere
|
||||
pkgs.rsync
|
||||
# alternative to nixos-generate-config
|
||||
] ++ lib.optional (pkgs.lib.versionAtLeast lib.version "24.11") pkgs.nixos-facter;
|
||||
] ++ lib.optional (pkgs ? nixos-facter) pkgs.nixos-facter;
|
||||
|
||||
# Don't add nixpkgs to the image to save space, for our intended use case we don't need it
|
||||
system.installer.channel.enable = false;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, kexecTarball
|
||||
, nixos-facter ? null
|
||||
}:
|
||||
|
||||
pkgs.testers.runNixOSTest {
|
||||
|
@ -69,6 +70,7 @@ pkgs.testers.runNixOSTest {
|
|||
};
|
||||
|
||||
testScript = /*python*/ ''
|
||||
import json
|
||||
import time
|
||||
import subprocess
|
||||
import socket
|
||||
|
@ -163,6 +165,11 @@ pkgs.testers.runNixOSTest {
|
|||
host = ssh(["hostname"], stdout=subprocess.PIPE).stdout.strip()
|
||||
assert host == "nixos-installer", f"hostname is {host}, not nixos-installer"
|
||||
|
||||
has_nixos_facter=${if nixos-facter != null then "True" else "False"}
|
||||
if has_nixos_facter == True:
|
||||
data = json.loads(ssh(["nixos-facter"], stdout=subprocess.PIPE).stdout)
|
||||
assert data["virtualisation"] == "kvm", f"virtualisation is {data['virtualisation']}, not kvm"
|
||||
|
||||
host_ed25519_after = ssh(["cat", "/etc/ssh/ssh_host_ed25519_key.pub"], stdout=subprocess.PIPE).stdout.strip()
|
||||
assert host_ed25519_before == host_ed25519_after, f"'{host_ed25519_before}' != '{host_ed25519_after}'"
|
||||
|
||||
|
|
Loading…
Reference in a new issue