Skip to content

Commit 06075a6

Browse files
jfrochesamrose
authored andcommitted
fix: nixos tests for pg_repack, pgroonga, and plpgsql_check to use the supabase_admin user
We switched to using the supabase_admin user for our Postgres tests instead of the default postgres user. This change updates the authentication methods and user management in the NixOS test configurations for the pg_repack, pgroonga, and plpgsql_check extensions.
1 parent 4e3c49a commit 06075a6

File tree

3 files changed

+40
-10
lines changed

3 files changed

+40
-10
lines changed

nix/ext/tests/pg_repack.nix

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,20 @@ self.inputs.nixpkgs.lib.nixos.runTest {
5959
enable = true;
6060
package = postgresqlWithExtension self.packages.${pkgs.system}.postgresql_15;
6161
enableTCPIP = true;
62-
initialScript = pkgs.writeText "init-postgres-with-password" ''
63-
CREATE USER test WITH PASSWORD 'secret';
64-
'';
6562
authentication = ''
66-
host test postgres samenet scram-sha-256
63+
local all postgres peer map=postgres
64+
local all all peer map=root
65+
'';
66+
identMap = ''
67+
root root supabase_admin
68+
postgres postgres postgres
6769
'';
70+
ensureUsers = [
71+
{
72+
name = "supabase_admin";
73+
ensureClauses.superuser = true;
74+
}
75+
];
6876
};
6977

7078
networking.firewall.allowedTCPPorts = [ config.services.postgresql.settings.port ];

nix/ext/tests/pgroonga.nix

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,21 @@ self.inputs.nixpkgs.lib.nixos.runTest {
6060
services.postgresql = {
6161
enable = true;
6262
package = psql_15;
63+
enableTCPIP = true;
64+
authentication = ''
65+
local all postgres peer map=postgres
66+
local all all peer map=root
67+
'';
68+
identMap = ''
69+
root root supabase_admin
70+
postgres postgres postgres
71+
'';
72+
ensureUsers = [
73+
{
74+
name = "supabase_admin";
75+
ensureClauses.superuser = true;
76+
}
77+
];
6378
};
6479
systemd.services.postgresql.environment.MECAB_DICDIR = "${
6580
self.packages.${pkgs.system}.mecab-naist-jdic
@@ -120,7 +135,6 @@ self.inputs.nixpkgs.lib.nixos.runTest {
120135
"17": [${lib.concatStringsSep ", " (map (s: ''"${s}"'') (versions "17"))}],
121136
}
122137
extension_name = "${pname}"
123-
support_upgrade = False
124138
pg17_configuration = "${pg17-configuration}"
125139
ext_has_background_worker = ${
126140
if (installedExtension "15") ? hasBackgroundWorker then "True" else "False"
@@ -135,7 +149,7 @@ self.inputs.nixpkgs.lib.nixos.runTest {
135149
server.wait_for_unit("multi-user.target")
136150
server.wait_for_unit("postgresql.service")
137151
138-
test = PostgresExtensionTest(server, extension_name, versions, sql_test_directory, support_upgrade)
152+
test = PostgresExtensionTest(server, extension_name, versions, sql_test_directory)
139153
140154
with subtest("Check upgrade path with postgresql 15"):
141155
test.check_upgrade_path("15")

nix/ext/tests/plpgsql_check.nix

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,20 @@ self.inputs.nixpkgs.lib.nixos.runTest {
6161
enable = true;
6262
package = psql_15;
6363
enableTCPIP = true;
64-
initialScript = pkgs.writeText "init-postgres-with-password" ''
65-
CREATE USER test WITH PASSWORD 'secret';
66-
'';
6764
authentication = ''
68-
host test postgres samenet scram-sha-256
65+
local all postgres peer map=postgres
66+
local all all peer map=root
67+
'';
68+
identMap = ''
69+
root root supabase_admin
70+
postgres postgres postgres
6971
'';
72+
ensureUsers = [
73+
{
74+
name = "supabase_admin";
75+
ensureClauses.superuser = true;
76+
}
77+
];
7078
settings = (installedExtension "15").defaultSettings or { };
7179
};
7280

0 commit comments

Comments
 (0)