mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-27 14:09:05 +01:00
utils: share the include/exclude regexp flag handling (#2737)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -22,7 +22,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/internal/collector/printer"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils/testutils"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
@@ -31,12 +30,7 @@ import (
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
// Whitelist is not set in testing context (kingpin flags not parsed), causing the collector to skip all printers.
|
||||
printersInclude := ".+"
|
||||
|
||||
testutils.FuncBenchmarkCollector(b, "printer", printer.NewWithFlags, func(app *kingpin.Application) {
|
||||
app.GetFlag("collector.printer.include").StringVar(&printersInclude)
|
||||
})
|
||||
testutils.FuncBenchmarkCollector(b, "printer", printer.NewWithFlags)
|
||||
}
|
||||
|
||||
func TestCollector(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user