@@ -955,7 +955,7 @@ func TestPluginWindowsAdd(t *testing.T) {
955955 epInfo : & network.EndpointInfo {
956956 ContainerID : "test-container" ,
957957 Data : map [string ]interface {}{
958- "cnetAddressSpace" : ( []string ) (nil ),
958+ "cnetAddressSpace" : []string (nil ),
959959 },
960960 Routes : []network.RouteInfo {},
961961 EnableSnatOnHost : true ,
@@ -1010,7 +1010,7 @@ func TestPluginWindowsAdd(t *testing.T) {
10101010 epInfo : & network.EndpointInfo {
10111011 ContainerID : "test-container" ,
10121012 Data : map [string ]interface {}{
1013- "cnetAddressSpace" : ( []string ) (nil ),
1013+ "cnetAddressSpace" : []string (nil ),
10141014 },
10151015 Routes : []network.RouteInfo {},
10161016 EnableSnatOnHost : true ,
@@ -1189,25 +1189,26 @@ func TestPluginWindowsAdd(t *testing.T) {
11891189 allEndpoints , _ := tt .plugin .nm .GetAllEndpoints ("" )
11901190 require .Len (t , allEndpoints , len (tt .want ))
11911191 for _ , wantedEndpointEntry := range tt .want {
1192- epId := "none"
1192+ epID := "none"
11931193 for _ , endpointInfo := range allEndpoints {
1194- if tt .match (wantedEndpointEntry .epInfo , endpointInfo ) {
1195- // save the endpoint id before removing it
1196- epId = endpointInfo .EndpointID
1197- require .Regexp (t , regexp .MustCompile (wantedEndpointEntry .epIDRegex ), epId )
1194+ if ! tt .match (wantedEndpointEntry .epInfo , endpointInfo ) {
1195+ continue
1196+ }
1197+ // save the endpoint id before removing it
1198+ epID = endpointInfo .EndpointID
1199+ require .Regexp (t , regexp .MustCompile (wantedEndpointEntry .epIDRegex ), epID )
11981200
1199- // omit endpoint id and ifname fields as they are nondeterministic
1200- endpointInfo .EndpointID = ""
1201- endpointInfo .IfName = ""
1201+ // omit endpoint id and ifname fields as they are nondeterministic
1202+ endpointInfo .EndpointID = ""
1203+ endpointInfo .IfName = ""
12021204
1203- require .Equal (t , wantedEndpointEntry .epInfo , endpointInfo )
1204- break
1205- }
1205+ require .Equal (t , wantedEndpointEntry .epInfo , endpointInfo )
12061206 }
1207- if epId == "none" {
1207+ if epID == "none" {
12081208 t .Fail ()
12091209 }
1210- tt .plugin .nm .DeleteEndpoint ("" , epId , nil )
1210+ err = tt .plugin .nm .DeleteEndpoint ("" , epID , nil )
1211+ require .NoError (t , err )
12111212 }
12121213
12131214 // ensure deleted
0 commit comments