Add support for more readiness args
This commit is contained in:
james song
2021-05-19 23:52:33 +08:00
committed by GitHub
parent 771ecbf471
commit 0b331d9e5d
6 changed files with 112 additions and 4 deletions
+33 -1
View File
@@ -57,7 +57,39 @@ func TestParseHealthCheck(t *testing.T) {
Retries: 2,
StartPeriod: 3,
}
output, err := parseHealthCheck(check)
output, err := parseHealthCheck(check, nil)
if err != nil {
t.Errorf("Unable to convert HealthCheckConfig: %s", err)
}
if !reflect.DeepEqual(output, expected) {
t.Errorf("Structs are not equal, expected: %v, output: %v", expected, output)
}
}
func TestParseHttpHealthCheck(t *testing.T) {
helperValue := uint64(2)
check := types.HealthCheckConfig{
Timeout: durationTypesPtr(1 * time.Second),
Interval: durationTypesPtr(2 * time.Second),
Retries: &helperValue,
StartPeriod: durationTypesPtr(3 * time.Second),
}
label := types.Labels{
HealthCheckLivenessHTTPGetPath: "ping",
HealthCheckLivenessHTTPGetPort: "80",
}
// CMD-SHELL or SHELL is included Test within docker/cli, thus we remove the first value in Test
expected := kobject.HealthCheck{
HTTPPath: "ping",
HTTPPort: 80,
Timeout: 1,
Interval: 2,
Retries: 2,
StartPeriod: 3,
}
output, err := parseHealthCheck(check, label)
if err != nil {
t.Errorf("Unable to convert HealthCheckConfig: %s", err)
}