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

Function TestConvertHealthcheck

cli/compose/convert/service_test.go:150–177  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

148}
149
150func TestConvertHealthcheck(t *testing.T) {
151 retries := uint64(10)
152 timeout := composetypes.Duration(30 * time.Second)
153 interval := composetypes.Duration(2 * time.Millisecond)
154 startPeriod := composetypes.Duration(time.Minute)
155 startInterval := composetypes.Duration(1 * time.Second)
156
157 source := &composetypes.HealthCheckConfig{
158 Test: []string{"EXEC", "touch", "/foo"},
159 Timeout: &timeout,
160 Interval: &interval,
161 Retries: &retries,
162 StartPeriod: &startPeriod,
163 StartInterval: &startInterval,
164 }
165 expected := &container.HealthConfig{
166 Test: source.Test,
167 Timeout: time.Duration(timeout),
168 Interval: time.Duration(interval),
169 StartPeriod: time.Duration(startPeriod),
170 StartInterval: time.Duration(startInterval),
171 Retries: 10,
172 }
173
174 healthcheck, err := convertHealthcheck(source)
175 assert.NilError(t, err)
176 assert.Check(t, is.DeepEqual(expected, healthcheck))
177}
178
179func TestConvertHealthcheckDisable(t *testing.T) {
180 source := &composetypes.HealthCheckConfig{Disable: true}

Callers

nothing calls this directly

Calls 1

convertHealthcheckFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…