full diff: - https://github.com/docker/docker/compare/api/v1.52.0-alpha.1...7145e7666b8f - https://github.com/docker/docker/compare/client/v0.1.0-alpha.0...7145e7666b8f Signed-off-by: Sebastiaan van Stijn <github@gone.nl> WIP latest Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
31 lines
1005 B
Go
31 lines
1005 B
Go
package container
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/docker/cli/cli/command"
|
|
"github.com/docker/cli/internal/test"
|
|
"github.com/moby/moby/client"
|
|
"gotest.tools/v3/assert"
|
|
is "gotest.tools/v3/assert/cmp"
|
|
)
|
|
|
|
func TestInitTtySizeErrors(t *testing.T) {
|
|
expectedError := "failed to resize tty, using default size\n"
|
|
fakeContainerExecResizeFunc := func(id string, options client.ContainerResizeOptions) error {
|
|
return errors.New("Error response from daemon: no such exec")
|
|
}
|
|
fakeResizeTtyFunc := func(ctx context.Context, cli command.Cli, id string, isExec bool) error {
|
|
height, width := uint(1024), uint(768)
|
|
return resizeTtyTo(ctx, cli.Client(), id, height, width, isExec)
|
|
}
|
|
ctx := context.Background()
|
|
cli := test.NewFakeCli(&fakeClient{containerExecResizeFunc: fakeContainerExecResizeFunc})
|
|
initTtySize(ctx, cli, "8mm8nn8tt8bb", true, fakeResizeTtyFunc)
|
|
time.Sleep(1500 * time.Millisecond)
|
|
assert.Check(t, is.Equal(expectedError, cli.ErrBuffer().String()))
|
|
}
|