Add DOCKER_USERLANDPROXY test variable
Add an convenient way to switch --userland-proxy on and off in integration tests. Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
This commit is contained in:
parent
f42348e18f
commit
44de5fecce
3 changed files with 22 additions and 0 deletions
|
@ -198,6 +198,7 @@ test_env() {
|
|||
DEST="$DEST" \
|
||||
DOCKER_EXECDRIVER="$DOCKER_EXECDRIVER" \
|
||||
DOCKER_GRAPHDRIVER="$DOCKER_GRAPHDRIVER" \
|
||||
DOCKER_USERLANDPROXY="$DOCKER_USERLANDPROXY" \
|
||||
DOCKER_HOST="$DOCKER_HOST" \
|
||||
GOPATH="$GOPATH" \
|
||||
HOME="$DEST/fake-HOME" \
|
||||
|
|
|
@ -14,6 +14,7 @@ exec 41>&1 42>&2
|
|||
|
||||
export DOCKER_GRAPHDRIVER=${DOCKER_GRAPHDRIVER:-vfs}
|
||||
export DOCKER_EXECDRIVER=${DOCKER_EXECDRIVER:-native}
|
||||
export DOCKER_USERLANDPROXY=${DOCKER_USERLANDPROXY:-true}
|
||||
|
||||
if [ -z "$DOCKER_TEST_HOST" ]; then
|
||||
export DOCKER_HOST="unix://$(cd "$DEST" && pwd)/docker.sock" # "pwd" tricks to make sure $DEST is an absolute path, not a relative one
|
||||
|
@ -23,6 +24,7 @@ if [ -z "$DOCKER_TEST_HOST" ]; then
|
|||
--storage-driver "$DOCKER_GRAPHDRIVER" \
|
||||
--exec-driver "$DOCKER_EXECDRIVER" \
|
||||
--pidfile "$DEST/docker.pid" \
|
||||
--userland-proxy="$DOCKER_USERLANDPROXY" \
|
||||
&> "$DEST/docker.log"
|
||||
) &
|
||||
trap "source '${MAKEDIR}/.integration-daemon-stop'" EXIT # make sure that if the script exits unexpectedly, we stop this daemon we just started
|
||||
|
|
|
@ -37,6 +37,16 @@ type Daemon struct {
|
|||
storageDriver string
|
||||
execDriver string
|
||||
wait chan error
|
||||
userlandProxy bool
|
||||
}
|
||||
|
||||
func enableUserlandProxy() bool {
|
||||
if env := os.Getenv("DOCKER_USERLANDPROXY"); env != "" {
|
||||
if val, err := strconv.ParseBool(env); err != nil {
|
||||
return val
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// NewDaemon returns a Daemon instance to be used for testing.
|
||||
|
@ -58,11 +68,19 @@ func NewDaemon(c *check.C) *Daemon {
|
|||
c.Fatalf("Could not create %s/graph directory", daemonFolder)
|
||||
}
|
||||
|
||||
userlandProxy := true
|
||||
if env := os.Getenv("DOCKER_USERLANDPROXY"); env != "" {
|
||||
if val, err := strconv.ParseBool(env); err != nil {
|
||||
userlandProxy = val
|
||||
}
|
||||
}
|
||||
|
||||
return &Daemon{
|
||||
c: c,
|
||||
folder: daemonFolder,
|
||||
storageDriver: os.Getenv("DOCKER_GRAPHDRIVER"),
|
||||
execDriver: os.Getenv("DOCKER_EXECDRIVER"),
|
||||
userlandProxy: userlandProxy,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,6 +97,7 @@ func (d *Daemon) Start(arg ...string) error {
|
|||
"--daemon",
|
||||
"--graph", fmt.Sprintf("%s/graph", d.folder),
|
||||
"--pidfile", fmt.Sprintf("%s/docker.pid", d.folder),
|
||||
fmt.Sprintf("--userland-proxy=%t", d.userlandProxy),
|
||||
}
|
||||
|
||||
// If we don't explicitly set the log-level or debug flag(-D) then
|
||||
|
|
Loading…
Add table
Reference in a new issue