[BUGFIX] Do not use interval as timeout (#14619)
Do not use interval as timeout
This commit is contained in:
parent
3095d4d702
commit
13ac6356a8
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
checks: Do not set interval as timeout value
|
||||||
|
```
|
|
@ -2287,7 +2287,7 @@ func (a *Agent) addServiceInternal(req addServiceInternalRequest) error {
|
||||||
intervalStr = chkType.Interval.String()
|
intervalStr = chkType.Interval.String()
|
||||||
}
|
}
|
||||||
if chkType.Timeout != 0 {
|
if chkType.Timeout != 0 {
|
||||||
timeoutStr = chkType.Interval.String()
|
timeoutStr = chkType.Timeout.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
check := &structs.HealthCheck{
|
check := &structs.HealthCheck{
|
||||||
|
|
|
@ -418,6 +418,9 @@ func testAgent_AddService(t *testing.T, extraHCL string) {
|
||||||
`+extraHCL)
|
`+extraHCL)
|
||||||
defer a.Shutdown()
|
defer a.Shutdown()
|
||||||
|
|
||||||
|
duration3s, _ := time.ParseDuration("3s")
|
||||||
|
duration10s, _ := time.ParseDuration("10s")
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
desc string
|
desc string
|
||||||
srv *structs.NodeService
|
srv *structs.NodeService
|
||||||
|
@ -467,6 +470,50 @@ func testAgent_AddService(t *testing.T, extraHCL string) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"one http check with interval and duration",
|
||||||
|
&structs.NodeService{
|
||||||
|
ID: "svcid1",
|
||||||
|
Service: "svcname1",
|
||||||
|
Tags: []string{"tag1"},
|
||||||
|
Weights: nil, // nil weights...
|
||||||
|
Port: 8100,
|
||||||
|
EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
|
||||||
|
},
|
||||||
|
// ... should be populated to avoid "IsSame" returning true during AE.
|
||||||
|
func(ns *structs.NodeService) {
|
||||||
|
ns.Weights = &structs.Weights{
|
||||||
|
Passing: 1,
|
||||||
|
Warning: 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[]*structs.CheckType{
|
||||||
|
{
|
||||||
|
CheckID: "check1",
|
||||||
|
Name: "name1",
|
||||||
|
HTTP: "http://localhost:8100/",
|
||||||
|
Interval: duration10s,
|
||||||
|
Timeout: duration3s,
|
||||||
|
Notes: "note1",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
map[string]*structs.HealthCheck{
|
||||||
|
"check1": {
|
||||||
|
Node: "node1",
|
||||||
|
CheckID: "check1",
|
||||||
|
Name: "name1",
|
||||||
|
Interval: "10s",
|
||||||
|
Timeout: "3s",
|
||||||
|
Status: "critical",
|
||||||
|
Notes: "note1",
|
||||||
|
ServiceID: "svcid1",
|
||||||
|
ServiceName: "svcname1",
|
||||||
|
ServiceTags: []string{"tag1"},
|
||||||
|
Type: "http",
|
||||||
|
EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"multiple checks",
|
"multiple checks",
|
||||||
&structs.NodeService{
|
&structs.NodeService{
|
||||||
|
|
Loading…
Reference in New Issue