github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/integration/container/logs_test.go (about) 1 package container // import "github.com/demonoid81/moby/integration/container" 2 3 import ( 4 "context" 5 "io/ioutil" 6 "testing" 7 8 "github.com/demonoid81/moby/api/types" 9 "github.com/demonoid81/moby/integration/internal/container" 10 "github.com/demonoid81/moby/pkg/stdcopy" 11 "gotest.tools/v3/assert" 12 "gotest.tools/v3/skip" 13 ) 14 15 // Regression test for #35370 16 // Makes sure that when following we don't get an EOF error when there are no logs 17 func TestLogsFollowTailEmpty(t *testing.T) { 18 // FIXME(vdemeester) fails on a e2e run on linux... 19 skip.If(t, testEnv.IsRemoteDaemon) 20 defer setupTest(t)() 21 client := testEnv.APIClient() 22 ctx := context.Background() 23 24 id := container.Run(ctx, t, client, container.WithCmd("sleep", "100000")) 25 26 logs, err := client.ContainerLogs(ctx, id, types.ContainerLogsOptions{ShowStdout: true, Tail: "2"}) 27 if logs != nil { 28 defer logs.Close() 29 } 30 assert.Check(t, err) 31 32 _, err = stdcopy.StdCopy(ioutil.Discard, ioutil.Discard, logs) 33 assert.Check(t, err) 34 }