mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
e55d6fc857
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package container // import "github.com/docker/docker/integration/container"
|
|
|
|
import (
|
|
"context"
|
|
"io/ioutil"
|
|
"testing"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
"github.com/docker/docker/integration/internal/container"
|
|
"github.com/docker/docker/integration/internal/request"
|
|
"github.com/docker/docker/pkg/stdcopy"
|
|
"github.com/gotestyourself/gotestyourself/assert"
|
|
"github.com/gotestyourself/gotestyourself/skip"
|
|
)
|
|
|
|
// Regression test for #35370
|
|
// Makes sure that when following we don't get an EOF error when there are no logs
|
|
func TestLogsFollowTailEmpty(t *testing.T) {
|
|
// FIXME(vdemeester) fails on a e2e run on linux...
|
|
skip.IfCondition(t, testEnv.IsRemoteDaemon())
|
|
defer setupTest(t)()
|
|
client := request.NewAPIClient(t)
|
|
ctx := context.Background()
|
|
|
|
id := container.Run(t, ctx, client, container.WithCmd("sleep", "100000"))
|
|
|
|
logs, err := client.ContainerLogs(ctx, id, types.ContainerLogsOptions{ShowStdout: true, Tail: "2"})
|
|
if logs != nil {
|
|
defer logs.Close()
|
|
}
|
|
assert.Check(t, err)
|
|
|
|
_, err = stdcopy.StdCopy(ioutil.Discard, ioutil.Discard, logs)
|
|
assert.Check(t, err)
|
|
}
|