Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit d9b4564

Browse files
authored
Merge pull request #203 from docker/fix_TestKillChild
Fix flaky test (subject to running tests in //)
2 parents 3ad1e69 + 9d4eed2 commit d9b4564

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

tests/framework/suite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func (s *Suite) ListProcessesCommand() *CmdContext {
132132
if IsWindows() {
133133
return s.NewCommand("tasklist")
134134
}
135-
return s.NewCommand("ps")
135+
return s.NewCommand("ps", "-x")
136136
}
137137

138138
// NewCommand creates a command context.

tests/skip-win-ci-e2e/skip_win_ci_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,31 @@ type NonWinCIE2eSuite struct {
5050

5151
func (s *NonWinCIE2eSuite) TestKillChildOnCancel() {
5252
It("should kill docker-classic if parent command is cancelled", func() {
53+
imageName := "test-sleep-image"
5354
out := s.ListProcessesCommand().ExecOrDie()
54-
Expect(out).NotTo(ContainSubstring("docker-classic"))
55+
Expect(out).NotTo(ContainSubstring(imageName))
5556

5657
dir := s.ConfigDir
5758
Expect(ioutil.WriteFile(filepath.Join(dir, "Dockerfile"), []byte(`FROM alpine:3.10
5859
RUN sleep 100`), 0644)).To(Succeed())
5960
shutdown := make(chan time.Time)
6061
errs := make(chan error)
61-
ctx := s.NewDockerCommand("build", "--no-cache", "-t", "test-sleep-image", ".").WithinDirectory(dir).WithTimeout(shutdown)
62+
ctx := s.NewDockerCommand("build", "--no-cache", "-t", imageName, ".").WithinDirectory(dir).WithTimeout(shutdown)
6263
go func() {
6364
_, err := ctx.Exec()
6465
errs <- err
6566
}()
6667
err := WaitFor(time.Second, 10*time.Second, errs, func() bool {
6768
out := s.ListProcessesCommand().ExecOrDie()
68-
return strings.Contains(out, "docker-classic")
69+
return strings.Contains(out, imageName)
6970
})
7071
Expect(err).NotTo(HaveOccurred())
7172
log.Println("Killing docker process")
7273

7374
close(shutdown)
7475
err = WaitFor(time.Second, 12*time.Second, nil, func() bool {
7576
out := s.ListProcessesCommand().ExecOrDie()
76-
return !strings.Contains(out, "docker-classic")
77+
return !strings.Contains(out, imageName)
7778
})
7879
Expect(err).NotTo(HaveOccurred())
7980
})
@@ -108,7 +109,7 @@ func (s *NonWinCIE2eSuite) getGrpcServerAndCLientAddress() (string, string) {
108109
return socketName, socketName
109110
}
110111

111-
func TestE2e(t *testing.T) {
112+
func TestNonWinCIE2(t *testing.T) {
112113
suite.Run(t, new(NonWinCIE2eSuite))
113114
}
114115

0 commit comments

Comments
 (0)