Skip to content

Commit 9b25655

Browse files
authored
Merge branch 'scaleway:master' into master
2 parents b4738fd + 81623ad commit 9b25655

File tree

4 files changed

+45
-10
lines changed

4 files changed

+45
-10
lines changed

internal/namespaces/iot/v1/custom.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,14 @@ func GetCommands() *core.Commands {
2020
iot.DeviceStatus(""),
2121
human.EnumMarshalFunc(deviceStatusMarshalSpecs),
2222
)
23-
human.RegisterMarshalerFunc(iot.CreateNetworkResponse{}, iotNetworkCreateResponsedMarshalerFunc)
24-
human.RegisterMarshalerFunc(iot.CreateDeviceResponse{}, iotDeviceCreateResponsedMarshalerFunc)
23+
human.RegisterMarshalerFunc(
24+
&iot.CreateNetworkResponse{},
25+
iotNetworkCreateResponsedMarshalerFunc,
26+
)
27+
human.RegisterMarshalerFunc(
28+
&iot.CreateDeviceResponse{},
29+
iotDeviceCreateResponsedMarshalerFunc,
30+
)
2531

2632
cmds.MustFind("iot", "hub", "create").Override(hubCreateBuilder)
2733

internal/namespaces/iot/v1/custom_device.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var (
3333

3434
func iotDeviceCreateResponsedMarshalerFunc(i any, opt *human.MarshalOpt) (string, error) {
3535
type tmp iot.CreateDeviceResponse
36-
deviceCreateResponse := tmp(i.(iot.CreateDeviceResponse))
36+
deviceCreateResponse := tmp(*i.(*iot.CreateDeviceResponse))
3737

3838
deviceContent, err := human.Marshal(deviceCreateResponse.Device, opt)
3939
if err != nil {

internal/namespaces/iot/v1/custom_network.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
func iotNetworkCreateResponsedMarshalerFunc(i any, opt *human.MarshalOpt) (string, error) {
1313
type tmp iot.CreateNetworkResponse
14-
networkCreateResponse := tmp(i.(iot.CreateNetworkResponse))
14+
networkCreateResponse := tmp(*i.(*iot.CreateNetworkResponse))
1515

1616
networkContent, err := human.Marshal(networkCreateResponse.Network, opt)
1717
if err != nil {

internal/namespaces/rdb/v1/custom_backup_test.go

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)