Skip to content

Commit 84b8540

Browse files
authored
Merge pull request #533 from Random-Liu/fix-attach-on-windows
Fix attach test on windows.
2 parents 94729eb + c41cf26 commit 84b8540

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pkg/validate/streaming.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,19 @@ func checkAttach(c internalapi.RuntimeService, attachServerURL string) {
292292
go func() {
293293
defer GinkgoRecover()
294294
defer writer.Close()
295+
header := localOut.String()
296+
time.Sleep(1 * time.Second)
297+
Eventually(func() bool {
298+
oldHeader := header
299+
header = localOut.String()
300+
return len(header) == len(oldHeader)
301+
}, 10*time.Second, time.Second).Should(BeTrue(), "The container should stop output when there is no input")
295302
writer.Write([]byte(strings.Join(echoHelloCmd, " ") + "\n"))
296303
Eventually(func() string {
297-
return localOut.String()
304+
return strings.TrimPrefix(localOut.String(), header)
298305
}, time.Minute, time.Second).Should(Equal(attachEchoHelloOutput), "The stdout of attach should be hello")
299306
Consistently(func() string {
300-
return localOut.String()
307+
return strings.TrimPrefix(localOut.String(), header)
301308
}, 3*time.Second, time.Second).Should(Equal(attachEchoHelloOutput), "The stdout of attach should not contain other things")
302309
}()
303310

0 commit comments

Comments
 (0)