MCPcopy Index your code
hub / github.com/docker/cli / TestInitTtySizeErrors

Function TestInitTtySizeErrors

cli/command/container/tty_test.go:16–30  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func TestInitTtySizeErrors(t *testing.T) {
17 expectedError := "failed to resize tty, using default size\n"
18 fakeContainerExecResizeFunc := func(id string, options client.ExecResizeOptions) (client.ExecResizeResult, error) {
19 return client.ExecResizeResult{}, errors.New("error response from daemon: no such exec")
20 }
21 fakeResizeTtyFunc := func(ctx context.Context, cli command.Cli, id string, isExec bool) error {
22 height, width := uint(1024), uint(768)
23 return resizeTTYTo(ctx, cli.Client(), id, height, width, isExec)
24 }
25 ctx := context.Background()
26 cli := test.NewFakeCli(&fakeClient{containerExecResizeFunc: fakeContainerExecResizeFunc})
27 initTtySize(ctx, cli, "8mm8nn8tt8bb", true, fakeResizeTtyFunc)
28 time.Sleep(1500 * time.Millisecond)
29 assert.Check(t, is.Equal(expectedError, cli.ErrBuffer().String()))
30}

Callers

nothing calls this directly

Calls 5

ClientMethod · 0.95
ErrBufferMethod · 0.95
resizeTTYToFunction · 0.85
initTtySizeFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…