MCPcopy Create free account
hub / github.com/containerd/nerdctl / TestExecStdin

Function TestExecStdin

cmd/nerdctl/container/container_exec_test.go:72–91  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

70}
71
72func TestExecStdin(t *testing.T) {
73 nerdtest.Setup()
74
75 const testStr = "test-exec-stdin"
76 testCase := &test.Case{
77 Setup: func(data test.Data, helpers test.Helpers) {
78 helpers.Ensure("run", "-d", "--name", data.Identifier(), testutil.CommonImage, "sleep", nerdtest.Infinity)
79 },
80 Cleanup: func(data test.Data, helpers test.Helpers) {
81 helpers.Anyhow("rm", "-f", data.Identifier())
82 },
83 Command: func(data test.Data, helpers test.Helpers) test.TestableCommand {
84 cmd := helpers.Command("exec", "-i", data.Identifier(), "cat")
85 cmd.Feed(strings.NewReader(testStr))
86 return cmd
87 },
88 Expected: test.Expects(0, nil, expect.Equals(testStr)),
89 }
90 testCase.Run(t)
91}
92
93// FYI: https://github.com/containerd/nerdctl/blob/e4b2b6da56555dc29ed66d0fd8e7094ff2bc002d/cmd/nerdctl/run_test.go#L177
94func TestExecEnv(t *testing.T) {

Callers

nothing calls this directly

Calls 7

RunMethod · 0.95
SetupFunction · 0.92
EnsureMethod · 0.65
IdentifierMethod · 0.65
AnyhowMethod · 0.65
CommandMethod · 0.65
FeedMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…