@@ -24,9 +24,14 @@ func Test_CreateBackup(t *testing.T) {
2424 },
2525 ),
2626 ),
27- Cmd : "scw rdb backup create name=foobar expires-at=2032-01-02T15:04:05-07:00 instance-id={{ .Instance.ID }} database-name=rdb --wait" ,
28- Check : core .TestCheckGolden (),
29- AfterFunc : deleteInstance (),
27+ Cmd : "scw rdb backup create name=foobar expires-at=2032-01-02T15:04:05-07:00 instance-id={{ .Instance.ID }} database-name=rdb --wait" ,
28+ Check : core .TestCheckGolden (),
29+ AfterFunc : core .AfterFuncCombine (
30+ core .AfterFuncWhenUpdatingCassette (
31+ core .ExecAfterCmd ("scw rdb backup delete {{ .CmdResult.ID }}" ),
32+ ),
33+ deleteInstance (),
34+ ),
3035 DefaultRegion : scw .RegionNlAms ,
3136 }))
3237}
@@ -54,7 +59,12 @@ func Test_RestoreBackup(t *testing.T) {
5459 core .TestCheckGolden (),
5560 core .TestCheckExitCode (0 ),
5661 ),
57- AfterFunc : deleteInstance (),
62+ AfterFunc : core .AfterFuncCombine (
63+ core .AfterFuncWhenUpdatingCassette (
64+ core .ExecAfterCmd ("scw rdb backup delete {{ .Backup.ID }}" ),
65+ ),
66+ deleteInstance (),
67+ ),
5868 }))
5969}
6070
@@ -81,7 +91,12 @@ func Test_ExportBackup(t *testing.T) {
8191 core .TestCheckGolden (),
8292 core .TestCheckExitCode (0 ),
8393 ),
84- AfterFunc : deleteInstance (),
94+ AfterFunc : core .AfterFuncCombine (
95+ core .AfterFuncWhenUpdatingCassette (
96+ core .ExecAfterCmd ("scw rdb backup delete {{ .Backup.ID }}" ),
97+ ),
98+ deleteInstance (),
99+ ),
85100 }))
86101}
87102
@@ -105,6 +120,9 @@ func Test_DownloadBackup(t *testing.T) {
105120 core .TestCheckExitCode (0 ),
106121 ),
107122 AfterFunc : core .AfterFuncCombine (
123+ core .AfterFuncWhenUpdatingCassette (
124+ core .ExecAfterCmd ("scw rdb backup delete {{ .Backup.ID }}" ),
125+ ),
108126 deleteInstance (),
109127 func (_ * core.AfterFuncCtx ) error {
110128 err := os .Remove ("simple_dump" )
@@ -131,6 +149,9 @@ func Test_DownloadBackup(t *testing.T) {
131149 core .TestCheckExitCode (0 ),
132150 ),
133151 AfterFunc : core .AfterFuncCombine (
152+ core .AfterFuncWhenUpdatingCassette (
153+ core .ExecAfterCmd ("scw rdb backup delete {{ .Backup.ID }}" ),
154+ ),
134155 deleteInstance (),
135156 func (_ * core.AfterFuncCtx ) error {
136157 err := os .Remove ("no_previous_export_dump" )
@@ -169,6 +190,14 @@ func Test_ListBackup(t *testing.T) {
169190 core .TestCheckGolden (),
170191 core .TestCheckExitCode (0 ),
171192 ),
172- AfterFunc : deleteInstance (),
193+ AfterFunc : core .AfterFuncCombine (
194+ core .AfterFuncWhenUpdatingCassette (
195+ core .AfterFuncCombine (
196+ core .ExecAfterCmd ("scw rdb backup delete {{ .BackupA.ID }}" ),
197+ core .ExecAfterCmd ("scw rdb backup delete {{ .BackupB.ID }}" ),
198+ ),
199+ ),
200+ deleteInstance (),
201+ ),
173202 }))
174203}
0 commit comments