Skip to content

Commit 02b8f1c

Browse files
committed
fix test and add example
1 parent d40f0d9 commit 02b8f1c

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

deploy/cr.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ spec:
469469
# dynamicConfiguration:
470470
# postgresql:
471471
# parameters:
472+
# restore_command: "pgbackrest --stanza=db archive-get %f \"%p\""
472473
# max_parallel_workers: 2
473474
# max_worker_processes: 2
474475
# shared_buffers: 1GB

internal/pgbackrest/postgres_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ func TestPostgreSQLParameters(t *testing.T) {
5555
assert.DeepEqual(t, parameters.Mandatory.AsMap(), map[string]string{
5656
"archive_mode": "on",
5757
"archive_command": strings.Join([]string{
58-
`pgbackrest --stanza=db archive-push "%p"`,
59-
` && timestamp=$(pg_waldump "%p" | grep COMMIT | awk '{print $(NF`,
60-
`-2) "T" $(NF-1) " " $(NF)}' | sed -E 's/([0-9]{4}-[0-9]{2}-[0-9]`,
61-
`{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{6}) (UTC|[\+\-][0-9]{2})/\`,
62-
`1\2/' | sed 's/UTC/Z/' | tail -n 1 | grep -E '^[0-9]{4}-[0-9]{2}`,
63-
`-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{6}(Z|[\+\-][0-9]{2})`,
64-
"$'); if [ ! -z ${timestamp} ]; then echo ${timestamp} > /pgdata/l",
65-
"atest_commit_timestamp.txt; fi",
58+
`pgbackrest --stanza=db archive-push "%p" `,
59+
`&& timestamp=$(pg_waldump "%p" | `,
60+
`grep -oP "COMMIT \K[^;]+" | `,
61+
`sed -E "s/([0-9]{4}-[0-9]{2}-[0-9]{2}) ([0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{6}) (UTC|[\\+\\-][0-9]{2})/\1T\2\3/" | `,
62+
`sed "s/UTC/Z/" | `,
63+
"tail -n 1 | ",
64+
`grep -E "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{6}(Z|[\+\-][0-9]{2})$"); `,
65+
"if [ ! -z ${timestamp} ]; then echo ${timestamp} > /pgdata/latest_commit_timestamp.txt; fi",
6666
}, ""),
6767
"restore_command": "/bin/true",
6868
"track_commit_timestamp": "true",

0 commit comments

Comments
 (0)