2021-12-18 18:01:29 +00:00
|
|
|
//go:build windows
|
2018-11-30 00:51:12 +00:00
|
|
|
// +build windows
|
|
|
|
|
2016-09-27 14:17:03 +00:00
|
|
|
package collector
|
|
|
|
|
2021-01-25 00:53:24 +00:00
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
2016-09-27 14:17:03 +00:00
|
|
|
|
|
|
|
func TestNetworkToInstanceName(t *testing.T) {
|
|
|
|
data := map[string]string{
|
|
|
|
"Intel[R] Dual Band Wireless-AC 8260": "Intel_R__Dual_Band_Wireless_AC_8260",
|
|
|
|
}
|
|
|
|
for in, out := range data {
|
|
|
|
got := mangleNetworkName(in)
|
|
|
|
if got != out {
|
|
|
|
t.Error("expected", out, "got", got)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-01-25 00:53:24 +00:00
|
|
|
|
|
|
|
func BenchmarkNetCollector(b *testing.B) {
|
2023-04-01 07:48:23 +00:00
|
|
|
// Include is not set in testing context (kingpin flags not parsed), causing the collector to skip all interfaces.
|
|
|
|
localNicInclude := ".+"
|
|
|
|
nicInclude = &localNicInclude
|
2022-12-21 05:44:29 +00:00
|
|
|
benchmarkCollector(b, "net", newNetworkCollector)
|
2021-01-25 00:53:24 +00:00
|
|
|
}
|