MCPcopy Create free account
hub / github.com/docker/cli / TestInterpolate

Function TestInterpolate

cli/compose/interpolation/interpolation_test.go:25–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23}
24
25func TestInterpolate(t *testing.T) {
26 services := map[string]any{
27 "servicea": map[string]any{
28 "image": "example:${USER}",
29 "volumes": []any{"$FOO:/target"},
30 "logging": map[string]any{
31 "driver": "${FOO}",
32 "options": map[string]any{
33 "user": "$USER",
34 },
35 },
36 },
37 }
38 expected := map[string]any{
39 "servicea": map[string]any{
40 "image": "example:jenny",
41 "volumes": []any{"bar:/target"},
42 "logging": map[string]any{
43 "driver": "bar",
44 "options": map[string]any{
45 "user": "jenny",
46 },
47 },
48 },
49 }
50 result, err := Interpolate(services, Options{LookupValue: defaultMapping})
51 assert.NilError(t, err)
52 assert.Check(t, is.DeepEqual(expected, result))
53}
54
55func TestInvalidInterpolation(t *testing.T) {
56 services := map[string]any{

Callers

nothing calls this directly

Calls 1

InterpolateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…