tests: address machine deprecation

This commit is contained in:
Maximilian Bosch 2026-05-15 11:48:16 +02:00
parent 03895f5997
commit 4f27356536
No known key found for this signature in database
2 changed files with 56 additions and 56 deletions

View file

@ -59,44 +59,44 @@ pkgs.testers.runNixOSTest {
authentik.wait_until_succeeds("curl -fL http://localhost:9000/if/flow/initial-setup/ >&2") authentik.wait_until_succeeds("curl -fL http://localhost:9000/if/flow/initial-setup/ >&2")
with subtest("Frontend renders"): with subtest("Frontend renders"):
machine.succeed("su - alice -c 'firefox --kiosk http://localhost:9000/if/flow/initial-setup/' >&2 &") authentik.succeed("su - alice -c 'firefox --kiosk http://localhost:9000/if/flow/initial-setup/' >&2 &")
machine.wait_for_text("Welcome to authentik") authentik.wait_for_text("Welcome to authentik")
machine.screenshot("1_rendered_frontend") authentik.screenshot("1_rendered_frontend")
with subtest("admin account setup works"): with subtest("admin account setup works"):
machine.send_key("tab") authentik.send_key("tab")
machine.send_key("tab") authentik.send_key("tab")
machine.send_chars("akadmin@localhost") authentik.send_chars("akadmin@localhost")
machine.send_key("tab") authentik.send_key("tab")
machine.send_chars("foobar") authentik.send_chars("foobar")
machine.send_key("tab") authentik.send_key("tab")
machine.send_chars("foobar") authentik.send_chars("foobar")
machine.send_key("ret") authentik.send_key("ret")
machine.wait_for_text("My applications") authentik.wait_for_text("My applications")
machine.send_key("esc") authentik.send_key("esc")
machine.screenshot("2_initial_setup_successful") authentik.screenshot("2_initial_setup_successful")
with subtest("admin settings render and version as expected"): with subtest("admin settings render and version as expected"):
machine.succeed("su - alice -c 'firefox --kiosk http://localhost:9000/if/admin/' >&2 &") authentik.succeed("su - alice -c 'firefox --kiosk http://localhost:9000/if/admin/' >&2 &")
machine.wait_for_text("General system status") authentik.wait_for_text("General system status")
machine.screenshot("3_rendered_admin_interface") authentik.screenshot("3_rendered_admin_interface")
machine.succeed("su - alice -c 'xdotool click 1' >&2") authentik.succeed("su - alice -c 'xdotool click 1' >&2")
machine.succeed("su - alice -c 'xdotool key --delay 100 Page_Down' >&2") authentik.succeed("su - alice -c 'xdotool key --delay 100 Page_Down' >&2")
# sometimes the cursor covers the version string # sometimes the cursor covers the version string
machine.succeed("su - alice -c 'xdotool mousemove_relative 50 50' >&2") authentik.succeed("su - alice -c 'xdotool mousemove_relative 50 50' >&2")
machine.wait_for_text("${builtins.replaceStrings [ "." ] [ ".?" ] authentik-version}") authentik.wait_for_text("${builtins.replaceStrings [ "." ] [ ".?" ] authentik-version}")
machine.screenshot("4_correct_version_in_admin_interface") authentik.screenshot("4_correct_version_in_admin_interface")
with subtest("nginx proxies to authentik"): with subtest("nginx proxies to authentik"):
machine.succeed("su - alice -c 'firefox --kiosk http://localhost/' >&2 &") authentik.succeed("su - alice -c 'firefox --kiosk http://localhost/' >&2 &")
machine.wait_for_text("authentik") authentik.wait_for_text("authentik")
machine.screenshot("5_nginx_proxies_requests") authentik.screenshot("5_nginx_proxies_requests")
with subtest("metrics & worker"): with subtest("metrics & worker"):
machine.wait_for_open_port(9300) authentik.wait_for_open_port(9300)
machine.wait_for_open_port(9301) authentik.wait_for_open_port(9301)
print(machine.succeed("curl -L localhost:9300/metrics | grep authentik_outpost_connection | grep 'Embedded'")) print(authentik.succeed("curl -L localhost:9300/metrics | grep authentik_outpost_connection | grep 'Embedded'"))
print(machine.succeed("curl -L localhost:9301/metrics | grep authentik_tasks_total")) print(authentik.succeed("curl -L localhost:9301/metrics | grep authentik_tasks_total"))
''; '';
} }

