Compare commits

..

74 commits

Author SHA1 Message Date
7f1dabe7cb
restore path-based behavior for non-data-model tests 2025-09-01 15:20:07 +02:00
253352616b
reusable TF deployment
note that, other than being easier to call, this maintains the TF
deployment's status of remaining a glorified wrapper of the SSH
deployment.
2025-09-01 15:20:07 +02:00
de19210d1d
stablize pathToRoot for TF 2025-09-01 15:20:07 +02:00
a3ffd6d23b
fix pathFromRoot to work on strings, as its removePrefix does not actually work with store versions of sub-folders 2025-09-01 15:20:07 +02:00
dd6e8850f3
stablize pathToRoot by builtins.path 2025-09-01 15:20:07 +02:00
d35de0b457
add data model test for TF 2025-09-01 15:20:07 +02:00
51b72c79c7
simplify deployment/nixos.nix 2025-09-01 15:20:07 +02:00
76a07a6cf1
split tests to allow running the faster ssh test separately 2025-09-01 15:20:07 +02:00
0aeac419e4
factor out data model 2025-09-01 15:20:07 +02:00
220fe52612
add nixops4 data model test 2025-09-01 15:20:07 +02:00
d6731bbc7d
adjust deployment type
this is a cop-out possible until
fricklerhandwerk/Fediversity#15.
after that, this will require actually figuring out how to get `options`
for `deployment.nix` - which may need `evalModules` with
`data-model.nix`.
2025-09-01 15:20:07 +02:00
a245f52e5b
restore data model with { resources } wrappers, this time working 2025-09-01 15:20:07 +02:00
2ae4ca3f68
simpler data model, not sure it's desirable but at least it's consistent 2025-09-01 15:20:06 +02:00
9907404e94
actually rely on user package from data model 2025-09-01 15:20:06 +02:00
22accb50c0
pass system 2025-09-01 15:20:06 +02:00
6e70640caa
update test 2025-09-01 15:20:06 +02:00
5ce2f2e8ed
update deployment 2025-09-01 15:20:06 +02:00
733c500cd1
simplify auth to not accept password 2025-09-01 15:20:06 +02:00
c818e55194
rename deployment to deployment-type, disambiguating from environments' deployment 2025-09-01 15:20:06 +02:00
f705e56707
fix attrTag by adding mkOption 2025-09-01 15:20:06 +02:00
0249324d86
wrap application resources to match the input of apply 2025-09-01 15:20:06 +02:00
4d348fb9cb
stylize user-specified names by quotes to clarify their status 2025-09-01 15:20:06 +02:00
06fc1e8666
fix a bug of mismatching names in data model test
matches the name of `shell` to `operator-environment`.
2025-09-01 15:20:06 +02:00
dc07eb68c3
try and use deployment 2025-09-01 15:20:06 +02:00
871384d51f
spacing 2025-09-01 15:20:06 +02:00
d37a90723f
simplify imputDerivations 2025-09-01 15:20:06 +02:00
ebfe19ab5c
unimport qemu-guest 2025-09-01 15:20:06 +02:00
95a450023a
simplify inputDerivations 2025-09-01 15:20:06 +02:00
f75fb5eec0
simplify deployment 2025-09-01 15:20:06 +02:00
1f35ca5fe8
skip is-active sshd 2025-09-01 15:20:06 +02:00
a76b3cc4a3
- auto 2025-09-01 15:20:06 +02:00
871b6bd906
move fail in 2025-09-01 15:20:06 +02:00
eec987af06
- BatchMode 2025-09-01 15:20:06 +02:00
240d68617e
rm unused ssh settings 2025-09-01 15:20:06 +02:00
c9dc6ee392
dedupe inputDerivations 2025-09-01 15:20:06 +02:00
98599cebf4
rm cowsay 2025-09-01 15:20:06 +02:00
9746ad0e92
remove unused JSON-serialized args (sources) 2025-09-01 15:20:06 +02:00
bcb0fd5318
factor out to nixos.nix 2025-09-01 15:20:06 +02:00
41b4fa6476
rm users 2025-09-01 15:20:06 +02:00
13a97eadaf
simplify grub 2025-09-01 15:20:06 +02:00
a0e330eb85
rm users 2025-09-01 15:20:06 +02:00
fe4916c854
reenable ipv6 2025-09-01 15:20:06 +02:00
1c362d83b9
reenable firewall 2025-09-01 15:20:06 +02:00
4c360d2cd9
rm comments 2025-09-01 15:20:06 +02:00
4db88cf8df
rm getty 2025-09-01 15:20:06 +02:00
e6c590b4d7
mv attempts 2025-09-01 15:20:06 +02:00
03ea2730b0
download-attempts: settle for just targetNode 2025-09-01 15:20:06 +02:00
f8b508fa43
rm comment 2025-09-01 15:20:06 +02:00
2b66f15e7c
restore imports 2025-09-01 15:20:06 +02:00
cac911a16b
dedupe nixosTest.nix 2025-09-01 15:20:06 +02:00
4249a64c10
qemu guest 2025-09-01 15:20:06 +02:00
c1897a3684
grub 2025-09-01 15:20:06 +02:00
562e511ed8
auto login 2025-09-01 15:20:06 +02:00
c7f2e2b7aa
networking 2025-09-01 15:20:06 +02:00
d363957e37
users 2025-09-01 15:20:06 +02:00
9e3c3b9ee0
handle test outcome 2025-09-01 15:20:06 +02:00
d5bd886757
specialArgs: sources 2025-09-01 15:20:06 +02:00
67484b70ee
nix in tests: download-attempts = 1 2025-09-01 15:20:06 +02:00
767ffd9f87
ensure inputs 2025-09-01 15:20:06 +02:00
80f2bbcc4d
rm paste 2025-09-01 15:20:06 +02:00
8d5c9781d5
move stuff not needed in test out 2025-09-01 15:20:06 +02:00
ea78e850af
ensure availability of needed inputs 2025-09-01 15:20:06 +02:00
2a550e6963
reduce download attempts in test 2025-09-01 15:20:06 +02:00
34a5a62ba3
settle for hello, ditching cowsay 2025-09-01 15:20:06 +02:00
c0a5f28adf
move imports from paste to targetNode to increase parity between paste and nixosTest 2025-09-01 15:20:06 +02:00
9adfb3eae9
ditch superfluous substituters 2025-09-01 15:20:06 +02:00
7d3afbb469
pasteable command for trying without rebuilding vm 2025-09-01 15:20:06 +02:00
ff5fd5047f
add keys 2025-09-01 15:20:06 +02:00
d2b5d7e607
wip: use ssh in test 2025-09-01 15:20:06 +02:00
382bcda9d2
add deployment method: ssh 2025-09-01 15:20:06 +02:00
35e49c04f4
un-nixops 2025-09-01 15:20:06 +02:00
bb79f366e9
scaffold deployment/check/data-model from ./basic
modelify
2025-09-01 15:20:06 +02:00
63c6221479
allow different deployment types 2025-09-01 15:20:06 +02:00
f954ed5389 add proxmox repro test (#345)
closes #325

Reviewed-on: Fediversity/Fediversity#345
Reviewed-by: Nicolas Jeannerod <nicolas.jeannerod@moduscreate.com>
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-09-01 14:31:50 +02:00
7 changed files with 189 additions and 2 deletions

View file

@ -39,6 +39,12 @@ jobs:
- uses: actions/checkout@v4
- run: nix-build -A tests.panel
check-proxmox-basic:
runs-on: native
steps:
- uses: actions/checkout@v4
- run: nix build .#checks.x86_64-linux.proxmox-basic -L
check-deployment-basic:
runs-on: native
steps:

View file

@ -0,0 +1,37 @@
{
runNixOSTest,
sources,
system,
}:
let
pkgs = import sources.nixpkgs-stable {
inherit system;
overlays = [ overlay ];
};
overlay = _: _: {
inherit
(import "${sources.proxmox-nixos}/pkgs" {
craneLib = pkgs.callPackage "${sources.crane}/lib" { };
# breaks from https://github.com/NixOS/nixpkgs/commit/06b354eb2dc535c57e9b4caaa16d79168f117a26,
# which updates libvncserver to 0.9.15, which was not yet patched at https://git.proxmox.com/?p=vncterm.git.
inherit pkgs;
# not so picky about version for our purposes
pkgs-unstable = pkgs;
})
proxmox-ve
pve-ha-manager
;
};
in
runNixOSTest {
node.specialArgs = {
inherit
sources
pkgs
;
};
imports = [
./proxmoxTest.nix
];
}

View file

@ -0,0 +1,87 @@
# https://github.com/SaumonNet/proxmox-nixos/blob/main/tests/vm.nix
{
pkgs,
...
}:
let
# tracking non-tarball downloads seems unsupported still in npins:
# https://github.com/andir/npins/issues/163
minimalIso = pkgs.fetchurl {
url = "https://releases.nixos.org/nixos/24.05/nixos-24.05.7139.bcba2fbf6963/nixos-minimal-24.05.7139.bcba2fbf6963-x86_64-linux.iso";
hash = "sha256-plre/mIHdIgU4xWU+9xErP+L4i460ZbcKq8iy2n4HT8=";
};
in
{
name = "proxmox-basic";
nodes.mypve =
{ sources, ... }:
{
imports = [
"${sources.proxmox-nixos}/modules/proxmox-ve"
];
services.proxmox-ve = {
enable = true;
ipAddress = "192.168.1.1";
vms = {
myvm1 = {
vmid = 100;
memory = 1024;
cores = 1;
sockets = 1;
kvm = true;
scsi = [ { file = "local:16"; } ];
cdrom = "local:iso/minimal.iso";
};
};
};
virtualisation = {
additionalPaths = [ minimalIso ];
diskSize = 4096;
memorySize = 2048;
};
};
testScript = ''
machine.start()
machine.wait_for_unit("pveproxy.service")
assert "running" in machine.succeed("pveproxy status")
# Copy Iso
machine.succeed("mkdir -p /var/lib/vz/template/iso/")
machine.succeed("cp ${minimalIso} /var/lib/vz/template/iso/minimal.iso")
# Declarative VM creation
machine.wait_for_unit("multi-user.target")
machine.succeed("qm stop 100 --timeout 0")
# Seabios VM creation
machine.succeed(
"qm create 101 --kvm 0 --bios seabios -cdrom local:iso/minimal.iso",
"qm start 101",
"qm stop 101 --timeout 0"
)
# Legacy ovmf vm creation
machine.succeed(
"qm create 102 --kvm 0 --bios ovmf -cdrom local:iso/minimal.iso",
"qm start 102",
"qm stop 102 --timeout 0"
)
# UEFI ovmf vm creation
machine.succeed(
"qm create 103 --kvm 0 --bios ovmf --efidisk0 local:4,efitype=4m -cdrom local:iso/minimal.iso",
"qm start 103",
"qm stop 103 --timeout 0"
)
# UEFI ovmf vm creation with secure boot
machine.succeed(
"qm create 104 --kvm 0 --bios ovmf --efidisk0 local:4,efitype=4m,pre-enrolled-keys=1 -cdrom local:iso/minimal.iso",
"qm start 104",
"qm stop 104 --timeout 0"
)
'';
}

View file

@ -4,9 +4,14 @@
_class = "flake";
perSystem =
{ pkgs, ... }:
{ pkgs, system, ... }:
{
checks = {
proxmox-basic = import ./check/proxmox {
inherit (pkgs.testers) runNixOSTest;
inherit sources system;
};
deployment-basic = import ./check/basic {
inherit (pkgs.testers) runNixOSTest;
inherit inputs sources;

View file

@ -6,7 +6,13 @@
outputs =
inputs:
import ./mkFlake.nix inputs (
{
nixConfig = {
extra-trusted-substituters = "https://cache.saumon.network/proxmox-nixos";
extra-trusted-public-keys = "proxmox-nixos:D9RYSWpQQC/msZUWphOY2I5RLH5Dd6yQcaHIuug7dWM=";
};
}
// import ./mkFlake.nix inputs (
{ inputs, sources, ... }:
{
imports = [

4
nixmoxer.conf Normal file
View file

@ -0,0 +1,4 @@
host=192.168.51.81
verify_ssl=0
user=kiara@ProcoliX
password=

View file

@ -25,6 +25,22 @@
"url": null,
"hash": "1w2gsy6qwxa5abkv8clb435237iifndcxq0s79wihqw11a5yb938"
},
"crane": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "ipetkov",
"repo": "crane"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"submodules": false,
"version": "v0.20.3",
"revision": "8468a0c46f81d806fd643ffe389fa80328b21cf4",
"url": "https://api.github.com/repos/ipetkov/crane/tarball/v0.20.3",
"hash": "0zw4275c3a6572w6vjmn850yddw6n3qagwfcq6ns247cx72fdfx0"
},
"disko": {
"type": "GitRelease",
"repository": {
@ -150,6 +166,32 @@
"revision": "f33a4d26226c05d501b9d4d3e5e60a3a59991921",
"url": "https://github.com/nixos/nixpkgs/archive/f33a4d26226c05d501b9d4d3e5e60a3a59991921.tar.gz",
"hash": "1b6dm1sn0bdpcsmxna0zzspjaixa2dald08005fry5jrbjvwafdj"
},
"nixpkgs-stable": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "nixos",
"repo": "nixpkgs"
},
"branch": "nixos-25.05",
"submodules": false,
"revision": "a1ae8ef72f64a845ecce5c6dcf65d546bf7deeb4",
"url": "https://github.com/nixos/nixpkgs/archive/a1ae8ef72f64a845ecce5c6dcf65d546bf7deeb4.tar.gz",
"hash": "0d7lp30wyy5647gpm8rnihvdcpmgmfr9c5yg4fhl31lsg8mlbg16"
},
"proxmox-nixos": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "SaumonNet",
"repo": "proxmox-nixos"
},
"branch": "main",
"submodules": false,
"revision": "48f39fbe2e8f90f9ac160dd4b6929f3ac06d8223",
"url": "https://github.com/SaumonNet/proxmox-nixos/archive/48f39fbe2e8f90f9ac160dd4b6929f3ac06d8223.tar.gz",
"hash": "0606qcs8x1jwckd1ivf52rqdmi3lkn66iiqh6ghd4kqx0g2bw3nv"
}
},
"version": 5