Commit 8a2390a4 authored by Daniel P. Berrangé's avatar Daniel P. Berrangé Committed by Fam Zheng
Browse files

docker: Don't enable networking as a side-effect of DEBUG=1



When trying to debug problems with tests it is natural to set
DEBUG=1 when starting the docker environment. Unfortunately
this has a side-effect of enabling an eth0 network interface
in the container, which changes the operating environment of
the test suite. IOW tests with fail may suddenly start
working again if DEBUG=1 is set, due to changed network setup.

Add a separate NETWORK variable to allow enablement of
networking separately from DEBUG=1. This can be used in two
ways. To enable the default docker network backend

  make docker-test-build@fedora NETWORK=1

while to enable a specific network backend, eg join the network
associated with the container 'wibble':

  make docker-test-build@fedora NETWORK=container:wibble

Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
Message-Id: <20170713144352.2212-1-berrange@redhat.com>
[Drop the superfluous second $(subst ...). - Fam]
Signed-off-by: default avatarFam Zheng <famz@redhat.com>
parent 5aca18a4
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -106,6 +106,8 @@ docker:
	@echo '                         (default is 1)'
	@echo '    DEBUG=1              Stop and drop to shell in the created container'
	@echo '                         before running the command.'
	@echo '    NETWORK=1            Enable virtual network interface with default backend.'
	@echo '    NETWORK=$BACKEND     Enable virtual network interface with $BACKEND.'
	@echo '    NOUSER               Define to disable adding current user to containers passwd.'
	@echo '    NOCACHE=1            Ignore cache when build images.'
	@echo '    EXECUTABLE=<path>    Include executable in image.'
@@ -132,7 +134,8 @@ docker-run: docker-qemu-src
		$(SRC_PATH)/tests/docker/docker.py run 			\
			$(if $(NOUSER),,-u $(shell id -u)) -t 		\
			$(if $V,,--rm) 					\
			$(if $(DEBUG),-i,--net=none) 			\
			$(if $(DEBUG),-i,)				\
			$(if $(NETWORK),$(if $(subst $(NETWORK),,1),--net=$(NETWORK)),--net=none) \
			-e TARGET_LIST=$(TARGET_LIST) 			\
			-e EXTRA_CONFIGURE_OPTS="$(EXTRA_CONFIGURE_OPTS)" \
			-e V=$V -e J=$J -e DEBUG=$(DEBUG)		\