View file

@ -47,8 +47,8 @@ pkgs.testers.runNixOSTest {
nodes = { nodes = {
authentik = { authentik = {
virtualisation = { virtualisation = {
cores = 3; cores = 6;
memorySize = 3072; memorySize = 8192;
}; };
imports = [ imports = [
nixosModules.default nixosModules.default
@ -100,37 +100,37 @@ pkgs.testers.runNixOSTest {
authentik.wait_until_succeeds("curl -fL http://localhost:9000/if/flow/initial-setup/ >&2") authentik.wait_until_succeeds("curl -fL http://localhost:9000/if/flow/initial-setup/ >&2")
with subtest("Frontend renders"): with subtest("Frontend renders"):
machine.succeed("su - alice -c 'firefox --kiosk http://localhost:9000/if/flow/initial-setup/' >&2 &") authentik.succeed("su - alice -c 'firefox --kiosk http://localhost:9000/if/flow/initial-setup/' >&2 &")
machine.wait_for_text("${customWelcome}") authentik.wait_for_text("${customWelcome}")
machine.screenshot("1_rendered_frontend") authentik.screenshot("1_rendered_frontend")
with subtest("admin account setup works"): with subtest("admin account setup works"):
machine.send_key("tab") authentik.send_key("tab")
machine.send_key("tab") authentik.send_key("tab")
machine.send_chars("akadmin@localhost") authentik.send_chars("akadmin@localhost")
machine.send_key("tab") authentik.send_key("tab")
machine.send_chars("foobar") authentik.send_chars("foobar")
machine.send_key("tab") authentik.send_key("tab")
machine.send_chars("foobar") authentik.send_chars("foobar")
machine.send_key("ret") authentik.send_key("ret")
machine.wait_for_text("My applications") authentik.wait_for_text("My applications")
machine.send_key("esc") authentik.send_key("esc")
machine.screenshot("2_initial_setup_successful") authentik.screenshot("2_initial_setup_successful")
with subtest("admin settings render and version as expected"): with subtest("admin settings render and version as expected"):
machine.succeed("su - alice -c 'firefox --kiosk http://localhost:9000/if/admin/' >&2 &") authentik.succeed("su - alice -c 'firefox --kiosk http://localhost:9000/if/admin/' >&2 &")
machine.wait_for_text("General system status") authentik.wait_for_text("General system status")
machine.screenshot("3_rendered_admin_interface") authentik.screenshot("3_rendered_admin_interface")
machine.succeed("su - alice -c 'xdotool click 1' >&2") authentik.succeed("su - alice -c 'xdotool click 1' >&2")
machine.succeed("su - alice -c 'xdotool key --delay 100 Page_Down' >&2") authentik.succeed("su - alice -c 'xdotool key --delay 100 Page_Down' >&2")
# sometimes the cursor covers the version string # sometimes the cursor covers the version string
machine.succeed("su - alice -c 'xdotool mousemove_relative 50 50' >&2") authentik.succeed("su - alice -c 'xdotool mousemove_relative 50 50' >&2")
machine.wait_for_text("${builtins.replaceStrings [ "." ] [ ".?" ] authentik-version}") authentik.wait_for_text("${builtins.replaceStrings [ "." ] [ ".?" ] authentik-version}")
machine.screenshot("4_correct_version_in_admin_interface") authentik.screenshot("4_correct_version_in_admin_interface")
with subtest("nginx proxies to authentik"): with subtest("nginx proxies to authentik"):
machine.succeed("su - alice -c 'firefox --kiosk http://localhost/' >&2 &") authentik.succeed("su - alice -c 'firefox --kiosk http://localhost/' >&2 &")
machine.wait_for_text("authentik") authentik.wait_for_text("authentik")
machine.screenshot("5_nginx_proxies_requests") authentik.screenshot("5_nginx_proxies_requests")
''; '';
} }