Merge pull request #9436 from hashicorp/dnephin/fix-service-health-req-cache-key
structs: fix caching of ServiceSpecificRequest when ingress=true
This commit is contained in:
commit
27a59f86d0
|
@ -0,0 +1,4 @@
|
||||||
|
```release-note:bug
|
||||||
|
cache: Fixed a bug where a DNS or API request for an ingress gateway would incorrectly
|
||||||
|
return a cached result for a service request with the same name, and vice versa.
|
||||||
|
``
|
|
@ -617,6 +617,7 @@ func (r *ServiceSpecificRequest) CacheInfo() cache.RequestInfo {
|
||||||
r.Connect,
|
r.Connect,
|
||||||
r.Filter,
|
r.Filter,
|
||||||
r.EnterpriseMeta,
|
r.EnterpriseMeta,
|
||||||
|
r.Ingress,
|
||||||
}, nil)
|
}, nil)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// If there is an error, we don't set the key. A blank key forces
|
// If there is an error, we don't set the key. A blank key forces
|
||||||
|
|
|
@ -1542,8 +1542,6 @@ func TestServiceSpecificRequestCacheInfoKey(t *testing.T) {
|
||||||
ignoredFields := map[string]bool{
|
ignoredFields := map[string]bool{
|
||||||
// TODO: should this filed be included?
|
// TODO: should this filed be included?
|
||||||
"ServiceKind": true,
|
"ServiceKind": true,
|
||||||
// TODO: this filed should be included: github.com/hashicorp/consul/pull/9436
|
|
||||||
"Ingress": true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assertCacheInfoKeyIsComplete(t, &ServiceSpecificRequest{}, ignoredFields)
|
assertCacheInfoKeyIsComplete(t, &ServiceSpecificRequest{}, ignoredFields)
|
||||||
|
@ -1715,6 +1713,16 @@ func TestSpecificServiceRequest_CacheInfo(t *testing.T) {
|
||||||
},
|
},
|
||||||
wantSame: false,
|
wantSame: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "with integress=true",
|
||||||
|
req: ServiceSpecificRequest{
|
||||||
|
Datacenter: "dc1",
|
||||||
|
ServiceName: "my-service",
|
||||||
|
},
|
||||||
|
mutate: func(req *ServiceSpecificRequest) {
|
||||||
|
req.Ingress = true
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
|
|
Loading…
Reference in New Issue