2023-11-04 19:51:35 +00:00
|
|
|
package process_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/alecthomas/kingpin/v2"
|
2024-10-03 18:23:56 +00:00
|
|
|
"github.com/prometheus-community/windows_exporter/internal/collector/process"
|
|
|
|
"github.com/prometheus-community/windows_exporter/internal/testutils"
|
2023-11-04 19:51:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkProcessCollector(b *testing.B) {
|
2024-08-05 13:50:41 +00:00
|
|
|
// PrinterInclude is not set in testing context (kingpin flags not parsed), causing the collector to skip all processes.
|
2023-11-04 19:51:35 +00:00
|
|
|
localProcessInclude := ".+"
|
2024-08-05 13:50:41 +00:00
|
|
|
kingpin.CommandLine.GetArg("collector.process.include").StringVar(&localProcessInclude)
|
2023-11-04 19:51:35 +00:00
|
|
|
// No context name required as collector source is WMI
|
|
|
|
testutils.FuncBenchmarkCollector(b, process.Name, process.NewWithFlags)
|
|
|
|
}
|
2024-10-03 21:44:36 +00:00
|
|
|
|
2024-10-06 22:15:54 +00:00
|
|
|
func TestCollector(t *testing.T) {
|
|
|
|
testutils.TestCollector(t, process.New, nil)
|
2024-10-03 21:44:36 +00:00
|
|
|
}
|