@@ -7,31 +7,33 @@ import (
77)
88
99func TestPgBackRestRecoveryConfig (t * testing.T ) {
10- pgbackrest := newPgBackRest ("dataDir" , pgbackrestOptions {Stanza : "stanzaName" })
10+ pgbackrest := newPgBackRest (pgbackrestOptions {Stanza : "stanzaName" })
1111
1212 recoveryConfig := pgbackrest .GetRecoveryConfig (11.7 )
1313 expectedResponse11 := map [string ]string {
14- "restore_command" : "pgbackrest --pg1-path=dataDir --stanza=stanzaName archive-get %f %p" ,
14+ "restore_command" : "pgbackrest --pg1-path=${PGDATA} --stanza=stanzaName archive-get %f %p" ,
1515 "recovery_target_timeline" : "latest" ,
1616 }
1717 assert .Equal (t , expectedResponse11 , recoveryConfig )
1818
1919 recoveryConfig = pgbackrest .GetRecoveryConfig (12.3 )
2020 expectedResponse12 := map [string ]string {
21- "restore_command" : "pgbackrest --pg1-path=dataDir --stanza=stanzaName archive-get %f %p" ,
21+ "restore_command" : "pgbackrest --pg1-path=${PGDATA} --stanza=stanzaName archive-get %f %p" ,
2222 }
2323 assert .Equal (t , expectedResponse12 , recoveryConfig )
2424}
2525
2626func TestPgBackRestRestoreCommand (t * testing.T ) {
27- pgbackrest := newPgBackRest ("dataDir" , pgbackrestOptions {Stanza : "stanzaName" })
27+ pgbackrest := newPgBackRest (pgbackrestOptions {Stanza : "stanzaName" })
2828
2929 restoreCmd := pgbackrest .GetRestoreCommand ()
30- expectedResponse := "sudo -Eu postgres pgbackrest --type=standby --pg1-path=dataDir --stanza=stanzaName restore"
30+ expectedResponse := "sudo -Eu postgres pgbackrest --type=standby --pg1-path=${PGDATA} --stanza=stanzaName restore " +
31+ "--recovery-option=restore_command='pgbackrest --pg1-path=${PGDATA} --stanza=stanzaName archive-get %f %p'"
3132 assert .Equal (t , expectedResponse , restoreCmd )
3233
3334 pgbackrest .options .ForceInit = true
3435 restoreCmd = pgbackrest .GetRestoreCommand ()
35- expectedResponse = "sudo -Eu postgres pgbackrest --delta --type=standby --pg1-path=dataDir --stanza=stanzaName restore"
36+ expectedResponse = "sudo -Eu postgres pgbackrest --type=standby --pg1-path=${PGDATA} --stanza=stanzaName restore " +
37+ "--recovery-option=restore_command='pgbackrest --pg1-path=${PGDATA} --stanza=stanzaName archive-get %f %p' --delta"
3638 assert .Equal (t , expectedResponse , restoreCmd )
3739}
0 commit comments