nixpkgs-suyu/nixos/tests/privacyidea.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
1.3 KiB
Nix
Raw Normal View History

2020-04-21 13:37:00 +02:00
# Miscellaneous small tests that don't warrant their own VM run.
import ./make-test-python.nix ({ pkgs, ...} : rec {
name = "privacyidea";
meta = with pkgs.lib.maintainers; {
maintainers = [ ];
2020-04-21 13:37:00 +02:00
};
2022-03-21 00:15:30 +01:00
nodes.machine = { ... }: {
2020-04-21 13:37:00 +02:00
virtualisation.cores = 2;
services.privacyidea = {
enable = true;
secretKey = "$SECRET_KEY";
pepper = "$PEPPER";
2020-05-08 14:09:10 +02:00
adminPasswordFile = pkgs.writeText "admin-password" "testing";
2020-04-21 13:37:00 +02:00
adminEmail = "root@localhost";
# Don't try this at home!
environmentFile = pkgs.writeText "pi-secrets.env" ''
SECRET_KEY=testing
PEPPER=testing
'';
2020-04-21 13:37:00 +02:00
};
services.nginx = {
enable = true;
virtualHosts."_".locations."/".extraConfig = ''
uwsgi_pass unix:/run/privacyidea/socket;
'';
};
};
testScript = ''
machine.start()
machine.wait_for_unit("multi-user.target")
machine.succeed("curl --fail http://localhost | grep privacyIDEA")
machine.succeed("grep \"SECRET_KEY = 'testing'\" /var/lib/privacyidea/privacyidea.cfg")
machine.succeed("grep \"PI_PEPPER = 'testing'\" /var/lib/privacyidea/privacyidea.cfg")
2020-04-21 13:37:00 +02:00
machine.succeed(
"curl --fail http://localhost/auth -F username=admin -F password=testing | grep token"
)
'';
})