mirror of
https://github.com/gravitational/teleport.git
synced 2026-09-24 16:17:11 +08:00
Fix health check config equivalence check (#56050)
The config timeout was not compared for equivalence before, but the only consequence of this was that the health check worker would not log a debug message about the config update if only the timeout setting changed.
This commit is contained in:
@@ -68,6 +68,7 @@ func (h *healthCheckConfig) equivalent(other *healthCheckConfig) bool {
|
||||
h.name == other.name &&
|
||||
h.protocol == other.protocol &&
|
||||
h.interval == other.interval &&
|
||||
h.timeout == other.timeout &&
|
||||
h.healthyThreshold == other.healthyThreshold &&
|
||||
h.unhealthyThreshold == other.unhealthyThreshold
|
||||
}
|
||||
|
||||
@@ -123,6 +123,12 @@ func TestHealthCheckConfig_equivalent(t *testing.T) {
|
||||
b: nil,
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
desc: "both empty",
|
||||
a: &healthCheckConfig{},
|
||||
b: &healthCheckConfig{},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
desc: "one nil, one non-nil",
|
||||
a: &healthCheckConfig{},
|
||||
@@ -135,6 +141,7 @@ func TestHealthCheckConfig_equivalent(t *testing.T) {
|
||||
name: "test",
|
||||
protocol: "http",
|
||||
interval: time.Second,
|
||||
timeout: 500 * time.Millisecond,
|
||||
healthyThreshold: 3,
|
||||
unhealthyThreshold: 5,
|
||||
},
|
||||
@@ -142,6 +149,7 @@ func TestHealthCheckConfig_equivalent(t *testing.T) {
|
||||
name: "test",
|
||||
protocol: "http",
|
||||
interval: time.Second,
|
||||
timeout: 500 * time.Millisecond,
|
||||
healthyThreshold: 3,
|
||||
unhealthyThreshold: 5,
|
||||
},
|
||||
@@ -153,6 +161,7 @@ func TestHealthCheckConfig_equivalent(t *testing.T) {
|
||||
name: "test",
|
||||
protocol: "http",
|
||||
interval: time.Second,
|
||||
timeout: 500 * time.Millisecond,
|
||||
healthyThreshold: 3,
|
||||
unhealthyThreshold: 5,
|
||||
databaseLabelMatchers: types.LabelMatchers{Expression: "a", Labels: types.Labels{"a": {"a"}}},
|
||||
@@ -161,6 +170,7 @@ func TestHealthCheckConfig_equivalent(t *testing.T) {
|
||||
name: "test",
|
||||
protocol: "http",
|
||||
interval: time.Second,
|
||||
timeout: 500 * time.Millisecond,
|
||||
healthyThreshold: 3,
|
||||
unhealthyThreshold: 5,
|
||||
databaseLabelMatchers: types.LabelMatchers{Expression: "b", Labels: types.Labels{"b": {"b"}}},
|
||||
@@ -197,6 +207,16 @@ func TestHealthCheckConfig_equivalent(t *testing.T) {
|
||||
},
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
desc: "different timeout",
|
||||
a: &healthCheckConfig{
|
||||
timeout: time.Second,
|
||||
},
|
||||
b: &healthCheckConfig{
|
||||
timeout: 2 * time.Second,
|
||||
},
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
desc: "different healthyThreshold",
|
||||
a: &healthCheckConfig{
|
||||
|
||||
Reference in New Issue
Block a user