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

Function TestNormalizeDependsOn

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

Source from the content-addressed store, hash-verified

110}
111
112func TestNormalizeDependsOn(t *testing.T) {
113 project := `
114name: myProject
115services:
116 foo:
117 depends_on:
118 bar:
119 condition: service_healthy
120 required: true
121 restart: true
122 network_mode: service:zot
123
124 bar:
125 volumes_from:
126 - zot
127 - container:xxx
128
129 zot: {}
130`
131 expected := `
132name: myProject
133services:
134 bar:
135 depends_on:
136 zot:
137 condition: service_started
138 required: true
139 restart: false
140 networks:
141 default: null
142 volumes_from:
143 - zot
144 - container:xxx
145 foo:
146 depends_on:
147 bar:
148 condition: service_healthy
149 required: true
150 restart: true
151 zot:
152 condition: service_started
153 required: true
154 restart: true
155 network_mode: service:zot
156 zot:
157 networks:
158 default: null
159networks:
160 default:
161 name: myProject_default
162`
163 var model map[string]any
164 err := yaml.Unmarshal([]byte(project), &model)
165 assert.NilError(t, err)
166 model, err = Normalize(model, nil)
167 assert.NilError(t, err)
168
169 var expect map[string]any

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…