tests/keycloak: working base test without client

This commit is contained in:
b12f 2024-08-25 02:28:02 +02:00 committed by teutat3s
parent 31eb82a4e7
commit e1dadd17ab
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1
3 changed files with 35 additions and 14 deletions

View file

@ -39,18 +39,20 @@ in {
self.nixosModules.nginx self.nixosModules.nginx
self.nixosModules.keycloak self.nixosModules.keycloak
self.nixosModules.postgresql self.nixosModules.postgresql
{ virtualisation.memorySize = 4096; services.keycloak.database.createLocally = true; }
./support/global.nix ./support/global.nix
]; ];
systemd.tmpfiles.rules = [ 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 = { pub-solar-os.auth = {
enable = true; enable = true;
database-password-file = "/tmp/dbf"; database-password-file = "/tmp/dbf";
}; };
services.keycloak.database.createLocally = true;
networking.interfaces.eth0.ipv4.addresses = [ networking.interfaces.eth0.ipv4.addresses = [
{ {
@ -63,19 +65,27 @@ in {
enableOCR = true; 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() start_all()
join_all()
nachtigall.wait_for_unit("system.slice") nachtigall.wait_for_unit("system.slice")
nachtigall.succeed("ping 127.0.0.1 -c 2") nachtigall.succeed("ping 127.0.0.1 -c 2")
nachtigall.wait_for_unit("nginx.service") nachtigall.wait_for_unit("nginx.service")
nachtigall.wait_for_unit("keycloak.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_for_unit("system.slice")
client.wait_until_succeeds("swaymsg -t get_tree | grep -q 'firefox'") client.sleep(30)
client.sleep(20) # client.wait_until_succeeds("${wmClass} | grep -q 'firefox'")
client.screenshot("screen") client.screenshot("screen")
''; '';
} }

View file

@ -9,13 +9,24 @@
./global.nix ./global.nix
]; ];
programs.sway = { services.xserver.enable = true;
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 = '' systemd.user.services = {
exec sway "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 = [ networking.interfaces.eth0.ipv4.addresses = [
{ {

View file

@ -35,7 +35,7 @@
} }
]; ];
networking.useDHCP = false; networking.interfaces.eth0.useDHCP = false;
networking.hosts = { networking.hosts = {
"192.168.1.1" = [ "ca.${config.pub-solar-os.networking.domain}" ]; "192.168.1.1" = [ "ca.${config.pub-solar-os.networking.domain}" ];