diff --git a/tests/keycloak.nix b/tests/keycloak.nix index 9dc1c08..3657ecd 100644 --- a/tests/keycloak.nix +++ b/tests/keycloak.nix @@ -39,18 +39,20 @@ in { self.nixosModules.nginx self.nixosModules.keycloak self.nixosModules.postgresql - { virtualisation.memorySize = 4096; services.keycloak.database.createLocally = true; } ./support/global.nix ]; systemd.tmpfiles.rules = [ - "f /tmp/dbf 1777 root root 10d" + "f /tmp/dbf 1777 root root 10d password" ]; + virtualisation.memorySize = 4096; + pub-solar-os.auth = { enable = true; database-password-file = "/tmp/dbf"; }; + services.keycloak.database.createLocally = true; networking.interfaces.eth0.ipv4.addresses = [ { @@ -63,19 +65,27 @@ in { enableOCR = true; - testScript = '' + testScript = {nodes, ...}: let + user = nodes.client.users.users.${nodes.client.pub-solar-os.authentication.username}; + #uid = toString user.uid; + bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u ${user.name})/bus"; + gdbus = "${bus} gdbus"; + su = command: "su - ${user.name} -c '${command}'"; + gseval = "call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval"; + wmClass = su "${gdbus} ${gseval} global.display.focus_window.wm_class"; + in '' start_all() - join_all() nachtigall.wait_for_unit("system.slice") nachtigall.succeed("ping 127.0.0.1 -c 2") nachtigall.wait_for_unit("nginx.service") nachtigall.wait_for_unit("keycloak.service") - nachtigall.succeed("curl https://auth.test.pub.solar/") + nachtigall.wait_until_succeeds("curl http://127.0.0.1:8080/") + nachtigall.wait_until_succeeds("curl https://auth.test.pub.solar/") client.wait_for_unit("system.slice") - client.wait_until_succeeds("swaymsg -t get_tree | grep -q 'firefox'") - client.sleep(20) + client.sleep(30) + # client.wait_until_succeeds("${wmClass} | grep -q 'firefox'") client.screenshot("screen") ''; } diff --git a/tests/support/client.nix b/tests/support/client.nix index 728e26e..5e1f4f4 100644 --- a/tests/support/client.nix +++ b/tests/support/client.nix @@ -9,13 +9,24 @@ ./global.nix ]; - programs.sway = { - enable = true; - }; + services.xserver.enable = true; + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + services.xserver.displayManager.autoLogin.enable = true; + services.xserver.displayManager.autoLogin.user = config.pub-solar-os.authentication.username; - programs.bash.shellInit = '' - exec sway - ''; + systemd.user.services = { + "org.gnome.Shell@wayland" = { + serviceConfig = { + ExecStart = [ + # Clear the list before overriding it. + "" + # Eval API is now internal so Shell needs to run in unsafe mode. + "${pkgs.gnome.gnome-shell}/bin/gnome-shell --unsafe-mode" + ]; + }; + }; + }; networking.interfaces.eth0.ipv4.addresses = [ { diff --git a/tests/support/global.nix b/tests/support/global.nix index 5bdf165..2e68163 100644 --- a/tests/support/global.nix +++ b/tests/support/global.nix @@ -35,7 +35,7 @@ } ]; - networking.useDHCP = false; + networking.interfaces.eth0.useDHCP = false; networking.hosts = { "192.168.1.1" = [ "ca.${config.pub-solar-os.networking.domain}" ];