Skip to content

Commit 347b1d8

Browse files
committed
fix tests
1 parent 7b2a796 commit 347b1d8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

internal/pgbackrest/postgres.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ func PostgreSQL(
3636
archive += ` if [ ! -z ${timestamp} ]; then echo ${timestamp} > /pgdata/latest_commit_timestamp.txt; fi`
3737

3838
outParameters.Mandatory.Add("archive_mode", "on")
39-
outParameters.Mandatory.Add("archive_command", archive)
39+
40+
if backupsEnabled {
41+
outParameters.Mandatory.Add("archive_command", archive)
42+
} else {
43+
// If backups are disabled, keep archive_mode on (to avoid a Postgres restart)
44+
// and throw away WAL.
45+
outParameters.Mandatory.Add("archive_command", `true`)
46+
}
4047

4148
// K8SPG-518: This parameter is required to ensure that the commit timestamp is
4249
// included in the WAL file. This is necessary for the WAL watcher to

internal/pgbackrest/postgres_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func TestPostgreSQLParameters(t *testing.T) {
5151
}
5252
cluster.Spec.Patroni.DynamicConfiguration = dynamic
5353

54-
PostgreSQL(cluster, parameters)
54+
PostgreSQL(cluster, parameters, true)
5555
assert.DeepEqual(t, parameters.Mandatory.AsMap(), map[string]string{
5656
"archive_mode": "on",
5757
"archive_command": strings.Join([]string{

0 commit comments

Comments
 (0)