(t *testing.T)
| 308 | } |
| 309 | |
| 310 | func TestUpdateHealthcheckTable(t *testing.T) { |
| 311 | type test struct { |
| 312 | flags [][2]string |
| 313 | initial *container.HealthConfig |
| 314 | expected *container.HealthConfig |
| 315 | err string |
| 316 | } |
| 317 | testCases := []test{ |
| 318 | { |
| 319 | flags: [][2]string{{"no-healthcheck", "true"}}, |
| 320 | initial: &container.HealthConfig{Test: []string{"CMD-SHELL", "cmd1"}, Retries: 10}, |
| 321 | expected: &container.HealthConfig{Test: []string{"NONE"}}, |
| 322 | }, |
| 323 | { |
| 324 | flags: [][2]string{{"health-cmd", "cmd1"}}, |
| 325 | initial: &container.HealthConfig{Test: []string{"NONE"}}, |
| 326 | expected: &container.HealthConfig{Test: []string{"CMD-SHELL", "cmd1"}}, |
| 327 | }, |
| 328 | { |
| 329 | flags: [][2]string{{"health-retries", "10"}}, |
| 330 | initial: &container.HealthConfig{Test: []string{"NONE"}}, |
| 331 | expected: &container.HealthConfig{Retries: 10}, |
| 332 | }, |
| 333 | { |
| 334 | flags: [][2]string{{"health-retries", "10"}}, |
| 335 | initial: &container.HealthConfig{Test: []string{"CMD", "cmd1"}}, |
| 336 | expected: &container.HealthConfig{Test: []string{"CMD", "cmd1"}, Retries: 10}, |
| 337 | }, |
| 338 | { |
| 339 | flags: [][2]string{{"health-interval", "1m"}}, |
| 340 | initial: &container.HealthConfig{Test: []string{"CMD", "cmd1"}}, |
| 341 | expected: &container.HealthConfig{Test: []string{"CMD", "cmd1"}, Interval: time.Minute}, |
| 342 | }, |
| 343 | { |
| 344 | flags: [][2]string{{"health-cmd", ""}}, |
| 345 | initial: &container.HealthConfig{Test: []string{"CMD", "cmd1"}, Retries: 10}, |
| 346 | expected: &container.HealthConfig{Retries: 10}, |
| 347 | }, |
| 348 | { |
| 349 | flags: [][2]string{{"health-retries", "0"}}, |
| 350 | initial: &container.HealthConfig{Test: []string{"CMD", "cmd1"}, Retries: 10}, |
| 351 | expected: &container.HealthConfig{Test: []string{"CMD", "cmd1"}}, |
| 352 | }, |
| 353 | { |
| 354 | flags: [][2]string{{"health-start-period", "1m"}}, |
| 355 | initial: &container.HealthConfig{Test: []string{"CMD", "cmd1"}}, |
| 356 | expected: &container.HealthConfig{Test: []string{"CMD", "cmd1"}, StartPeriod: time.Minute}, |
| 357 | }, |
| 358 | { |
| 359 | flags: [][2]string{{"health-cmd", "cmd1"}, {"no-healthcheck", "true"}}, |
| 360 | err: "--no-healthcheck conflicts with --health-* options", |
| 361 | }, |
| 362 | { |
| 363 | flags: [][2]string{{"health-interval", "10m"}, {"no-healthcheck", "true"}}, |
| 364 | err: "--no-healthcheck conflicts with --health-* options", |
| 365 | }, |
| 366 | { |
| 367 | flags: [][2]string{{"health-timeout", "1m"}, {"no-healthcheck", "true"}}, |
nothing calls this directly
no test coverage detected
searching dependent graphs…