Skip to content

Commit 36e1436

Browse files
committed
fix TestGenerateSpiloJSONConfiguration
1 parent afbe602 commit 36e1436

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

pkg/cluster/k8sres_test.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,15 @@ func TestGenerateSpiloJSONConfiguration(t *testing.T) {
8484
tdeConfig: TDEConfig{
8585
Enabled: false,
8686
},
87-
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin"},"bootstrap":{"initdb":[{"auth-host":"scram-sha-256"},{"auth-local":"trust"}],"users":{"humans":{"password":"","options":["CREATEDB","NOLOGIN"]}},"dcs":{}}}`,
87+
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin"},"bootstrap":{"initdb":[{"auth-host":"scram-sha-256"},"data-checksums",{"auth-local":"trust"},{"encoding":"UTF8"},{"locale":"en_US.UTF-8"},{"locale-provider":"icu"},{"icu-locale":"en_US"}],"users":null,"dcs":{}}}`,
8888
},
8989
{
9090
subtest: "Patroni configured",
9191
pgParam: &cpov1.PostgresqlParam{PgVersion: "17"},
9292
patroni: &cpov1.Patroni{
9393
InitDB: map[string]string{
94-
"encoding": "UTF8",
95-
"locale": "en_US.UTF-8",
96-
"data-checksums": "true",
94+
"encoding": "UTF8",
95+
"locale": "en_US.UTF-8",
9796
},
9897
PgHba: []string{"hostssl all all 0.0.0.0/0 scram-sha-256", "host all all 0.0.0.0/0 scram-sha-256"},
9998
TTL: 30,
@@ -114,7 +113,7 @@ func TestGenerateSpiloJSONConfiguration(t *testing.T) {
114113
tdeConfig: TDEConfig{
115114
Enabled: false,
116115
},
117-
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin","pg_hba":["hostssl all all 0.0.0.0/0 scram-sha-256","host all all 0.0.0.0/0 scram-sha-256"]},"bootstrap":{"initdb":[{"auth-host":"scram-sha-256"},{"auth-local":"trust"},"data-checksums",{"encoding":"UTF8"},{"locale":"en_US.UTF-8"}],"users":{"humans":{"password":"","options":["CREATEDB","NOLOGIN"]}},"dcs":{"ttl":30,"loop_wait":10,"retry_timeout":10,"maximum_lag_on_failover":33554432,"synchronous_mode":true,"synchronous_mode_strict":true,"synchronous_node_count":1,"slots":{"permanent_logical_1":{"database":"foo","plugin":"pgoutput","type":"logical"}},"failsafe_mode":true}}}`,
116+
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin","pg_hba":["hostssl all all 0.0.0.0/0 scram-sha-256","host all all 0.0.0.0/0 scram-sha-256"]},"bootstrap":{"initdb":[{"auth-host":"scram-sha-256"},"data-checksums",{"auth-local":"trust"},{"encoding":"UTF8"},{"locale":"en_US.UTF-8"},{"locale-provider":"icu"},{"icu-locale":"en_US"}],"users":null,"dcs":{"ttl":30,"loop_wait":10,"retry_timeout":10,"maximum_lag_on_failover":33554432,"synchronous_mode":true,"synchronous_mode_strict":true,"synchronous_node_count":1,"slots":{"permanent_logical_1":{"database":"foo","plugin":"pgoutput","type":"logical"}},"failsafe_mode":true}}}`,
118117
},
119118
{
120119
subtest: "Patroni failsafe_mode configured globally",
@@ -129,7 +128,7 @@ func TestGenerateSpiloJSONConfiguration(t *testing.T) {
129128
tdeConfig: TDEConfig{
130129
Enabled: false,
131130
},
132-
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin"},"bootstrap":{"initdb":[{"auth-host":"scram-sha-256"},{"auth-local":"trust"}],"users":{"humans":{"password":"","options":["CREATEDB","NOLOGIN"]}},"dcs":{"failsafe_mode":true}}}`,
131+
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin"},"bootstrap":{"initdb":[{"auth-host":"scram-sha-256"},"data-checksums",{"auth-local":"trust"},{"encoding":"UTF8"},{"locale":"en_US.UTF-8"},{"locale-provider":"icu"},{"icu-locale":"en_US"}],"users":null,"dcs":{"failsafe_mode":true}}}`,
133132
},
134133
{
135134
subtest: "Patroni failsafe_mode configured globally, disabled for cluster",
@@ -146,7 +145,7 @@ func TestGenerateSpiloJSONConfiguration(t *testing.T) {
146145
tdeConfig: TDEConfig{
147146
Enabled: false,
148147
},
149-
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin"},"bootstrap":{"initdb":[{"auth-host":"scram-sha-256"},{"auth-local":"trust"}],"users":{"humans":{"password":"","options":["CREATEDB","NOLOGIN"]}},"dcs":{"failsafe_mode":false}}}`,
148+
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin"},"bootstrap":{"initdb":[{"auth-host":"scram-sha-256"},"data-checksums",{"auth-local":"trust"},{"encoding":"UTF8"},{"locale":"en_US.UTF-8"},{"locale-provider":"icu"},{"icu-locale":"en_US"}],"users":null,"dcs":{"failsafe_mode":false}}}`,
150149
},
151150
{
152151
subtest: "Patroni failsafe_mode disabled globally, configured for cluster",
@@ -163,7 +162,7 @@ func TestGenerateSpiloJSONConfiguration(t *testing.T) {
163162
tdeConfig: TDEConfig{
164163
Enabled: false,
165164
},
166-
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin"},"bootstrap":{"initdb":[{"auth-host":"scram-sha-256"},{"auth-local":"trust"}],"users":{"humans":{"password":"","options":["CREATEDB","NOLOGIN"]}},"dcs":{"failsafe_mode":true}}}`,
165+
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin"},"bootstrap":{"initdb":[{"auth-host":"scram-sha-256"},"data-checksums",{"auth-local":"trust"},{"encoding":"UTF8"},{"locale":"en_US.UTF-8"},{"locale-provider":"icu"},{"icu-locale":"en_US"}],"users":null,"dcs":{"failsafe_mode":true}}}`,
167166
},
168167
{
169168
subtest: "TDE enabled with 256 bits",
@@ -178,7 +177,7 @@ func TestGenerateSpiloJSONConfiguration(t *testing.T) {
178177
Enabled: true,
179178
KeyBits: "256",
180179
},
181-
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin"},"bootstrap":{"initdb":[{"auth-host":"scram-sha-256"},{"auth-local":"trust"},{"encryption-key-command": "/tmp/tde.sh"},{"key-bits":"256"}],"users":{"humans":{"password":"","options":["CREATEDB","NOLOGIN"]}},"dcs":{}}}`,
180+
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin"},"bootstrap":{"initdb":[{"auth-host":"scram-sha-256"},"data-checksums",{"auth-local":"trust"},{"encoding":"UTF8"},{"locale":"en_US.UTF-8"},{"locale-provider":"icu"},{"icu-locale":"en_US"},{"encryption-key-command":"/tmp/tde.sh"},{"key-bits":"256"}],"users":null,"dcs":{}}}`,
182181
},
183182
}
184183
for _, tt := range tests {

0 commit comments

Comments
 (0)