From 7f1a30f8d593e4c3421de53a8af53ab0399a76f6 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 11 Jan 2024 18:55:21 +0100 Subject: [PATCH] logs benchmark: fix config handling The logs config must be reset explicitly now when changing it multiple times per process. --- test/integration/logs/benchmark/benchmark_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/integration/logs/benchmark/benchmark_test.go b/test/integration/logs/benchmark/benchmark_test.go index 6e0cbe1a438..079c198a665 100644 --- a/test/integration/logs/benchmark/benchmark_test.go +++ b/test/integration/logs/benchmark/benchmark_test.go @@ -82,6 +82,11 @@ func BenchmarkEncoding(b *testing.B) { InfoStream: &output, } klog.SetOutput(&output) + defer func() { + if err := logsapi.ResetForTest(nil); err != nil { + b.Errorf("error resetting logsapi: %v", err) + } + }() if err := logsapi.ValidateAndApplyWithOptions(c, &o, nil); err != nil { b.Fatalf("Unexpected error configuring logging: %v", err) } @@ -237,6 +242,11 @@ func benchmarkOutputFormatStream(b *testing.B, config loadGeneratorConfig, disca } klog.SetOutput(o.ErrorStream) + defer func() { + if err := logsapi.ResetForTest(nil); err != nil { + b.Errorf("error resetting logsapi: %v", err) + } + }() if err := logsapi.ValidateAndApplyWithOptions(c, &o, featureGate); err != nil { b.Fatalf("Unexpected error configuring logging: %v", err) }