MCPcopy Create free account
hub / github.com/compose-spec/compose-go / TestProjectWithDotEnv

Function TestProjectWithDotEnv

cli/options_test.go:276–292  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

274}
275
276func TestProjectWithDotEnv(t *testing.T) {
277 wd, err := os.Getwd()
278 assert.NilError(t, err)
279 err = os.Chdir("testdata/simple")
280 assert.NilError(t, err)
281 defer os.Chdir(wd) //nolint:errcheck
282
283 opts, err := NewProjectOptions([]string{
284 "compose-with-variables.yaml",
285 }, WithName("my_project"), WithEnvFiles(), WithDotEnv)
286 assert.NilError(t, err)
287 p, err := ProjectFromOptions(context.TODO(), opts)
288 assert.NilError(t, err)
289 service, err := p.GetService("simple")
290 assert.NilError(t, err)
291 assert.Equal(t, service.Ports[0].Published, "8000")
292}
293
294func TestProjectWithDiscardEnvFile(t *testing.T) {
295 opts, err := NewProjectOptions([]string{

Callers

nothing calls this directly

Calls 5

NewProjectOptionsFunction · 0.85
WithNameFunction · 0.85
WithEnvFilesFunction · 0.85
ProjectFromOptionsFunction · 0.85
GetServiceMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…