mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Windows: Workaround for CI
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
parent
6206cbe193
commit
ac120567e8
7 changed files with 53 additions and 36 deletions
|
@ -169,14 +169,15 @@ To run the same test inside your Docker development container, you do this:
|
||||||
|
|
||||||
root@5f8630b873fe:/go/src/github.com/docker/docker# TESTFLAGS='-check.f TestBuild*' hack/make.sh binary test-integration-cli
|
root@5f8630b873fe:/go/src/github.com/docker/docker# TESTFLAGS='-check.f TestBuild*' hack/make.sh binary test-integration-cli
|
||||||
|
|
||||||
## Testing just the Windows client
|
## Testing the Windows binary against a Linux daemon
|
||||||
|
|
||||||
This explains how to test the Windows client on a Windows server set up as a
|
This explains how to test the Windows binary on a Windows machine set up as a
|
||||||
development environment. You'll use the **Git Bash** came with the Git for
|
development environment. The tests will be run against a docker daemon
|
||||||
Windows installation. **Git Bash** just as it sounds allows you to run a Bash
|
running on a remote Linux machine. You'll use **Git Bash** that came with the
|
||||||
terminal on Windows.
|
Git for Windows installation. **Git Bash**, just as it sounds, allows you to
|
||||||
|
run a Bash terminal on Windows.
|
||||||
|
|
||||||
1. If you don't have one, start a Git Bash terminal.
|
1. If you don't have one open already, start a Git Bash terminal.
|
||||||
|
|
||||||
![Git Bash](/project/images/git_bash.png)
|
![Git Bash](/project/images/git_bash.png)
|
||||||
|
|
||||||
|
@ -184,26 +185,30 @@ terminal on Windows.
|
||||||
|
|
||||||
$ cd /c/gopath/src/github.com/docker/docker
|
$ cd /c/gopath/src/github.com/docker/docker
|
||||||
|
|
||||||
3. Set `DOCKER_CLIENTONLY` as follows:
|
3. Set `DOCKER_REMOTE_DAEMON` as follows:
|
||||||
|
|
||||||
$ export DOCKER_CLIENTONLY=1
|
$ export DOCKER_REMOTE_DAEMON=1
|
||||||
|
|
||||||
This ensures you are building only the client binary instead of both the
|
|
||||||
binary and the daemon.
|
|
||||||
|
|
||||||
4. Set `DOCKER_TEST_HOST` to the `tcp://IP_ADDRESS:2376` value; substitute your
|
4. Set `DOCKER_TEST_HOST` to the `tcp://IP_ADDRESS:2376` value; substitute your
|
||||||
machine's actual IP address, for example:
|
Linux machines actual IP address. For example:
|
||||||
|
|
||||||
$ export DOCKER_TEST_HOST=tcp://263.124.23.200:2376
|
$ export DOCKER_TEST_HOST=tcp://263.124.23.200:2376
|
||||||
|
|
||||||
5. Make the binary and the test:
|
5. Make the binary and run the tests:
|
||||||
|
|
||||||
$ hack/make.sh binary test-integration-cli
|
$ hack/make.sh binary test-integration-cli
|
||||||
|
|
||||||
Many tests are skipped on Windows for various reasons. You see which tests
|
Some tests are skipped on Windows for various reasons. You can see which
|
||||||
were skipped by re-running the make and passing in the
|
tests were skipped by re-running the make and passing in the
|
||||||
`TESTFLAGS='-test.v'` value.
|
`TESTFLAGS='-test.v'` value. For example
|
||||||
|
|
||||||
|
$ TESTFLAGS='-test.v' hack/make.sh binary test-integration-cli
|
||||||
|
|
||||||
|
Should you wish to run a single test such as one with the name
|
||||||
|
'TestExample', you can pass in `TESTFLAGS='-check.f TestExample'`. For
|
||||||
|
example
|
||||||
|
|
||||||
|
$TESTFLAGS='-check.f TestExample' hack/make.sh binary test-integration-cli
|
||||||
|
|
||||||
You can now choose to make changes to the Docker source or the tests. If you
|
You can now choose to make changes to the Docker source or the tests. If you
|
||||||
make any changes just run these commands again.
|
make any changes just run these commands again.
|
||||||
|
|
|
@ -220,6 +220,7 @@ test_env() {
|
||||||
DOCKER_GRAPHDRIVER="$DOCKER_GRAPHDRIVER" \
|
DOCKER_GRAPHDRIVER="$DOCKER_GRAPHDRIVER" \
|
||||||
DOCKER_USERLANDPROXY="$DOCKER_USERLANDPROXY" \
|
DOCKER_USERLANDPROXY="$DOCKER_USERLANDPROXY" \
|
||||||
DOCKER_HOST="$DOCKER_HOST" \
|
DOCKER_HOST="$DOCKER_HOST" \
|
||||||
|
DOCKER_REMOTE_DAEMON="$DOCKER_REMOTE_DAEMON" \
|
||||||
GOPATH="$GOPATH" \
|
GOPATH="$GOPATH" \
|
||||||
HOME="$ABS_DEST/fake-HOME" \
|
HOME="$ABS_DEST/fake-HOME" \
|
||||||
PATH="$PATH" \
|
PATH="$PATH" \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build daemon,experimental
|
// +build daemon,experimental,!windows
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ func assertNetwork(c *check.C, d *Daemon, name string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerDaemonSuite) TestDaemonDefaultNetwork(c *check.C) {
|
func (s *DockerDaemonSuite) TestDaemonDefaultNetwork(c *check.C) {
|
||||||
|
testRequires(c, SameHostDaemon)
|
||||||
d := s.d
|
d := s.d
|
||||||
|
|
||||||
networkName := "testdefault"
|
networkName := "testdefault"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build daemon
|
// +build daemon,!windows
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,10 @@ var (
|
||||||
execDriverPath = runtimePath + "/execdriver/native"
|
execDriverPath = runtimePath + "/execdriver/native"
|
||||||
|
|
||||||
workingDirectory string
|
workingDirectory string
|
||||||
|
|
||||||
|
// isLocalDaemon is true if the daemon under test is on the same
|
||||||
|
// host as the CLI.
|
||||||
|
isLocalDaemon bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -43,4 +47,26 @@ func init() {
|
||||||
privateRegistryURL = registry
|
privateRegistryURL = registry
|
||||||
}
|
}
|
||||||
workingDirectory, _ = os.Getwd()
|
workingDirectory, _ = os.Getwd()
|
||||||
|
|
||||||
|
// Deterministically working out the environment in which CI is running
|
||||||
|
// to evaluate whether the daemon is local or remote is not possible through
|
||||||
|
// a build tag.
|
||||||
|
//
|
||||||
|
// For example Windows CI under Jenkins test the 64-bit
|
||||||
|
// Windows binary build with the daemon build tag, but calls a remote
|
||||||
|
// Linux daemon.
|
||||||
|
//
|
||||||
|
// We can't just say if Windows then assume the daemon is local as at
|
||||||
|
// some point, we will be testing the Windows CLI against a Windows daemon.
|
||||||
|
//
|
||||||
|
// Similarly, it will be perfectly valid to also run CLI tests from
|
||||||
|
// a Linux CLI (built with the daemon tag) against a Windows daemon.
|
||||||
|
if len(os.Getenv("DOCKER_REMOTE_DAEMON")) > 0 {
|
||||||
|
fmt.Println("INFO: Testing against a remote daemon")
|
||||||
|
isLocalDaemon = false
|
||||||
|
} else {
|
||||||
|
fmt.Println("INFO: Testing against a local daemon")
|
||||||
|
isLocalDaemon = true
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
// +build !daemon
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
const (
|
|
||||||
// tests should not assume daemon runs on the same machine as CLI
|
|
||||||
isLocalDaemon = false
|
|
||||||
)
|
|
|
@ -1,8 +0,0 @@
|
||||||
// +build daemon
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
const (
|
|
||||||
// tests can assume daemon runs on the same machine as CLI
|
|
||||||
isLocalDaemon = true
|
|
||||||
)
|
|
Loading…
Reference in a new issue