added os_test.go and removed wmi for testing

Signed-off-by: Ben Ridley <benridley29@gmail.com>
This commit is contained in:
retryW
2021-01-13 13:54:51 +11:00
committed by Ben Ridley
parent 048bff919e
commit 3da11645cf
2 changed files with 26 additions and 5 deletions

23
collector/os_test.go Normal file
View File

@@ -0,0 +1,23 @@
package collector
import (
"testing"
"github.com/prometheus/client_golang/prometheus"
)
func BenchmarkOsCollect(b *testing.B) {
o, err := NewOSCollector()
if err != nil {
b.Error(err)
}
metrics := make(chan prometheus.Metric)
go func() {
for {
<-metrics
}
}()
for i := 0; i < b.N; i++ {
o.Collect(&ScrapeContext{}, metrics)
}
}