1
0
Fork 0

make keycloak db integration test pass

This commit is contained in:
ibizaman 2023-03-14 23:55:17 -07:00
parent 5f10d3f307
commit 24a23ed3d7
2 changed files with 18 additions and 12 deletions

View file

@ -27,9 +27,6 @@ rec {
servicesFile = "tests/integration/keycloak/services.nix"; servicesFile = "tests/integration/keycloak/services.nix";
networkFile = "tests/integration/keycloak/network.nix"; networkFile = "tests/integration/keycloak/network.nix";
distributionFile = "tests/integration/keycloak/distribution.nix"; distributionFile = "tests/integration/keycloak/distribution.nix";
# extraParams = {
# "extra-builtins-file" = ../../extra-builtins.nix;
# };
}; };
}; };
@ -41,11 +38,20 @@ rec {
# dysnomiaStateDir = /var/state/dysnomia; # dysnomiaStateDir = /var/state/dysnomia;
testScript = testScript =
'' ''
# Wait until the front-end application is deployed def assert_service_started(machine, name):
# $test1->waitForFile("/var/tomcat/webapps/testapp"); code, log = machine.systemctl("status " + name)
if code != 0:
raise Exception(name + " could not be started:\n---\n" + log + "---\n")
# Wait a little longer and capture the output of the entry page def assert_database_exists(machine, name):
# my $result = $test1->mustSucceed("sleep 10; curl --fail http://test2:8080/testapp"); if machine.succeed("""psql -XtA -U postgres -h localhost -c "SELECT 1 FROM pg_database WHERE datname='{}'" """.format(name)) != '1\n':
raise Exception("could not find database '{}' in postgresql".format(name))
with subtest("check postgres service started"):
assert_service_started(test1, "postgresql.service")
with subtest("check db is created"):
assert_database_exists(test1, "keycloak")
''; '';
}; };
}; };

View file

@ -26,11 +26,11 @@ rec {
}; };
}; };
# deployment.keys = { systemd.tmpfiles.rules = [
# keycloakinitialadmin.text = '' # Type Path Mode User Group Age Argument...
# KEYCLOAK_ADMIN_PASSWORD="${builtins.extraBuiltins.pass "keycloak.${domain}/admin"}" ''d /run/keys 0755 root root - -''
# ''; ''f+ /run/keys/keycloackinitialadmin 0755 root root - KEYCLOAK_ADMIN_PASSWORD="KEYCLOAK_ADMIN_PASSWORD"''
# }; ];
services = { services = {
openssh = { openssh = {