integration: fix a data race about `err`
don't share `err` between goroutines
@@ -41,12 +41,13 @@ func TestV3ClientMetrics(t *testing.T) {
var (
addr = "localhost:27989"
ln net.Listener
- err error
)
// listen for all Prometheus metrics
donec := make(chan struct{})
go func() {
+ var err error
+
defer close(donec)
srv := &http.Server{Handler: promhttp.Handler()}
@@ -87,7 +88,7 @@ func TestV3ClientMetrics(t *testing.T) {
pBefore := sumCountersForMetricAndLabels(t, url, "grpc_client_started_total", "Put", "unary")
- _, err = cli.Put(context.Background(), "foo", "bar")
+ _, err := cli.Put(context.Background(), "foo", "bar")
if err != nil {
t.Errorf("Error putting value in key store")
}
