2 { system ? builtins.currentSystem
4 , pkgs ? import ../.. { inherit system config; }
7 with import ../lib/testing-python.nix { inherit system pkgs; };
11 BIND_ADDRESS = '127.0.0.1'
15 makeAppTest = name: configs: makeTest {
16 name = "powerdns-admin-${name}";
17 meta = with pkgs.lib.maintainers; {
18 maintainers = [ Flakebi zhaofengli ];
21 nodes.server = { pkgs, config, ... }: mkMerge ([
23 services.powerdns-admin = {
25 secretKeyFile = "/etc/powerdns-admin/secret";
26 saltFile = "/etc/powerdns-admin/salt";
28 # It's insecure to have secrets in the world-readable nix store, but this is just a test
29 environment.etc."powerdns-admin/secret".text = "secret key";
30 environment.etc."powerdns-admin/salt".text = "salt";
31 environment.systemPackages = [
32 (pkgs.writeShellScriptBin "run-test" config.system.build.testScript)
38 server.wait_for_unit("powerdns-admin.service")
39 server.wait_until_succeeds("run-test", timeout=10)
46 services.powerdns-admin = {
49 SQLALCHEMY_DATABASE_URI = 'mysql://powerdnsadmin@/powerdnsadmin?unix_socket=/run/mysqld/mysqld.sock'
52 systemd.services.powerdns-admin = {
53 after = [ "mysql.service" ];
54 serviceConfig.BindPaths = "/run/mysqld";
59 package = pkgs.mariadb;
60 ensureDatabases = [ "powerdnsadmin" ];
63 name = "powerdnsadmin";
65 "powerdnsadmin.*" = "ALL PRIVILEGES";
72 services.powerdns-admin = {
75 SQLALCHEMY_DATABASE_URI = 'postgresql://powerdnsadmin@/powerdnsadmin?host=/run/postgresql'
78 systemd.services.powerdns-admin = {
79 after = [ "postgresql.service" ];
80 serviceConfig.BindPaths = "/run/postgresql";
83 services.postgresql = {
85 ensureDatabases = [ "powerdnsadmin" ];
88 name = "powerdnsadmin";
90 "DATABASE powerdnsadmin" = "ALL PRIVILEGES";
99 services.powerdns-admin.extraArgs = [ "-b" "127.0.0.1:8000" ];
100 system.build.testScript = ''
101 curl -sSf http://127.0.0.1:8000/
105 services.powerdns-admin.extraArgs = [ "-b" "unix:/run/powerdns-admin/http.sock" ];
106 system.build.testScript = ''
107 curl -sSf --unix-socket /run/powerdns-admin/http.sock http://somehost/
114 postgresql = makeAppTest "postgresql" [ backend.postgresql listen.tcp ];
115 mysql = makeAppTest "mysql" [ backend.mysql listen.tcp ];
116 unix-listener = makeAppTest "unix-listener" [ backend.postgresql listen.unix ];