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

Function TestParseExecErrors

cli/command/container/exec_test.go:150–167  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

148}
149
150func TestParseExecErrors(t *testing.T) {
151 t.Run("missing env-file", func(t *testing.T) {
152 execOpts := withDefaultOpts(ExecOptions{})
153 assert.Check(t, execOpts.EnvFile.Set("no-such-env-file"))
154 execConfig, err := parseExec(execOpts, &configfile.ConfigFile{})
155 assert.ErrorContains(t, err, "no-such-env-file")
156 assert.Check(t, os.IsNotExist(err))
157 assert.Check(t, execConfig == nil)
158 })
159 t.Run("invalid detach keys", func(t *testing.T) {
160 execOpts := withDefaultOpts(ExecOptions{
161 DetachKeys: "shift-a",
162 })
163 execConfig, err := parseExec(execOpts, &configfile.ConfigFile{})
164 assert.Check(t, is.ErrorContains(err, "invalid detach keys (shift-a):"))
165 assert.Check(t, is.Nil(execConfig))
166 })
167}
168
169func TestRunExec(t *testing.T) {
170 testcases := []struct {

Callers

nothing calls this directly

Calls 3

withDefaultOptsFunction · 0.85
parseExecFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…