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

Function TestNormalizeEnvironment

loader/normalize_test.go:340–378  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

338}
339
340func TestNormalizeEnvironment(t *testing.T) {
341 project := `
342name: myProject
343services:
344 test:
345 environment:
346 - FOO
347 - BAR
348 - ZOT=QIX
349`
350
351 expected := `
352name: myProject
353networks:
354 default:
355 name: myProject_default
356services:
357 test:
358 environment:
359 - FOO
360 - BAR=bar
361 - ZOT=QIX
362 networks:
363 default: null
364`
365 var model map[string]any
366 err := yaml.Unmarshal([]byte(project), &model)
367 assert.NilError(t, err)
368 model, err = Normalize(model, map[string]string{
369 "BAR": "bar",
370 "ZOT": "zot",
371 })
372 assert.NilError(t, err)
373
374 var expect map[string]any
375 err = yaml.Unmarshal([]byte(expected), &expect)
376 assert.NilError(t, err)
377 assert.DeepEqual(t, expect, model)
378}
379
380func TestNormalizePreStartInheritsServiceImage(t *testing.T) {
381 project := `

Callers

nothing calls this directly

Calls 1

NormalizeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…