test(proxy): build the test metrics from the default config

Assisted-by: Claude Code:claude-opus-5-5
This commit is contained in:
Sara Ahmadi committed 2026-11-24 11:31:53 +01:00
1 parent 814a2a763f
commit 1aa9a5a80d
1 file changed
+4 -2
+4 -2
View File
@@ -26,9 +26,11 @@ var (
testMetricsErr error
)
func newTestMetrics(t *testing.T, cfg *config.Config) metrics.Metrics {
// newTestMetrics returns metrics for the routes of the default config.
func newTestMetrics(t *testing.T) metrics.Metrics {
t.Helper()
testMetricsOnce.Do(func() {
cfg := defaults.FullDefaultConfig()
logger := log.NopLogger()
testMetrics, testMetricsErr = metrics.New(func(yield func(config.Route) bool) {
for _, pol := range cfg.Policies {
@@ -98,7 +100,7 @@ func TestUnauthenticatedRequestChallenges(t *testing.T) {
chain, err := loadMiddlewares(
log.NopLogger(), cfg,
microstore.NewMemoryStore(), microstore.NewMemoryStore(),
noop.NewTracerProvider(), newTestMetrics(t, cfg),
noop.NewTracerProvider(), newTestMetrics(t),
nil, nil, nil, selector.NewSelector(),
)
require.NoError(t, err)