Skip to content

Commit 9c40854

Browse files
authored
Add Datadog tracing (#273)
* Add Datadog tracing * go work vendor * Update go.mod * Update go.sum * Update go.mod * Add context to track things correctly * connect logs and traces * reuse the proper context * Fix error handling * fix build * only use err * err
1 parent c524600 commit 9c40854

14 files changed

+417
-143
lines changed

LICENSE-3rdparty.csv

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
11
Component,Origin,License
22
core,github.com/DataDog/agent-payload/v5/autoscaling/kubernetes,BSD-3-Clause
3+
core,github.com/DataDog/appsec-internal-go,Apache-2.0
4+
core,github.com/DataDog/datadog-agent/pkg/obfuscate,Apache-2.0
5+
core,github.com/DataDog/datadog-agent/pkg/proto/pbgo/trace,Apache-2.0
6+
core,github.com/DataDog/datadog-agent/pkg/remoteconfig/state,Apache-2.0
7+
core,github.com/DataDog/datadog-agent/pkg/trace,Apache-2.0
8+
core,github.com/DataDog/datadog-agent/pkg/util/log,Apache-2.0
9+
core,github.com/DataDog/datadog-agent/pkg/util/scrubber,Apache-2.0
310
core,github.com/DataDog/datadog-go/v5/statsd,MIT
11+
core,github.com/DataDog/dd-trace-go/contrib/net/http/v2,Apache-2.0
12+
core,github.com/DataDog/dd-trace-go/v2,Apache-2.0
13+
core,github.com/DataDog/go-libddwaf/v3,Apache-2.0
14+
core,github.com/DataDog/go-runtime-metrics-internal/pkg/runtimemetrics,Apache-2.0
15+
core,github.com/DataDog/go-sqllexer,MIT
16+
core,github.com/DataDog/go-tuf,BSD-3-Clause
417
core,github.com/DataDog/gostackparse,Apache-2.0
18+
core,github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes,Apache-2.0
19+
core,github.com/DataDog/sketches-go/ddsketch,Apache-2.0
520
core,github.com/DataDog/watermarkpodautoscaler,Apache-2.0
621
core,github.com/DataDog/watermarkpodautoscaler/apis/datadoghq/v1alpha1,Unknown
722
core,github.com/DataDog/watermarkpodautoscaler/third_party/kubernetes/pkg/controller/podautoscaler/metrics,Apache-2.0
823
core,github.com/beorn7/perks/quantile,MIT
924
core,github.com/cespare/xxhash/v2,MIT
1025
core,github.com/chrusty/protoc-gen-jsonschema,Apache-2.0
26+
core,github.com/cihub/seelog,BSD-3-Clause
1127
core,github.com/davecgh/go-spew/spew,ISC
28+
core,github.com/dustin/go-humanize,MIT
29+
core,github.com/eapache/queue/v2,MIT
30+
core,github.com/ebitengine/purego,Apache-2.0
1231
core,github.com/emicklei/go-restful/v3,MIT
1332
core,github.com/evanphx/json-patch/v5,BSD-3-Clause
1433
core,github.com/fsnotify/fsnotify,BSD-3-Clause
@@ -26,16 +45,23 @@ core,github.com/google/go-cmp/cmp,BSD-3-Clause
2645
core,github.com/google/gofuzz,Apache-2.0
2746
core,github.com/google/pprof/profile,Apache-2.0
2847
core,github.com/google/uuid,BSD-3-Clause
48+
core,github.com/hashicorp/go-secure-stdlib/parseutil,MPL-2.0
49+
core,github.com/hashicorp/go-secure-stdlib/strutil,MPL-2.0
50+
core,github.com/hashicorp/go-sockaddr,MPL-2.0
2951
core,github.com/imdario/mergo,BSD-3-Clause
3052
core,github.com/josharian/intern,MIT
3153
core,github.com/json-iterator/go,MIT
3254
core,github.com/klauspost/compress,Apache-2.0
3355
core,github.com/klauspost/compress/internal/snapref,BSD-3-Clause
3456
core,github.com/klauspost/compress/zstd/internal/xxhash,MIT
3557
core,github.com/mailru/easyjson,MIT
58+
core,github.com/mitchellh/mapstructure,MIT
3659
core,github.com/modern-go/concurrent,Apache-2.0
3760
core,github.com/modern-go/reflect2,Apache-2.0
3861
core,github.com/munnerz/goautoneg,BSD-3-Clause
62+
core,github.com/outcaste-io/ristretto,Apache-2.0
63+
core,github.com/outcaste-io/ristretto/z,MIT
64+
core,github.com/philhofer/fwd,MIT
3965
core,github.com/pkg/errors,BSD-2-Clause
4066
core,github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil,BSD-3-Clause
4167
core,github.com/prometheus/client_golang/prometheus,Apache-2.0
@@ -45,22 +71,40 @@ core,github.com/prometheus/procfs,Apache-2.0
4571
core,github.com/richardartoul/molecule,MIT
4672
core,github.com/richardartoul/molecule/src/codec,Apache-2.0
4773
core,github.com/richardartoul/molecule/src/protowire,BSD-3-Clause
74+
core,github.com/ryanuber/go-glob,MIT
75+
core,github.com/secure-systems-lab/go-securesystemslib/cjson,MIT
76+
core,github.com/shirou/gopsutil/v3,BSD-3-Clause
4877
core,github.com/spaolacci/murmur3,BSD-3-Clause
4978
core,github.com/spf13/pflag,BSD-3-Clause
79+
core,github.com/tinylib/msgp/msgp,MIT
80+
core,github.com/tklauser/go-sysconf,BSD-3-Clause
81+
core,github.com/tklauser/numcpus,Apache-2.0
5082
core,github.com/x448/float16,MIT
83+
core,go.opentelemetry.io/collector/component,Apache-2.0
84+
core,go.opentelemetry.io/collector/config/configtelemetry,Apache-2.0
85+
core,go.opentelemetry.io/collector/pdata,Apache-2.0
86+
core,go.opentelemetry.io/collector/semconv,Apache-2.0
87+
core,go.opentelemetry.io/otel,Apache-2.0
88+
core,go.opentelemetry.io/otel/metric,Apache-2.0
89+
core,go.opentelemetry.io/otel/trace,Apache-2.0
90+
core,go.uber.org/atomic,MIT
5191
core,go.uber.org/multierr,MIT
5292
core,go.uber.org/zap,MIT
5393
core,golang.org/x/exp/maps,BSD-3-Clause
94+
core,golang.org/x/mod/semver,BSD-3-Clause
5495
core,golang.org/x/net,BSD-3-Clause
5596
core,golang.org/x/oauth2,BSD-3-Clause
5697
core,golang.org/x/sys/unix,BSD-3-Clause
5798
core,golang.org/x/term,BSD-3-Clause
5899
core,golang.org/x/text,BSD-3-Clause
59100
core,golang.org/x/time/rate,BSD-3-Clause
101+
core,golang.org/x/xerrors,BSD-3-Clause
60102
core,gomodules.xyz/jsonpatch/v2,Apache-2.0
103+
core,google.golang.org/genproto/googleapis/rpc/status,Apache-2.0
104+
core,google.golang.org/grpc,Apache-2.0
61105
core,google.golang.org/protobuf,BSD-3-Clause
62-
core,gopkg.in/DataDog/dd-trace-go.v1,Apache-2.0
63106
core,gopkg.in/inf.v0,BSD-3-Clause
107+
core,gopkg.in/ini.v1,Apache-2.0
64108
core,gopkg.in/yaml.v2,Apache-2.0
65109
core,gopkg.in/yaml.v3,MIT
66110
core,k8s.io/api,Apache-2.0

apis/go.mod

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ require (
2929
github.com/modern-go/reflect2 v1.0.2 // indirect
3030
github.com/onsi/ginkgo/v2 v2.20.2 // indirect
3131
github.com/onsi/gomega v1.34.1 // indirect
32+
github.com/stretchr/testify v1.10.0 // indirect
3233
github.com/x448/float16 v0.8.4 // indirect
3334
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
34-
golang.org/x/net v0.29.0 // indirect
35-
golang.org/x/text v0.18.0 // indirect
35+
golang.org/x/net v0.33.0 // indirect
36+
golang.org/x/text v0.21.0 // indirect
3637
golang.org/x/tools v0.25.0 // indirect
37-
google.golang.org/protobuf v1.34.2 // indirect
38+
google.golang.org/protobuf v1.35.1 // indirect
3839
gopkg.in/inf.v0 v0.9.1 // indirect
3940
gopkg.in/yaml.v2 v2.4.0 // indirect
4041
gopkg.in/yaml.v3 v3.0.1 // indirect

apis/go.sum

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
7070
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
7171
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
7272
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
73-
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
74-
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
73+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
7574
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
7675
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
7776
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -87,20 +86,17 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
8786
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
8887
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
8988
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
90-
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
91-
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
89+
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
9290
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
9391
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
9492
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
9593
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
9694
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
9795
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
98-
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
99-
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
96+
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
10097
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
10198
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
102-
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
103-
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
99+
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
104100
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
105101
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
106102
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
@@ -111,8 +107,7 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
111107
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
112108
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
113109
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
114-
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
115-
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
110+
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
116111
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
117112
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
118113
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

controllers/datadoghq/recommender.go

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
"google.golang.org/protobuf/encoding/protojson"
2121
"google.golang.org/protobuf/types/known/structpb"
2222

23+
httptrace "github.com/DataDog/dd-trace-go/contrib/net/http/v2"
24+
2325
autoscaling "github.com/DataDog/agent-payload/v5/autoscaling/kubernetes"
2426

2527
"github.com/DataDog/watermarkpodautoscaler/apis/datadoghq/v1alpha1"
@@ -43,7 +45,7 @@ func metricNameForRecommender(spec *v1alpha1.WatermarkPodAutoscalerSpec) string
4345
}
4446

4547
type RecommenderClient interface {
46-
GetReplicaRecommendation(request *ReplicaRecommendationRequest) (*ReplicaRecommendationResponse, error)
48+
GetReplicaRecommendation(ctx context.Context, request *ReplicaRecommendationRequest) (*ReplicaRecommendationResponse, error)
4749
}
4850

4951
type RecommenderClientImpl struct {
@@ -124,23 +126,24 @@ func (r *RecommenderClientImpl) instrumentedClient(recommender string, tlsConfig
124126
func instrumentRoundTripper(recommender string, transport http.RoundTripper) http.RoundTripper {
125127
labels := prometheus.Labels{clientPromLabel: recommender}
126128

127-
return promhttp.InstrumentRoundTripperCounter(
128-
requestsTotal.MustCurryWith(labels),
129-
promhttp.InstrumentRoundTripperInFlight(
130-
responseInflight.With(labels),
131-
promhttp.InstrumentRoundTripperDuration(
132-
requestDuration.MustCurryWith(labels),
133-
transport,
129+
return httptrace.WrapRoundTripper(
130+
promhttp.InstrumentRoundTripperCounter(
131+
requestsTotal.MustCurryWith(labels),
132+
promhttp.InstrumentRoundTripperInFlight(
133+
responseInflight.With(labels),
134+
promhttp.InstrumentRoundTripperDuration(
135+
requestDuration.MustCurryWith(labels),
136+
transport,
137+
),
134138
),
135-
),
136-
)
139+
))
137140
}
138141

139142
// GetReplicaRecommendation returns a recommendation for the number of replicas to scale to
140143
// based on the given ReplicaRecommendationRequest.
141144
//
142145
// Currently, it supports http based recommendation service, but we need to implement grpc services too.
143-
func (r *RecommenderClientImpl) GetReplicaRecommendation(request *ReplicaRecommendationRequest) (*ReplicaRecommendationResponse, error) {
146+
func (r *RecommenderClientImpl) GetReplicaRecommendation(ctx context.Context, request *ReplicaRecommendationRequest) (*ReplicaRecommendationResponse, error) {
144147
reco := request.Recommender
145148
if reco == nil {
146149
return nil, fmt.Errorf("recommender spec is required")
@@ -166,7 +169,7 @@ func (r *RecommenderClientImpl) GetReplicaRecommendation(request *ReplicaRecomme
166169
}
167170

168171
// TODO: We might want to make the timeout configurable later.
169-
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
172+
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
170173
defer cancel()
171174

172175
client, err := r.instrumentedClient(request.Recommender.URL, mergeTLSConfig(r.options.tlsConfig, request.Recommender.TLSConfig))
@@ -175,12 +178,12 @@ func (r *RecommenderClientImpl) GetReplicaRecommendation(request *ReplicaRecomme
175178
}
176179

177180
httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, u.String(), bytes.NewReader(payload))
178-
httpReq.Header.Set("Content-Type", "application/json")
179-
httpReq.Header.Set("User-Agent", "wpa-controller")
180-
181181
if err != nil {
182182
return nil, fmt.Errorf("error creating request: %w", err)
183183
}
184+
185+
httpReq.Header.Set("Content-Type", "application/json")
186+
httpReq.Header.Set("User-Agent", "wpa-controller")
184187
resp, err := client.Do(httpReq)
185188

186189
defer func() {

controllers/datadoghq/recommender_test.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@ import (
2222
"testing"
2323
"time"
2424

25+
"github.com/stretchr/testify/assert"
26+
"github.com/stretchr/testify/require"
27+
2528
"google.golang.org/protobuf/encoding/protojson"
2629
"google.golang.org/protobuf/proto"
2730
"google.golang.org/protobuf/types/known/timestamppb"
2831
"k8s.io/apimachinery/pkg/api/resource"
2932

30-
"github.com/stretchr/testify/assert"
31-
"github.com/stretchr/testify/require"
32-
3333
autoscaling "github.com/DataDog/agent-payload/v5/autoscaling/kubernetes"
34+
3435
"github.com/DataDog/watermarkpodautoscaler/apis/datadoghq/v1alpha1"
3536
)
3637

@@ -41,7 +42,7 @@ func NewMockRecommenderClient() *RecommenderClientMock {
4142
}
4243
}
4344

44-
func (m *RecommenderClientMock) GetReplicaRecommendation(request *ReplicaRecommendationRequest) (*ReplicaRecommendationResponse, error) {
45+
func (m *RecommenderClientMock) GetReplicaRecommendation(ctx context.Context, request *ReplicaRecommendationRequest) (*ReplicaRecommendationResponse, error) {
4546
return &m.ReturnedResponse, m.Error
4647
}
4748

@@ -56,7 +57,7 @@ type RecommenderClientMock struct {
5657
func TestRecommenderClient(t *testing.T) {
5758
client := NewRecommenderClient(http.DefaultClient)
5859
// This should not work with empty requests.
59-
resp, err := client.GetReplicaRecommendation(&ReplicaRecommendationRequest{})
60+
resp, err := client.GetReplicaRecommendation(context.Background(), &ReplicaRecommendationRequest{})
6061
require.Error(t, err)
6162
require.Nil(t, resp)
6263
}
@@ -202,7 +203,7 @@ func TestPlaintextRecommendation(t *testing.T) {
202203
MinReplicas: 10,
203204
MaxReplicas: 30,
204205
}
205-
response, err := rc.GetReplicaRecommendation(request)
206+
response, err := rc.GetReplicaRecommendation(context.Background(), request)
206207
require.NoError(t, err)
207208

208209
expectedResponse := &ReplicaRecommendationResponse{
@@ -257,7 +258,7 @@ func TestTLSRecommendation(t *testing.T) {
257258
MinReplicas: 10,
258259
MaxReplicas: 30,
259260
}
260-
response, err := rc.GetReplicaRecommendation(request)
261+
response, err := rc.GetReplicaRecommendation(context.Background(), request)
261262
require.NoError(t, err)
262263

263264
expectedResponse := &ReplicaRecommendationResponse{
@@ -311,7 +312,7 @@ func TestTLSRecommendationWithDefaults(t *testing.T) {
311312
MinReplicas: 10,
312313
MaxReplicas: 30,
313314
}
314-
response, err := rc.GetReplicaRecommendation(request)
315+
response, err := rc.GetReplicaRecommendation(context.Background(), request)
315316
require.NoError(t, err)
316317

317318
expectedResponse := &ReplicaRecommendationResponse{
@@ -371,14 +372,14 @@ func TestTLSRecommendationWithClientCertificateMismatch(t *testing.T) {
371372
MaxReplicas: 30,
372373
}
373374

374-
_, err = rc.GetReplicaRecommendation(request)
375+
_, err = rc.GetReplicaRecommendation(context.Background(), request)
375376
require.Error(t, err)
376377
require.Contains(t, err.Error(), "tls: private key does not match public key")
377378

378379
// check that error is cached by removing the certificate which should trigger
379380
// a different error if the code actively reloads the certificate
380381
os.Remove(filepath.Join(tmp, "cert.pem"))
381-
_, err = rc.GetReplicaRecommendation(request)
382+
_, err = rc.GetReplicaRecommendation(context.Background(), request)
382383
require.Error(t, err)
383384
require.Contains(t, err.Error(), "tls: private key does not match public key")
384385
}

0 commit comments

Comments
 (0)