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