(t *testing.T)
| 386 | } |
| 387 | |
| 388 | func TestCreateWithInvalidHealthcheckParams(t *testing.T) { |
| 389 | ctx := setupTest(t) |
| 390 | apiClient := testEnv.APIClient() |
| 391 | |
| 392 | testCases := []struct { |
| 393 | doc string |
| 394 | interval time.Duration |
| 395 | timeout time.Duration |
| 396 | retries int |
| 397 | startPeriod time.Duration |
| 398 | startInterval time.Duration |
| 399 | expectedErr string |
| 400 | }{ |
| 401 | { |
| 402 | doc: "test invalid Interval in Healthcheck: less than 0s", |
| 403 | interval: -10 * time.Millisecond, |
| 404 | timeout: time.Second, |
| 405 | retries: 1000, |
| 406 | expectedErr: fmt.Sprintf("Interval in Healthcheck cannot be less than %s", container.MinimumDuration), |
| 407 | }, |
| 408 | { |
| 409 | doc: "test invalid Interval in Healthcheck: larger than 0s but less than 1ms", |
| 410 | interval: 500 * time.Microsecond, |
| 411 | timeout: time.Second, |
| 412 | retries: 1000, |
| 413 | expectedErr: fmt.Sprintf("Interval in Healthcheck cannot be less than %s", container.MinimumDuration), |
| 414 | }, |
| 415 | { |
| 416 | doc: "test invalid Timeout in Healthcheck: less than 1ms", |
| 417 | interval: time.Second, |
| 418 | timeout: -100 * time.Millisecond, |
| 419 | retries: 1000, |
| 420 | expectedErr: fmt.Sprintf("Timeout in Healthcheck cannot be less than %s", container.MinimumDuration), |
| 421 | }, |
| 422 | { |
| 423 | doc: "test invalid Retries in Healthcheck: less than 0", |
| 424 | interval: time.Second, |
| 425 | timeout: time.Second, |
| 426 | retries: -10, |
| 427 | expectedErr: "Retries in Healthcheck cannot be negative", |
| 428 | }, |
| 429 | { |
| 430 | doc: "test invalid StartPeriod in Healthcheck: not 0 and less than 1ms", |
| 431 | interval: time.Second, |
| 432 | timeout: time.Second, |
| 433 | retries: 1000, |
| 434 | startPeriod: 100 * time.Microsecond, |
| 435 | expectedErr: fmt.Sprintf("StartPeriod in Healthcheck cannot be less than %s", container.MinimumDuration), |
| 436 | }, |
| 437 | { |
| 438 | doc: "test invalid StartInterval in Healthcheck: not 0 and less than 1ms", |
| 439 | interval: time.Second, |
| 440 | timeout: time.Second, |
| 441 | retries: 1000, |
| 442 | startPeriod: time.Second, |
| 443 | startInterval: 100 * time.Microsecond, |
| 444 | expectedErr: fmt.Sprintf("StartInterval in Healthcheck cannot be less than %s", container.MinimumDuration), |
| 445 | }, |
nothing calls this directly
no test coverage detected
searching dependent graphs…