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

Function TestRunEnvFile

cmd/nerdctl/container/container_run_test.go:185–212  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

183}
184
185func TestRunEnvFile(t *testing.T) {
186 testCase := nerdtest.Setup()
187
188 testCase.Env = map[string]string{
189 "HOST_ENV": "ENV-IN-HOST",
190 }
191
192 testCase.Setup = func(data test.Data, helpers test.Helpers) {
193 data.Temp().Save("# this is a comment line\nTESTKEY1=TESTVAL1", "env1-file")
194 data.Temp().Save("# this is a comment line\nTESTKEY2=TESTVAL2\nHOST_ENV", "env2-file")
195 }
196
197 testCase.Command = func(data test.Data, helpers test.Helpers) test.TestableCommand {
198 return helpers.Command(
199 "run", "--rm",
200 "--env-file", data.Temp().Path("env1-file"),
201 "--env-file", data.Temp().Path("env2-file"),
202 testutil.CommonImage, "env")
203 }
204
205 testCase.Expected = test.Expects(
206 expect.ExitCodeSuccess,
207 nil,
208 expect.Contains("TESTKEY1=TESTVAL1", "TESTKEY2=TESTVAL2", "HOST_ENV=ENV-IN-HOST"),
209 )
210
211 testCase.Run(t)
212}
213
214func TestRunEnv(t *testing.T) {
215 testCase := nerdtest.Setup()

Callers

nothing calls this directly

Calls 6

SetupFunction · 0.92
SaveMethod · 0.65
TempMethod · 0.65
CommandMethod · 0.65
PathMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…