1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/libnetwork/test/integration/dnet/simple.bats
Jana Radhakrishnan a22ce0938c Add bridge network integration tests
Add a few bridge network integration tests which
specifically deals with multiple bridge networks
and libnetwork restart and persistence

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-10-06 14:16:26 -07:00

80 lines
2.6 KiB
Bash

#!/usr/bin/env bats
load helpers
@test "Test network create" {
echo $(docker ps)
run dnet_cmd $(inst_id2port 1) network create -d test mh1
echo ${output}
[ "$status" -eq 0 ]
run dnet_cmd $(inst_id2port 1) network ls
echo ${output}
line=$(dnet_cmd $(inst_id2port 1) network ls | grep mh1)
echo ${line}
name=$(echo ${line} | cut -d" " -f2)
driver=$(echo ${line} | cut -d" " -f3)
echo ${name} ${driver}
[ "$name" = "mh1" ]
[ "$driver" = "test" ]
dnet_cmd $(inst_id2port 1) network rm mh1
}
@test "Test network delete with id" {
echo $(docker ps)
run dnet_cmd $(inst_id2port 1) network create -d test mh1
[ "$status" -eq 0 ]
echo ${output}
dnet_cmd $(inst_id2port 1) network rm ${output}
}
@test "Test service create" {
echo $(docker ps)
dnet_cmd $(inst_id2port 1) network create -d test multihost
run dnet_cmd $(inst_id2port 1) service publish svc1.multihost
echo ${output}
[ "$status" -eq 0 ]
run dnet_cmd $(inst_id2port 1) service ls
echo ${output}
echo ${lines[1]}
[ "$status" -eq 0 ]
svc=$(echo ${lines[1]} | cut -d" " -f2)
network=$(echo ${lines[1]} | cut -d" " -f3)
echo ${svc} ${network}
[ "$network" = "multihost" ]
[ "$svc" = "svc1" ]
dnet_cmd $(inst_id2port 1) service unpublish svc1.multihost
dnet_cmd $(inst_id2port 1) network rm multihost
}
@test "Test service delete with id" {
echo $(docker ps)
dnet_cmd $(inst_id2port 1) network create -d test multihost
run dnet_cmd $(inst_id2port 1) service publish svc1.multihost
[ "$status" -eq 0 ]
echo ${output}
run dnet_cmd $(inst_id2port 1) service ls
[ "$status" -eq 0 ]
echo ${output}
echo ${lines[1]}
id=$(echo ${lines[1]} | cut -d" " -f1)
dnet_cmd $(inst_id2port 1) service unpublish ${id}.multihost
dnet_cmd $(inst_id2port 1) network rm multihost
}
@test "Test service attach" {
echo $(docker ps)
dnet_cmd $(inst_id2port 1) network create -d test multihost
dnet_cmd $(inst_id2port 1) service publish svc1.multihost
dnet_cmd $(inst_id2port 1) container create container_1
dnet_cmd $(inst_id2port 1) service attach container_1 svc1.multihost
run dnet_cmd $(inst_id2port 1) service ls
[ "$status" -eq 0 ]
echo ${output}
echo ${lines[1]}
container=$(echo ${lines[1]} | cut -d" " -f4)
[ "$container" = "container_1" ]
dnet_cmd $(inst_id2port 1) service detach container_1 svc1.multihost
dnet_cmd $(inst_id2port 1) container rm container_1
dnet_cmd $(inst_id2port 1) service unpublish svc1.multihost
dnet_cmd $(inst_id2port 1) network rm multihost
}