@@ -50,10 +50,40 @@ func TestPostgreSQLParameters(t *testing.T) {
50
50
"archive_timeout" : "60s" ,
51
51
})
52
52
53
+ dynamic := map [string ]any {
54
+ "postgresql" : map [string ]any {
55
+ "parameters" : map [string ]any {
56
+ "restore_command" : "/bin/true" ,
57
+ },
58
+ },
59
+ }
60
+ if cluster .Spec .Patroni == nil {
61
+ cluster .Spec .Patroni = & v1beta1.PatroniSpec {}
62
+ }
63
+ cluster .Spec .Patroni .DynamicConfiguration = dynamic
64
+
65
+ PostgreSQL (cluster , parameters )
66
+ assert .DeepEqual (t , parameters .Mandatory .AsMap (), map [string ]string {
67
+ "archive_mode" : "on" ,
68
+ "archive_command" : strings .Join ([]string {
69
+ `pgbackrest --stanza=db archive-push "%p"` ,
70
+ ` && timestamp=$(pg_waldump "%p" | grep COMMIT | awk '{print $(NF` ,
71
+ `-2) "T" $(NF-1) " " $(NF)}' | sed -E 's/([0-9]{4}-[0-9]{2}-[0-9]` ,
72
+ `{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{6}) (UTC|[\+\-][0-9]{2})/\` ,
73
+ `1\2/' | sed 's/UTC/Z/' | tail -n 1 | grep -E '^[0-9]{4}-[0-9]{2}` ,
74
+ `-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{6}(Z|[\+\-][0-9]{2})` ,
75
+ "$'); if [ ! -z ${timestamp} ]; then echo ${timestamp} > /pgdata/l" ,
76
+ "atest_commit_timestamp.txt; fi" ,
77
+ }, "" ),
78
+ "restore_command" : "/bin/true" ,
79
+ "track_commit_timestamp" : "true" ,
80
+ })
81
+
53
82
cluster .Spec .Standby = & v1beta1.PostgresStandbySpec {
54
83
Enabled : true ,
55
84
RepoName : "repo99" ,
56
85
}
86
+ cluster .Spec .Patroni .DynamicConfiguration = nil
57
87
58
88
PostgreSQL (cluster , parameters )
59
89
assert .DeepEqual (t , parameters .Mandatory .AsMap (), map [string ]string {
0 commit comments