1
0
Fork 0

Bump to go1.24

Co-authored-by: Romain <rtribotte@users.noreply.github.com>
This commit is contained in:
Kevin Pollet 2025-06-02 10:36:05 +02:00 committed by GitHub
parent 5f35c88805
commit cd16321dd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
88 changed files with 284 additions and 362 deletions

View file

@ -1,7 +1,6 @@
package metrics
import (
"context"
"net/http"
"strconv"
"testing"
@ -17,7 +16,7 @@ func TestDatadog(t *testing.T) {
// This is needed to make sure that UDP Listener listens for data a bit longer, otherwise it will quit after a millisecond
udp.Timeout = 5 * time.Second
datadogRegistry := RegisterDatadog(context.Background(), &types.Datadog{Address: ":18125", PushInterval: ptypes.Duration(time.Second), AddEntryPointsLabels: true, AddRoutersLabels: true, AddServicesLabels: true})
datadogRegistry := RegisterDatadog(t.Context(), &types.Datadog{Address: ":18125", PushInterval: ptypes.Duration(time.Second), AddEntryPointsLabels: true, AddRoutersLabels: true, AddServicesLabels: true})
defer StopDatadog()
if !datadogRegistry.IsEpEnabled() || !datadogRegistry.IsRouterEnabled() || !datadogRegistry.IsSvcEnabled() {
@ -35,7 +34,7 @@ func TestDatadogWithPrefix(t *testing.T) {
// This is needed to make sure that UDP Listener listens for data a bit longer, otherwise it will quit after a millisecond
udp.Timeout = 5 * time.Second
datadogRegistry := RegisterDatadog(context.Background(), &types.Datadog{Prefix: "testPrefix", Address: ":18125", PushInterval: ptypes.Duration(time.Second), AddEntryPointsLabels: true, AddRoutersLabels: true, AddServicesLabels: true})
datadogRegistry := RegisterDatadog(t.Context(), &types.Datadog{Prefix: "testPrefix", Address: ":18125", PushInterval: ptypes.Duration(time.Second), AddEntryPointsLabels: true, AddRoutersLabels: true, AddServicesLabels: true})
testDatadogRegistry(t, "testPrefix", datadogRegistry)
}

View file

@ -1,7 +1,6 @@
package metrics
import (
"context"
"fmt"
"io"
"net/http"
@ -27,7 +26,7 @@ func TestInfluxDB2(t *testing.T) {
}))
defer ts.Close()
influxDB2Registry := RegisterInfluxDB2(context.Background(),
influxDB2Registry := RegisterInfluxDB2(t.Context(),
&types.InfluxDB2{
Address: ts.URL,
Token: "test-token",

View file

@ -1,7 +1,6 @@
package metrics
import (
"context"
"fmt"
"io"
"net/http"
@ -23,7 +22,7 @@ func TestInfluxDB(t *testing.T) {
udp.Timeout = 5 * time.Second
influxDBClient = nil
influxDBRegistry := RegisterInfluxDB(context.Background(),
influxDBRegistry := RegisterInfluxDB(t.Context(),
&types.InfluxDB{
Address: ":8089",
PushInterval: ptypes.Duration(time.Second),
@ -147,7 +146,7 @@ func TestInfluxDBHTTP(t *testing.T) {
defer ts.Close()
influxDBClient = nil
influxDBRegistry := RegisterInfluxDB(context.Background(),
influxDBRegistry := RegisterInfluxDB(t.Context(),
&types.InfluxDB{
Address: ts.URL,
Protocol: "http",

View file

@ -1,7 +1,6 @@
package metrics
import (
"context"
"fmt"
"net/http"
"strconv"
@ -70,7 +69,7 @@ func TestRegisterPromState(t *testing.T) {
if test.initPromState {
initStandardRegistry(prom)
}
if registerPromState(context.Background()) {
if registerPromState(t.Context()) {
actualNbRegistries++
}
if test.unregisterPromState {
@ -91,7 +90,7 @@ func TestPrometheus(t *testing.T) {
promRegistry = prometheus.NewRegistry()
t.Cleanup(promState.reset)
prometheusRegistry := RegisterPrometheus(context.Background(), &types.Prometheus{
prometheusRegistry := RegisterPrometheus(t.Context(), &types.Prometheus{
AddEntryPointsLabels: true,
AddRoutersLabels: true,
AddServicesLabels: true,
@ -443,7 +442,7 @@ func TestPrometheusMetricRemoval(t *testing.T) {
promRegistry = prometheus.NewRegistry()
t.Cleanup(promState.reset)
prometheusRegistry := RegisterPrometheus(context.Background(), &types.Prometheus{AddEntryPointsLabels: true, AddServicesLabels: true, AddRoutersLabels: true})
prometheusRegistry := RegisterPrometheus(t.Context(), &types.Prometheus{AddEntryPointsLabels: true, AddServicesLabels: true, AddRoutersLabels: true})
defer promRegistry.Unregister(promState)
conf1 := dynamic.Configuration{
@ -534,7 +533,7 @@ func TestPrometheusMetricRemoveEndpointForRecoveredService(t *testing.T) {
promRegistry = prometheus.NewRegistry()
t.Cleanup(promState.reset)
prometheusRegistry := RegisterPrometheus(context.Background(), &types.Prometheus{AddServicesLabels: true})
prometheusRegistry := RegisterPrometheus(t.Context(), &types.Prometheus{AddServicesLabels: true})
defer promRegistry.Unregister(promState)
conf1 := dynamic.Configuration{
@ -573,7 +572,7 @@ func TestPrometheusMetricRemoveEndpointForRecoveredService(t *testing.T) {
func TestPrometheusRemovedMetricsReset(t *testing.T) {
t.Cleanup(promState.reset)
prometheusRegistry := RegisterPrometheus(context.Background(), &types.Prometheus{AddEntryPointsLabels: true, AddServicesLabels: true})
prometheusRegistry := RegisterPrometheus(t.Context(), &types.Prometheus{AddEntryPointsLabels: true, AddServicesLabels: true})
defer promRegistry.Unregister(promState)
conf1 := dynamic.Configuration{

View file

@ -1,7 +1,6 @@
package metrics
import (
"context"
"net/http"
"strconv"
"testing"
@ -21,7 +20,7 @@ func TestStatsD(t *testing.T) {
// This is needed to make sure that UDP Listener listens for data a bit longer, otherwise it will quit after a millisecond
udp.Timeout = 5 * time.Second
statsdRegistry := RegisterStatsd(context.Background(), &types.Statsd{Address: ":18125", PushInterval: ptypes.Duration(time.Second), AddEntryPointsLabels: true, AddRoutersLabels: true, AddServicesLabels: true})
statsdRegistry := RegisterStatsd(t.Context(), &types.Statsd{Address: ":18125", PushInterval: ptypes.Duration(time.Second), AddEntryPointsLabels: true, AddRoutersLabels: true, AddServicesLabels: true})
testRegistry(t, defaultMetricsPrefix, statsdRegistry)
}
@ -35,7 +34,7 @@ func TestStatsDWithPrefix(t *testing.T) {
// This is needed to make sure that UDP Listener listens for data a bit longer, otherwise it will quit after a millisecond
udp.Timeout = 5 * time.Second
statsdRegistry := RegisterStatsd(context.Background(), &types.Statsd{Address: ":18125", PushInterval: ptypes.Duration(time.Second), AddEntryPointsLabels: true, AddRoutersLabels: true, AddServicesLabels: true, Prefix: "testPrefix"})
statsdRegistry := RegisterStatsd(t.Context(), &types.Statsd{Address: ":18125", PushInterval: ptypes.Duration(time.Second), AddEntryPointsLabels: true, AddRoutersLabels: true, AddServicesLabels: true, Prefix: "testPrefix"})
testRegistry(t, "testPrefix", statsdRegistry)
}