56a20dbc19
Now client have the possibility to set the console size of the executed process immediately at the creation. This makes a difference for example when executing commands that output some kind of text user interface which is bounded by the console dimensions. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
34 lines
921 B
Go
34 lines
921 B
Go
package container // import "github.com/docker/docker/integration/container"
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
"github.com/docker/docker/api/types/versions"
|
|
"github.com/docker/docker/integration/internal/container"
|
|
"gotest.tools/v3/assert"
|
|
"gotest.tools/v3/skip"
|
|
)
|
|
|
|
func TestExecConsoleSize(t *testing.T) {
|
|
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
|
|
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.42"), "skip test from new feature")
|
|
|
|
defer setupTest(t)()
|
|
client := testEnv.APIClient()
|
|
ctx := context.Background()
|
|
|
|
cID := container.Run(ctx, t, client, container.WithImage("busybox"))
|
|
|
|
result, err := container.Exec(ctx, client, cID, []string{"stty", "size"},
|
|
func(ec *types.ExecConfig) {
|
|
ec.Tty = true
|
|
ec.ConsoleSize = &[2]uint{57, 123}
|
|
},
|
|
)
|
|
|
|
assert.NilError(t, err)
|
|
assert.Equal(t, strings.TrimSpace(result.Stdout()), "57 123")
|
|
}
|