automation: Connect 2 additional networks to docker
Adding 2 additional links to the running docker (3 in total) to allow complex test configurations to be supported. Due to the way docker adds the two additional interfaces (while the container is already running with NetworkManager, docker is editing the IP configuration), NetworkManager is stopped before the network is added and started again after. This avoids the scenario where NM detects the IP changes on the interface and therefore generates an in-memory profile. Signed-off-by: Edward Haas <edwardh@redhat.com>
This commit is contained in:
parent
21a65cdb8f
commit
53b4c8e2cc
@ -4,6 +4,9 @@ EXEC_PATH=$(dirname "$(realpath "$0")")
|
||||
PROJECT_PATH="$(dirname $EXEC_PATH)"
|
||||
DOCKER_IMAGE="nmstate/centos7-nmstate-dev"
|
||||
|
||||
NET0="nmstate-net0"
|
||||
NET1="nmstate-net1"
|
||||
|
||||
test -t 1 && USE_TTY="-t"
|
||||
|
||||
function remove_container {
|
||||
@ -11,6 +14,8 @@ function remove_container {
|
||||
[ "$res" -ne 0 ] && echo "*** ERROR: $res"
|
||||
docker stop $CONTAINER_ID
|
||||
docker rm $CONTAINER_ID
|
||||
docker network rm $NET0
|
||||
docker network rm $NET1
|
||||
}
|
||||
|
||||
function pyclean {
|
||||
@ -22,6 +27,13 @@ cd "$EXEC_PATH"
|
||||
|
||||
CONTAINER_ID="$(docker run --privileged -d -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v $PROJECT_PATH:/workspace/nmstate $DOCKER_IMAGE)"
|
||||
trap remove_container EXIT
|
||||
docker exec $USE_TTY -i $CONTAINER_ID /bin/bash -c 'systemctl stop NetworkManager'
|
||||
|
||||
docker network create $NET0 || true
|
||||
docker network create $NET1 || true
|
||||
docker network connect $NET0 $CONTAINER_ID
|
||||
docker network connect $NET1 $CONTAINER_ID
|
||||
|
||||
pyclean
|
||||
docker exec $USE_TTY -i $CONTAINER_ID /bin/bash -c 'systemctl start NetworkManager'
|
||||
docker exec $USE_TTY -i $CONTAINER_ID /bin/bash -c 'cd /workspace/nmstate && tox -e check-integ-py27'
|
||||
|
Loading…
x
Reference in New Issue
Block a user