@@ -7,31 +7,33 @@ import (
7
7
)
8
8
9
9
func TestPgBackRestRecoveryConfig (t * testing.T ) {
10
- pgbackrest := newPgBackRest ("dataDir" , pgbackrestOptions {Stanza : "stanzaName" })
10
+ pgbackrest := newPgBackRest (pgbackrestOptions {Stanza : "stanzaName" })
11
11
12
12
recoveryConfig := pgbackrest .GetRecoveryConfig (11.7 )
13
13
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" ,
15
15
"recovery_target_timeline" : "latest" ,
16
16
}
17
17
assert .Equal (t , expectedResponse11 , recoveryConfig )
18
18
19
19
recoveryConfig = pgbackrest .GetRecoveryConfig (12.3 )
20
20
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" ,
22
22
}
23
23
assert .Equal (t , expectedResponse12 , recoveryConfig )
24
24
}
25
25
26
26
func TestPgBackRestRestoreCommand (t * testing.T ) {
27
- pgbackrest := newPgBackRest ("dataDir" , pgbackrestOptions {Stanza : "stanzaName" })
27
+ pgbackrest := newPgBackRest (pgbackrestOptions {Stanza : "stanzaName" })
28
28
29
29
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'"
31
32
assert .Equal (t , expectedResponse , restoreCmd )
32
33
33
34
pgbackrest .options .ForceInit = true
34
35
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"
36
38
assert .Equal (t , expectedResponse , restoreCmd )
37
39
}
0 commit comments