@@ -11,6 +11,8 @@ import (
1111
1212 "github.com/stretchr/testify/assert"
1313 "github.com/stretchr/testify/require"
14+
15+ "gitlab.com/postgres-ai/database-lab/v3/internal/provision/resources"
1416)
1517
1618func TestInitParamsExtraction (t * testing.T ) {
@@ -83,3 +85,33 @@ some_other_param setting: value
8385 require .NoError (t , err )
8486 assert .Empty (t , settings )
8587}
88+
89+ func TestRestoreJobReload_CustomOptions (t * testing.T ) {
90+ r := & RestoreJob {fsPool : & resources.Pool {MountDir : "/" , PoolDirName : "pgdata" }}
91+
92+ err := r .Reload (map [string ]interface {}{
93+ "tool" : walgTool ,
94+ "walg" : map [string ]interface {}{
95+ "backupName" : "LATEST" ,
96+ "customOptions" : []interface {}{"--mask" , "'base/*'" },
97+ },
98+ "pgbackrest" : map [string ]interface {}{
99+ "stanza" : "main" ,
100+ "customOptions" : []interface {}{"--db-include=mydb" },
101+ },
102+ })
103+ require .NoError (t , err )
104+
105+ assert .Equal (t , []string {"--mask" , "'base/*'" }, r .WALG .CustomOptions )
106+ assert .Equal (t , []string {"--db-include=mydb" }, r .PgBackRest .CustomOptions )
107+
108+ walgRestorer , err := r .getRestorer (nil , walgTool )
109+ require .NoError (t , err )
110+ assert .Equal (t , "wal-g backup-fetch /pgdata LATEST --mask 'base/*'" , walgRestorer .GetRestoreCommand ())
111+
112+ pgBackRestRestorer , err := r .getRestorer (nil , pgbackrestTool )
113+ require .NoError (t , err )
114+ assert .Equal (t , "sudo -Eu postgres pgbackrest --type=standby --pg1-path=${PGDATA} --stanza=main restore " +
115+ "--recovery-option=restore_command='pgbackrest --pg1-path=${PGDATA} --stanza=main archive-get %f %p' --db-include=mydb" ,
116+ pgBackRestRestorer .GetRestoreCommand ())
117+ }
0 commit comments