mirror of
https://github.com/prometheus-community/windows_exporter
synced 2025-03-31 07:39:54 +00:00
Benchmarks will allow for easier identification of slow collectors. Additionally, they increase test coverage of the collectors, with some collectors now reaching 80-95% coverage with this change. Collector benchmarks have been structed so that common functionality is present in `collector/collector_test.go` as is done with non-test functionality in `collector/collector.go`. Test logic that is specific to individual collectors is present in the collector test file (E.G. `collector/process_test.go` for the Process collector). Signed-off-by: Ben Reedy <breed808@breed808.com>
14 lines
344 B
Go
14 lines
344 B
Go
package collector
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func BenchmarkLogicalDiskCollector(b *testing.B) {
|
|
// Whitelist is not set in testing context (kingpin flags not parsed), causing the collector to skip all disks.
|
|
localVolumeWhitelist := ".+"
|
|
volumeWhitelist = &localVolumeWhitelist
|
|
|
|
benchmarkCollector(b, "logical_disk", NewLogicalDiskCollector)
|
|
}
|