@@ -16,6 +16,7 @@ limitations under the License.
16
16
package singlehost
17
17
18
18
import (
19
+ "strings"
19
20
"testing"
20
21
"time"
21
22
@@ -247,20 +248,40 @@ func TestSingleHostDefaultNetwork_sanity(t *testing.T) {
247
248
utils .DockerCleanup (t , node , "myContainer2" )
248
249
}()
249
250
251
+ // confirm the default gateway in one of the containers
252
+ output , err := node .RunCommandWithOutput ("docker exec myContainer1 /sbin/ip route" )
253
+ if err != nil {
254
+ t .Fatalf ("Error - unable to get default ip route, output = '%s'" , output )
255
+ }
256
+ if ! strings .Contains (output , "default via 100.1.0.254" ) {
257
+ t .Fatalf ("Error - unable to confirm container's default ip route, output = '%s'" , output )
258
+ }
259
+
250
260
jsonCfg = `
251
261
{
252
262
"Tenants" : [ {
253
263
"Name" : "tee-one",
254
264
"Networks" : [ {
255
- "Name" : "orange"
265
+ "Name" : "orange",
266
+ "Endpoints" : [ {
267
+ "Container" : "myContainer1",
268
+ "Host" : "host1"
269
+ } ]
256
270
} ]
257
271
} ]
258
272
}`
259
273
260
274
// deletion would result into unassignment
261
275
utils .DelConfig (t , jsonCfg , testbed .GetNodes ()[0 ])
262
276
time .Sleep (1 * time .Second )
263
- if utils .NetworkStateExists (node , "orange" , "" ) == nil {
264
- t .Fatalf ("Error - network %s doesn't seem to be deleted \n " , "green" )
277
+
278
+ // confirm the default gateway in one of the containers
279
+ output , err = node .RunCommandWithOutput ("docker exec myContainer1 /sbin/ip route" )
280
+ if err != nil {
281
+ t .Fatalf ("Error - unable to get default ip route, output = '%s'" , output )
282
+ }
283
+ if strings .Contains (output , "default via 100.1.0.254" ) {
284
+ t .Fatalf ("Error - able to still find the default rout after network is deleted output = '%s'" , output )
265
285
}
286
+
266
287
}
0 commit comments