Skip to content

Commit 358355e

Browse files
committed
Add IT case for external connectivity
Added IT cases for external connectivity check for bridge and overlay networks, both initially and after a restart. Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
1 parent 12e912d commit 358355e

4 files changed

Lines changed: 36 additions & 4 deletions

File tree

cmd/dnet/dnet.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,16 @@ func (d *dnetConnection) dnetDaemon(cfgFile string) error {
225225
if err == nil {
226226
cOptions = processConfig(cfg)
227227
}
228+
229+
bridgeConfig := options.Generic{
230+
"EnableIPForwarding": true,
231+
"EnableIPTables": true,
232+
}
233+
234+
bridgeOption := options.Generic{netlabel.GenericData: bridgeConfig}
235+
236+
cOptions = append(cOptions, config.OptionDriverConfig("bridge", bridgeOption))
237+
228238
controller, err := libnetwork.New(cOptions...)
229239
if err != nil {
230240
fmt.Println("Error starting dnetDaemon :", err)

test/integration/dnet/bridge.bats

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ function test_single_network_connectivity() {
2020
# Now test connectivity between all the containers using service names
2121
for i in `seq ${start} ${end}`;
2222
do
23+
runc $(dnet_container_name 1 bridge) $(get_sbox_id 1 container_${i}) \
24+
"ping -c 1 www.google.com"
2325
for j in `seq ${start} ${end}`;
2426
do
2527
if [ "$i" -eq "$j" ]; then
@@ -49,6 +51,7 @@ function test_single_network_connectivity() {
4951
test_single_network_connectivity bridge 3
5052
}
5153

54+
5255
@test "Test default network dnet restart" {
5356
skip_for_circleci
5457

test/integration/dnet/helpers.bash

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ EOF
168168
-v $(pwd)/${TMPC_ROOT}:/scratch \
169169
-v /usr/local/bin/runc:/usr/local/bin/runc \
170170
-w /go/src/github.com/docker/libnetwork \
171-
golang:1.4 ./cmd/dnet/dnet -d -D ${hopt} -c ${tomlfile}
171+
mrjana/golang ./cmd/dnet/dnet -d -D ${hopt} -c ${tomlfile}
172+
172173
wait_for_dnet $(inst_id2port ${inst}) ${name}
173174
}
174175

@@ -256,14 +257,16 @@ function stop_zookeeper() {
256257

257258
function test_overlay() {
258259
dnet_suffix=$1
259-
shift
260260

261261
echo $(docker ps)
262262

263263
start=1
264264
end=3
265265
# Setup overlay network and connect containers ot it
266-
dnet_cmd $(inst_id2port 1) network create -d overlay multihost
266+
if [ -z "${2}" -o "${2}" != "skip_add" ]; then
267+
dnet_cmd $(inst_id2port 1) network create -d overlay multihost
268+
fi
269+
267270
for i in `seq ${start} ${end}`;
268271
do
269272
dnet_cmd $(inst_id2port $i) container create container_${i}
@@ -273,6 +276,8 @@ function test_overlay() {
273276
# Now test connectivity between all the containers using service names
274277
for i in `seq ${start} ${end}`;
275278
do
279+
runc $(dnet_container_name $i $dnet_suffix) $(get_sbox_id ${i} container_${i}) \
280+
"ping -c 1 www.google.com"
276281
for j in `seq ${start} ${end}`;
277282
do
278283
if [ "$i" -eq "$j" ]; then
@@ -290,7 +295,9 @@ function test_overlay() {
290295
dnet_cmd $(inst_id2port $i) container rm container_${i}
291296
done
292297

293-
dnet_cmd $(inst_id2port 2) network rm multihost
298+
if [ -z "${2}" -o "${2}" != "skip_rm" ]; then
299+
dnet_cmd $(inst_id2port 2) network rm multihost
300+
fi
294301
}
295302

296303
function check_etchosts() {

test/integration/dnet/overlay-consul.bats

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,15 @@ load helpers
1717
skip_for_circleci
1818
test_overlay_etchosts consul
1919
}
20+
21+
@test "Test overlay network with dnet restart" {
22+
skip_for_circleci
23+
test_overlay consul skip_rm
24+
docker restart dnet-1-consul
25+
wait_for_dnet $(inst_id2port 1) dnet-1-consul
26+
docker restart dnet-2-consul
27+
wait_for_dnet $(inst_id2port 2) dnet-2-consul
28+
docker restart dnet-3-consul
29+
wait_for_dnet $(inst_id2port 3) dnet-3-consul
30+
test_overlay consul skip_add
31+
}

0 commit comments

Comments
 (0)