@@ -16,16 +16,22 @@ func Test_ListLB(t *testing.T) {
1616 BeforeFunc : createLB (),
1717 Cmd : "scw lb lb list" ,
1818 Check : core .TestCheckGolden (),
19- AfterFunc : deleteLB (),
19+ AfterFunc : core .AfterFuncCombine (
20+ deleteLB (),
21+ deleteLBFlexibleIP (),
22+ ),
2023 }))
2124}
2225
2326func Test_CreateLB (t * testing.T ) {
2427 t .Run ("Simple" , core .Test (& core.TestConfig {
25- Commands : lb .GetCommands (),
26- Cmd : "scw lb lb create name=foobar description=foobar --wait" ,
27- Check : core .TestCheckGolden (),
28- AfterFunc : core .ExecAfterCmd ("scw lb lb delete {{ .CmdResult.ID }}" ),
28+ Commands : lb .GetCommands (),
29+ Cmd : "scw lb lb create name=foobar description=foobar --wait" ,
30+ Check : core .TestCheckGolden (),
31+ AfterFunc : core .AfterFuncCombine (
32+ core .ExecAfterCmd ("scw lb lb delete {{ .CmdResult.ID }} --wait" ),
33+ core .ExecAfterCmd ("scw lb ip delete {{ (index .CmdResult.IP 0).ID }}" ),
34+ ),
2935 }))
3036}
3137
@@ -35,7 +41,10 @@ func Test_GetLB(t *testing.T) {
3541 BeforeFunc : createLB (),
3642 Cmd : "scw lb lb get {{ .LB.ID }}" ,
3743 Check : core .TestCheckGolden (),
38- AfterFunc : deleteLB (),
44+ AfterFunc : core .AfterFuncCombine (
45+ deleteLB (),
46+ deleteLBFlexibleIP (),
47+ ),
3948 }))
4049}
4150
@@ -48,7 +57,10 @@ func Test_UpdateLBIPv6(t *testing.T) {
4857 core .TestCheckExitCode (0 ),
4958 core .TestCheckGolden (),
5059 ),
51- AfterFunc : deleteLB (),
60+ AfterFunc : core .AfterFuncCombine (
61+ deleteLB (),
62+ deleteLBFlexibleIP (),
63+ ),
5264 }))
5365
5466 t .Run ("IPID" , core .Test (& core.TestConfig {
@@ -73,9 +85,12 @@ func Test_WaitLB(t *testing.T) {
7385 "LB" ,
7486 "scw lb lb create name=cli-test description=cli-test" ,
7587 ),
76- Cmd : "scw lb lb wait {{ .LB.ID }}" ,
77- Check : core .TestCheckGolden (),
78- AfterFunc : deleteLB (),
88+ Cmd : "scw lb lb wait {{ .LB.ID }}" ,
89+ Check : core .TestCheckGolden (),
90+ AfterFunc : core .AfterFuncCombine (
91+ deleteLB (),
92+ deleteLBFlexibleIP (),
93+ ),
7994 }))
8095}
8196
@@ -104,6 +119,7 @@ func Test_GetStats(t *testing.T) {
104119 AfterFunc : core .AfterFuncCombine (
105120 deleteLB (),
106121 deleteInstance (),
122+ deleteLBFlexibleIP (),
107123 ),
108124 }))
109125}
0 commit comments