mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Windows CI: Porting TestEvents*
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
parent
7d13f2fb7d
commit
bf33742026
1 changed files with 17 additions and 25 deletions
|
@ -17,7 +17,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) {
|
func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
image := "busybox"
|
image := "busybox"
|
||||||
|
|
||||||
// Start stopwatch, generate an event
|
// Start stopwatch, generate an event
|
||||||
|
@ -45,7 +44,6 @@ func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsUntag(c *check.C) {
|
func (s *DockerSuite) TestEventsUntag(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
image := "busybox"
|
image := "busybox"
|
||||||
dockerCmd(c, "tag", image, "utest:tag1")
|
dockerCmd(c, "tag", image, "utest:tag1")
|
||||||
dockerCmd(c, "tag", image, "utest:tag2")
|
dockerCmd(c, "tag", image, "utest:tag2")
|
||||||
|
@ -92,6 +90,10 @@ func (s *DockerSuite) TestEventsContainerFailStartDie(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsLimit(c *check.C) {
|
func (s *DockerSuite) TestEventsLimit(c *check.C) {
|
||||||
|
// TODO Windows CI: This test is not reliable enough on Windows TP4. Reports
|
||||||
|
// multiple errors in the analytic log sometimes.
|
||||||
|
// [NetSetupHelper::InstallVirtualMiniport()@2153] NetSetup install of ROOT\VMS_MP\0001 failed with error 0x80070002
|
||||||
|
// This should be able to be enabled on TP5.
|
||||||
testRequires(c, DaemonIsLinux)
|
testRequires(c, DaemonIsLinux)
|
||||||
var waitGroup sync.WaitGroup
|
var waitGroup sync.WaitGroup
|
||||||
errChan := make(chan error, 17)
|
errChan := make(chan error, 17)
|
||||||
|
@ -119,7 +121,6 @@ func (s *DockerSuite) TestEventsLimit(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsContainerEvents(c *check.C) {
|
func (s *DockerSuite) TestEventsContainerEvents(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
containerID, _ := dockerCmd(c, "run", "--rm", "--name", "container-events-test", "busybox", "true")
|
containerID, _ := dockerCmd(c, "run", "--rm", "--name", "container-events-test", "busybox", "true")
|
||||||
containerID = strings.TrimSpace(containerID)
|
containerID = strings.TrimSpace(containerID)
|
||||||
|
|
||||||
|
@ -140,7 +141,6 @@ func (s *DockerSuite) TestEventsContainerEvents(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *check.C) {
|
func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
dockerCmd(c, "run", "--rm", "--name", "since-epoch-test", "busybox", "true")
|
dockerCmd(c, "run", "--rm", "--name", "since-epoch-test", "busybox", "true")
|
||||||
timeBeginning := time.Unix(0, 0).Format(time.RFC3339Nano)
|
timeBeginning := time.Unix(0, 0).Format(time.RFC3339Nano)
|
||||||
timeBeginning = strings.Replace(timeBeginning, "Z", ".000000000Z", -1)
|
timeBeginning = strings.Replace(timeBeginning, "Z", ".000000000Z", -1)
|
||||||
|
@ -161,7 +161,6 @@ func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsImageTag(c *check.C) {
|
func (s *DockerSuite) TestEventsImageTag(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
time.Sleep(1 * time.Second) // because API has seconds granularity
|
time.Sleep(1 * time.Second) // because API has seconds granularity
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
image := "testimageevents:tag"
|
image := "testimageevents:tag"
|
||||||
|
@ -181,6 +180,7 @@ func (s *DockerSuite) TestEventsImageTag(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsImagePull(c *check.C) {
|
func (s *DockerSuite) TestEventsImagePull(c *check.C) {
|
||||||
|
// TODO Windows: Enable this test once pull and reliable image names are available
|
||||||
testRequires(c, DaemonIsLinux)
|
testRequires(c, DaemonIsLinux)
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
testRequires(c, Network)
|
testRequires(c, Network)
|
||||||
|
@ -200,6 +200,8 @@ func (s *DockerSuite) TestEventsImagePull(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsImageImport(c *check.C) {
|
func (s *DockerSuite) TestEventsImageImport(c *check.C) {
|
||||||
|
// TODO Windows CI. This should be portable once export/import are
|
||||||
|
// more reliable (@swernli)
|
||||||
testRequires(c, DaemonIsLinux)
|
testRequires(c, DaemonIsLinux)
|
||||||
|
|
||||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
||||||
|
@ -222,8 +224,6 @@ func (s *DockerSuite) TestEventsImageImport(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsFilters(c *check.C) {
|
func (s *DockerSuite) TestEventsFilters(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
|
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
dockerCmd(c, "run", "--rm", "busybox", "true")
|
dockerCmd(c, "run", "--rm", "busybox", "true")
|
||||||
dockerCmd(c, "run", "--rm", "busybox", "true")
|
dockerCmd(c, "run", "--rm", "busybox", "true")
|
||||||
|
@ -240,7 +240,6 @@ func (s *DockerSuite) TestEventsFilters(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsFilterImageName(c *check.C) {
|
func (s *DockerSuite) TestEventsFilterImageName(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
|
|
||||||
out, _ := dockerCmd(c, "run", "--name", "container_1", "-d", "busybox:latest", "true")
|
out, _ := dockerCmd(c, "run", "--name", "container_1", "-d", "busybox:latest", "true")
|
||||||
|
@ -270,7 +269,6 @@ func (s *DockerSuite) TestEventsFilterImageName(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsFilterLabels(c *check.C) {
|
func (s *DockerSuite) TestEventsFilterLabels(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
label := "io.docker.testing=foo"
|
label := "io.docker.testing=foo"
|
||||||
|
|
||||||
|
@ -297,7 +295,6 @@ func (s *DockerSuite) TestEventsFilterLabels(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsFilterImageLabels(c *check.C) {
|
func (s *DockerSuite) TestEventsFilterImageLabels(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
name := "labelfiltertest"
|
name := "labelfiltertest"
|
||||||
label := "io.docker.testing=image"
|
label := "io.docker.testing=image"
|
||||||
|
@ -330,7 +327,6 @@ func (s *DockerSuite) TestEventsFilterImageLabels(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsFilterContainer(c *check.C) {
|
func (s *DockerSuite) TestEventsFilterContainer(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
since := fmt.Sprintf("%d", daemonTime(c).Unix())
|
since := fmt.Sprintf("%d", daemonTime(c).Unix())
|
||||||
nameID := make(map[string]string)
|
nameID := make(map[string]string)
|
||||||
|
|
||||||
|
@ -370,10 +366,11 @@ func (s *DockerSuite) TestEventsFilterContainer(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsCommit(c *check.C) {
|
func (s *DockerSuite) TestEventsCommit(c *check.C) {
|
||||||
|
// Problematic on Windows as cannot commit a running container
|
||||||
testRequires(c, DaemonIsLinux)
|
testRequires(c, DaemonIsLinux)
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
|
|
||||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
out, _ := runSleepingContainer(c, "-d")
|
||||||
cID := strings.TrimSpace(out)
|
cID := strings.TrimSpace(out)
|
||||||
c.Assert(waitRun(cID), checker.IsNil)
|
c.Assert(waitRun(cID), checker.IsNil)
|
||||||
|
|
||||||
|
@ -385,13 +382,12 @@ func (s *DockerSuite) TestEventsCommit(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsCopy(c *check.C) {
|
func (s *DockerSuite) TestEventsCopy(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
|
|
||||||
// Build a test image.
|
// Build a test image.
|
||||||
id, err := buildImage("cpimg", `
|
id, err := buildImage("cpimg", `
|
||||||
FROM busybox
|
FROM busybox
|
||||||
RUN echo HI > /tmp/file`, true)
|
RUN echo HI > /file`, true)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf("Couldn't create image"))
|
c.Assert(err, checker.IsNil, check.Commentf("Couldn't create image"))
|
||||||
|
|
||||||
// Create an empty test file.
|
// Create an empty test file.
|
||||||
|
@ -403,19 +399,18 @@ func (s *DockerSuite) TestEventsCopy(c *check.C) {
|
||||||
|
|
||||||
dockerCmd(c, "create", "--name=cptest", id)
|
dockerCmd(c, "create", "--name=cptest", id)
|
||||||
|
|
||||||
dockerCmd(c, "cp", "cptest:/tmp/file", tempFile.Name())
|
dockerCmd(c, "cp", "cptest:/file", tempFile.Name())
|
||||||
|
|
||||||
out, _ := dockerCmd(c, "events", "--since=0", "-f", "container=cptest", "--until="+strconv.Itoa(int(since)))
|
out, _ := dockerCmd(c, "events", "--since=0", "-f", "container=cptest", "--until="+strconv.Itoa(int(since)))
|
||||||
c.Assert(out, checker.Contains, "archive-path", check.Commentf("Missing 'archive-path' log event\n"))
|
c.Assert(out, checker.Contains, "archive-path", check.Commentf("Missing 'archive-path' log event\n"))
|
||||||
|
|
||||||
dockerCmd(c, "cp", tempFile.Name(), "cptest:/tmp/filecopy")
|
dockerCmd(c, "cp", tempFile.Name(), "cptest:/filecopy")
|
||||||
|
|
||||||
out, _ = dockerCmd(c, "events", "--since=0", "-f", "container=cptest", "--until="+strconv.Itoa(int(since)))
|
out, _ = dockerCmd(c, "events", "--since=0", "-f", "container=cptest", "--until="+strconv.Itoa(int(since)))
|
||||||
c.Assert(out, checker.Contains, "extract-to-dir", check.Commentf("Missing 'extract-to-dir' log event"))
|
c.Assert(out, checker.Contains, "extract-to-dir", check.Commentf("Missing 'extract-to-dir' log event"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsResize(c *check.C) {
|
func (s *DockerSuite) TestEventsResize(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
|
|
||||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||||
|
@ -434,10 +429,9 @@ func (s *DockerSuite) TestEventsResize(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsAttach(c *check.C) {
|
func (s *DockerSuite) TestEventsAttach(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
|
|
||||||
out, _ := dockerCmd(c, "run", "-di", "busybox", "/bin/cat")
|
out, _ := dockerCmd(c, "run", "-di", "busybox", "cat")
|
||||||
cID := strings.TrimSpace(out)
|
cID := strings.TrimSpace(out)
|
||||||
|
|
||||||
cmd := exec.Command(dockerBinary, "attach", cID)
|
cmd := exec.Command(dockerBinary, "attach", cID)
|
||||||
|
@ -466,7 +460,6 @@ func (s *DockerSuite) TestEventsAttach(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsRename(c *check.C) {
|
func (s *DockerSuite) TestEventsRename(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
|
|
||||||
dockerCmd(c, "run", "--name", "oldName", "busybox", "true")
|
dockerCmd(c, "run", "--name", "oldName", "busybox", "true")
|
||||||
|
@ -477,10 +470,11 @@ func (s *DockerSuite) TestEventsRename(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsTop(c *check.C) {
|
func (s *DockerSuite) TestEventsTop(c *check.C) {
|
||||||
|
// Problematic on Windows as Windows does not support top
|
||||||
testRequires(c, DaemonIsLinux)
|
testRequires(c, DaemonIsLinux)
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
|
|
||||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
out, _ := runSleepingContainer(c, "-d")
|
||||||
cID := strings.TrimSpace(out)
|
cID := strings.TrimSpace(out)
|
||||||
c.Assert(waitRun(cID), checker.IsNil)
|
c.Assert(waitRun(cID), checker.IsNil)
|
||||||
|
|
||||||
|
@ -493,7 +487,6 @@ func (s *DockerSuite) TestEventsTop(c *check.C) {
|
||||||
|
|
||||||
// #13753
|
// #13753
|
||||||
func (s *DockerSuite) TestEventsDefaultEmpty(c *check.C) {
|
func (s *DockerSuite) TestEventsDefaultEmpty(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
dockerCmd(c, "run", "busybox")
|
dockerCmd(c, "run", "busybox")
|
||||||
out, _ := dockerCmd(c, "events", fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
|
out, _ := dockerCmd(c, "events", fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
|
||||||
c.Assert(strings.TrimSpace(out), checker.Equals, "")
|
c.Assert(strings.TrimSpace(out), checker.Equals, "")
|
||||||
|
@ -501,6 +494,8 @@ func (s *DockerSuite) TestEventsDefaultEmpty(c *check.C) {
|
||||||
|
|
||||||
// #14316
|
// #14316
|
||||||
func (s *DockerRegistrySuite) TestEventsImageFilterPush(c *check.C) {
|
func (s *DockerRegistrySuite) TestEventsImageFilterPush(c *check.C) {
|
||||||
|
// Problematic to port for Windows CI during TP4/TP5 timeframe while
|
||||||
|
// not supporting push
|
||||||
testRequires(c, DaemonIsLinux)
|
testRequires(c, DaemonIsLinux)
|
||||||
testRequires(c, Network)
|
testRequires(c, Network)
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
|
@ -519,7 +514,6 @@ func (s *DockerRegistrySuite) TestEventsImageFilterPush(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsFilterType(c *check.C) {
|
func (s *DockerSuite) TestEventsFilterType(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
name := "labelfiltertest"
|
name := "labelfiltertest"
|
||||||
label := "io.docker.testing=image"
|
label := "io.docker.testing=image"
|
||||||
|
@ -573,8 +567,6 @@ func (s *DockerSuite) TestEventsFilterType(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *check.C) {
|
func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
|
|
||||||
since := daemonTime(c).Unix()
|
since := daemonTime(c).Unix()
|
||||||
dockerCmd(c, "run", "--name", "test-container", "-d", "busybox", "true")
|
dockerCmd(c, "run", "--name", "test-container", "-d", "busybox", "true")
|
||||||
waitRun("test-container")
|
waitRun("test-container")
|
||||||
|
|
Loading…
Reference in a new issue