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.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")
'';
}

View file

@ -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 = [
{

View file

@ -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}" ];