66 "github.com/scaleway/scaleway-cli/v2/core"
77 "github.com/scaleway/scaleway-cli/v2/internal/namespaces/instance/v1"
88 "github.com/scaleway/scaleway-cli/v2/internal/namespaces/vpc/v2"
9+ "github.com/scaleway/scaleway-cli/v2/internal/testhelpers"
910)
1011
1112func Test_ListNICs (t * testing.T ) {
@@ -15,14 +16,18 @@ func Test_ListNICs(t *testing.T) {
1516 t .Run ("Simple" , core .Test (& core.TestConfig {
1617 Commands : cmds ,
1718 BeforeFunc : core .BeforeFuncCombine (
18- createPN (),
19+ testhelpers . CreatePN (),
1920 createServer ("Server" ),
2021 createNIC (),
2122 ),
2223 Cmd : "scw instance private-nic list server-id={{ .Server.ID }}" ,
2324 Check : core .TestCheckCombine (
2425 core .TestCheckGolden (),
2526 ),
27+ AfterFunc : core .AfterFuncCombine (
28+ deleteServer ("Server" ),
29+ testhelpers .DeletePN (),
30+ ),
2631 }))
2732}
2833
@@ -33,26 +38,34 @@ func Test_GetPrivateNIC(t *testing.T) {
3338 t .Run ("Get from ID" , core .Test (& core.TestConfig {
3439 Commands : cmds ,
3540 BeforeFunc : core .BeforeFuncCombine (
36- createPN (),
41+ testhelpers . CreatePN (),
3742 createServer ("Server" ),
3843 createNIC (),
3944 ),
4045 Cmd : "scw instance private-nic get server-id={{ .Server.ID }} private-nic-id={{ .NIC.PrivateNic.ID }}" ,
4146 Check : core .TestCheckCombine (
4247 core .TestCheckGolden (),
4348 ),
49+ AfterFunc : core .AfterFuncCombine (
50+ deleteServer ("Server" ),
51+ testhelpers .DeletePN (),
52+ ),
4453 }))
4554
4655 t .Run ("Get from MAC address" , core .Test (& core.TestConfig {
4756 Commands : cmds ,
4857 BeforeFunc : core .BeforeFuncCombine (
49- createPN (),
58+ testhelpers . CreatePN (),
5059 createServer ("Server" ),
5160 createNIC (),
5261 ),
5362 Cmd : "scw instance private-nic get server-id={{ .Server.ID }} private-nic-id={{ .NIC.PrivateNic.MacAddress }}" ,
5463 Check : core .TestCheckCombine (
5564 core .TestCheckGolden (),
5665 ),
66+ AfterFunc : core .AfterFuncCombine (
67+ deleteServer ("Server" ),
68+ testhelpers .DeletePN (),
69+ ),
5770 }))
5871}
0 commit comments