(t *testing.T)
| 23 | } |
| 24 | |
| 25 | func 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 | |
| 55 | func TestInvalidInterpolation(t *testing.T) { |
| 56 | services := map[string]any{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…