Skip to content

Commit

Permalink
Windows: Start of enabling tests under integration/
Browse files Browse the repository at this point in the history
- Add windows CI entrypoint script.

Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
  • Loading branch information
vdemeester authored and salah-khan committed Sep 26, 2018
1 parent d0970ab commit d3cc071
Show file tree
Hide file tree
Showing 46 changed files with 1,030 additions and 36 deletions.
909 changes: 909 additions & 0 deletions hack/ci/windowsRS1.ps1

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion integration/build/build_session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/docker/docker/api/types"
dclient "github.com/docker/docker/client"
"github.com/docker/docker/internal/test/daemon"
"github.com/docker/docker/internal/test/fakecontext"
"github.com/docker/docker/internal/test/request"
"github.com/moby/buildkit/session"
Expand All @@ -20,7 +21,11 @@ import (
)

func TestBuildWithSession(t *testing.T) {
skip.If(t, !testEnv.DaemonInfo.ExperimentalBuild)
skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
d := daemon.New(t, daemon.WithExperimental)
d.StartWithBusybox(t)
defer d.Stop(t)

client := testEnv.APIClient()

Expand Down
7 changes: 6 additions & 1 deletion integration/build/build_squash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/docker/docker/api/types"
"github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/internal/test/daemon"
"github.com/docker/docker/internal/test/fakecontext"
"github.com/docker/docker/pkg/stdcopy"
"gotest.tools/assert"
Expand All @@ -18,7 +19,11 @@ import (
)

func TestBuildSquashParent(t *testing.T) {
skip.If(t, !testEnv.DaemonInfo.ExperimentalBuild)
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
d := daemon.New(t, daemon.WithExperimental)
d.StartWithBusybox(t)
defer d.Stop(t)

client := testEnv.APIClient()

Expand Down
22 changes: 20 additions & 2 deletions integration/build/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"io/ioutil"
"strings"
"testing"
"time"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
Expand All @@ -22,6 +23,7 @@ import (
)

func TestBuildWithRemoveAndForceRemove(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
defer setupTest(t)()
t.Parallel()
cases := []struct {
Expand Down Expand Up @@ -137,6 +139,7 @@ func buildContainerIdsFilter(buildOutput io.Reader) (filters.Args, error) {

func TestBuildMultiStageParentConfig(t *testing.T) {
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.35"), "broken in earlier versions")
skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
dockerfile := `
FROM busybox AS stage0
ENV WHO=parent
Expand Down Expand Up @@ -166,10 +169,20 @@ func TestBuildMultiStageParentConfig(t *testing.T) {
resp.Body.Close()
assert.NilError(t, err)

time.Sleep(30 * time.Second)

imgs, err := apiclient.ImageList(ctx, types.ImageListOptions{})
assert.NilError(t, err)
t.Log(imgs)

image, _, err := apiclient.ImageInspectWithRaw(ctx, "build1")
assert.NilError(t, err)

assert.Check(t, is.Equal("/foo/sub2", image.Config.WorkingDir))
expected := "/foo/sub2"
if testEnv.DaemonInfo.OSType == "windows" {
expected = `C:\foo\sub2`
}
assert.Check(t, is.Equal(expected, image.Config.WorkingDir))
assert.Check(t, is.Contains(image.Config.Env, "WHO=parent"))
}

Expand Down Expand Up @@ -282,14 +295,16 @@ func TestBuildWithEmptyLayers(t *testing.T) {
// #35652
func TestBuildMultiStageOnBuild(t *testing.T) {
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.33"), "broken in earlier versions")
skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
defer setupTest(t)()
// test both metadata and layer based commands as they may be implemented differently
dockerfile := `FROM busybox AS stage1
ONBUILD RUN echo 'foo' >somefile
ONBUILD ENV bar=baz
FROM stage1
RUN cat somefile # fails if ONBUILD RUN fails
# fails if ONBUILD RUN fails
RUN cat somefile
FROM stage1
RUN cat somefile`
Expand Down Expand Up @@ -327,6 +342,8 @@ RUN cat somefile`
// #35403 #36122
func TestBuildUncleanTarFilenames(t *testing.T) {
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.37"), "broken in earlier versions")
skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")

ctx := context.TODO()
defer setupTest(t)()

Expand Down Expand Up @@ -385,6 +402,7 @@ COPY bar /`
// docker/for-linux#135
// #35641
func TestBuildMultiStageLayerLeak(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.37"), "broken in earlier versions")
ctx := context.TODO()
defer setupTest(t)()
Expand Down
9 changes: 5 additions & 4 deletions integration/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

func TestConfigList(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
skip.If(t, testEnv.DaemonInfo.OSType == "windows")

defer setupTest(t)()
d := swarm.NewSwarm(t, testEnv)
Expand Down Expand Up @@ -102,7 +102,7 @@ func createConfig(ctx context.Context, t *testing.T, client client.APIClient, na
}

func TestConfigsCreateAndDelete(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
skip.If(t, testEnv.DaemonInfo.OSType == "windows")

defer setupTest(t)()
d := swarm.NewSwarm(t, testEnv)
Expand Down Expand Up @@ -130,7 +130,7 @@ func TestConfigsCreateAndDelete(t *testing.T) {
}

func TestConfigsUpdate(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
skip.If(t, testEnv.DaemonInfo.OSType == "windows")

defer setupTest(t)()
d := swarm.NewSwarm(t, testEnv)
Expand Down Expand Up @@ -184,6 +184,7 @@ func TestConfigsUpdate(t *testing.T) {
}

func TestTemplatedConfig(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
d := swarm.NewSwarm(t, testEnv)
defer d.Stop(t)
client := d.NewClientT(t)
Expand Down Expand Up @@ -323,7 +324,7 @@ func waitAndAssert(t *testing.T, timeout time.Duration, f func(*testing.T) bool)
}

func TestConfigInspect(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
skip.If(t, testEnv.DaemonInfo.OSType == "windows")

defer setupTest(t)()
d := swarm.NewSwarm(t, testEnv)
Expand Down
1 change: 1 addition & 0 deletions integration/container/copy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

func TestCopyFromContainerPathDoesNotExist(t *testing.T) {
defer setupTest(t)()
skip.If(t, testEnv.OSType == "windows")

ctx := context.Background()
apiclient := testEnv.APIClient()
Expand Down
2 changes: 1 addition & 1 deletion integration/container/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func TestCreateWithInvalidEnv(t *testing.T) {

// Test case for #30166 (target was not validated)
func TestCreateTmpfsMountsTarget(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
skip.If(t, testEnv.DaemonInfo.OSType == "windows")

defer setupTest(t)()
client := request.NewAPIClient(t)
Expand Down
2 changes: 2 additions & 0 deletions integration/container/daemon_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
// container again.
func TestContainerStartOnDaemonRestart(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
skip.If(t, testEnv.IsRemoteDaemon(), "cannot start daemon on remote test run")
t.Parallel()

d := daemon.New(t)
Expand Down
2 changes: 2 additions & 0 deletions integration/container/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import (
"github.com/docker/docker/pkg/archive"
"gotest.tools/assert"
"gotest.tools/poll"
"gotest.tools/skip"
)

func TestDiff(t *testing.T) {
skip.If(t, testEnv.OSType == "windows", "FIXME")
defer setupTest(t)()
client := request.NewAPIClient(t)
ctx := context.Background()
Expand Down
1 change: 1 addition & 0 deletions integration/container/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

func TestExec(t *testing.T) {
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.35"), "broken in earlier versions")
skip.If(t, testEnv.OSType == "windows", "FIXME. Probably needs to wait for container to be in running state.")
defer setupTest(t)()
ctx := context.Background()
client := request.NewAPIClient(t)
Expand Down
4 changes: 2 additions & 2 deletions integration/container/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

// export an image and try to import it into a new one
func TestExportContainerAndImportImage(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
skip.If(t, testEnv.DaemonInfo.OSType == "windows")

defer setupTest(t)()
client := request.NewAPIClient(t)
Expand Down Expand Up @@ -58,7 +58,7 @@ func TestExportContainerAndImportImage(t *testing.T) {
// can be exported (as reported in #36561). To satisfy this
// condition, daemon restart is needed after container creation.
func TestExportContainerAfterDaemonRestart(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
skip.If(t, testEnv.IsRemoteDaemon())

d := daemon.New(t)
Expand Down
2 changes: 2 additions & 0 deletions integration/container/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import (
"github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/internal/test/request"
"gotest.tools/poll"
"gotest.tools/skip"
)

// TestHealthCheckWorkdir verifies that health-checks inherit the containers'
// working-dir.
func TestHealthCheckWorkdir(t *testing.T) {
skip.If(t, testEnv.OSType == "windows", "FIXME")
defer setupTest(t)()
ctx := context.Background()
client := request.NewAPIClient(t)
Expand Down
2 changes: 1 addition & 1 deletion integration/container/inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

func TestInspectCpusetInConfigPre120(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux" || !testEnv.DaemonInfo.CPUSet)
skip.If(t, testEnv.DaemonInfo.OSType == "windows" || !testEnv.DaemonInfo.CPUSet)

defer setupTest(t)()
client := request.NewAPIClient(t, client.WithVersion("1.19"))
Expand Down
13 changes: 7 additions & 6 deletions integration/container/kill_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func TestKillContainerInvalidSignal(t *testing.T) {
}

func TestKillContainer(t *testing.T) {
skip.If(t, testEnv.OSType == "windows", "TODO Windows: FIXME. No SIGWINCH")
defer setupTest(t)()
client := request.NewAPIClient(t)

Expand Down Expand Up @@ -70,7 +71,7 @@ func TestKillContainer(t *testing.T) {
}

func TestKillWithStopSignalAndRestartPolicies(t *testing.T) {
skip.If(t, testEnv.OSType != "linux", "Windows only supports 1.25 or later")
skip.If(t, testEnv.OSType == "windows", "Windows only supports 1.25 or later")
defer setupTest(t)()
client := request.NewAPIClient(t)

Expand Down Expand Up @@ -110,7 +111,7 @@ func TestKillWithStopSignalAndRestartPolicies(t *testing.T) {
}

func TestKillStoppedContainer(t *testing.T) {
skip.If(t, testEnv.OSType != "linux") // Windows only supports 1.25 or later
skip.If(t, testEnv.OSType == "windows", "Windows only supports 1.25 or later")
defer setupTest(t)()
ctx := context.Background()
client := request.NewAPIClient(t)
Expand All @@ -121,7 +122,7 @@ func TestKillStoppedContainer(t *testing.T) {
}

func TestKillStoppedContainerAPIPre120(t *testing.T) {
skip.If(t, testEnv.OSType != "linux") // Windows only supports 1.25 or later
skip.If(t, testEnv.OSType == "windows", "Windows only supports 1.25 or later")
defer setupTest(t)()
ctx := context.Background()
client := request.NewAPIClient(t, client.WithVersion("1.19"))
Expand All @@ -132,7 +133,7 @@ func TestKillStoppedContainerAPIPre120(t *testing.T) {

func TestKillDifferentUserContainer(t *testing.T) {
// TODO Windows: Windows does not yet support -u (Feb 2016).
skip.If(t, testEnv.OSType != "linux", "User containers (container.Config.User) are not yet supported on %q platform", testEnv.OSType)
skip.If(t, testEnv.OSType == "windows", "User containers (container.Config.User) are not yet supported on %q platform", testEnv.OSType)

defer setupTest(t)()
ctx := context.Background()
Expand All @@ -149,7 +150,7 @@ func TestKillDifferentUserContainer(t *testing.T) {
}

func TestInspectOomKilledTrue(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux" || !testEnv.DaemonInfo.MemoryLimit || !testEnv.DaemonInfo.SwapLimit)
skip.If(t, testEnv.DaemonInfo.OSType == "windows" || !testEnv.DaemonInfo.MemoryLimit || !testEnv.DaemonInfo.SwapLimit)

defer setupTest(t)()
ctx := context.Background()
Expand All @@ -167,7 +168,7 @@ func TestInspectOomKilledTrue(t *testing.T) {
}

func TestInspectOomKilledFalse(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux" || !testEnv.DaemonInfo.MemoryLimit || !testEnv.DaemonInfo.SwapLimit)
skip.If(t, testEnv.DaemonInfo.OSType == "windows" || !testEnv.DaemonInfo.MemoryLimit || !testEnv.DaemonInfo.SwapLimit)

defer setupTest(t)()
ctx := context.Background()
Expand Down
2 changes: 1 addition & 1 deletion integration/container/links_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestLinksEtcHostsContentMatch(t *testing.T) {
}

func TestLinksContainerNames(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
skip.If(t, testEnv.DaemonInfo.OSType == "windows")

defer setupTest(t)()
client := request.NewAPIClient(t)
Expand Down
4 changes: 2 additions & 2 deletions integration/container/mounts_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

func TestContainerNetworkMountsNoChown(t *testing.T) {
// chown only applies to Linux bind mounted volumes; must be same host to verify
skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon())
skip.If(t, testEnv.DaemonInfo.OSType == "windows" || testEnv.IsRemoteDaemon())

defer setupTest(t)()

Expand Down Expand Up @@ -81,7 +81,7 @@ func TestContainerNetworkMountsNoChown(t *testing.T) {
}

func TestMountDaemonRoot(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon())
skip.If(t, testEnv.DaemonInfo.OSType == "windows" || testEnv.IsRemoteDaemon())
t.Parallel()

client := request.NewAPIClient(t)
Expand Down
2 changes: 2 additions & 0 deletions integration/container/nat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func TestNetworkNat(t *testing.T) {
}

func TestNetworkLocalhostTCPNat(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
skip.If(t, testEnv.IsRemoteDaemon())

defer setupTest(t)()
Expand Down Expand Up @@ -106,6 +107,7 @@ func startServerContainer(t *testing.T, msg string, port int) string {
}

func getExternalAddress(t *testing.T) net.IP {
skip.If(t, testEnv.OSType == "windows", "FIXME")
iface, err := net.InterfaceByName("eth0")
skip.If(t, err != nil, "Test not running with `make test-integration`. Interface eth0 not found: %s", err)

Expand Down
3 changes: 1 addition & 2 deletions integration/container/pause_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ func TestPauseFailsOnWindowsServerContainers(t *testing.T) {
}

func TestPauseStopPausedContainer(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.31"), "broken in earlier versions")

defer setupTest(t)()
client := request.NewAPIClient(t)
ctx := context.Background()
Expand Down
3 changes: 3 additions & 0 deletions integration/container/rename_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
// This checks that "rename" updates source container correctly and doesn't set it to null.
func TestRenameLinkedContainer(t *testing.T) {
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.32"), "broken in earlier versions")
skip.If(t, testEnv.OSType == "windows", "FIXME")
defer setupTest(t)()
ctx := context.Background()
client := request.NewAPIClient(t)
Expand Down Expand Up @@ -123,6 +124,7 @@ func TestRenameInvalidName(t *testing.T) {
// This test is to make sure once the container has been renamed,
// the service discovery for the (re)named container works.
func TestRenameAnonymousContainer(t *testing.T) {
skip.If(t, testEnv.OSType == "windows", "FIXME")
defer setupTest(t)()
ctx := context.Background()
client := request.NewAPIClient(t)
Expand Down Expand Up @@ -190,6 +192,7 @@ func TestRenameContainerWithSameName(t *testing.T) {
// container could still reference to the container that is renamed.
func TestRenameContainerWithLinkedContainer(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon())
skip.If(t, testEnv.OSType == "windows", "FIXME")

defer setupTest(t)()
ctx := context.Background()
Expand Down
Loading

0 comments on commit d3cc071

Please sign in to comment.