Exporter for machine metrics
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
578 B

10 years ago
package collector
import (
"os"
"testing"
)
var fileName = "fixtures/netstat"
10 years ago
func TestNetStats(t *testing.T) {
file, err := os.Open(fileName)
10 years ago
if err != nil {
t.Fatal(err)
}
defer file.Close()
netStats, err := parseNetStats(file, fileName)
10 years ago
if err != nil {
t.Fatal(err)
}
if want, got := "102471", netStats["TcpExt"]["DelayedACKs"]; want != got {
t.Errorf("want netstat TCP DelayedACKs %s, got %s", want, got)
}
if want, got := "2786264347", netStats["IpExt"]["OutOctets"]; want != got {
t.Errorf("want netstat IP OutOctets %s, got %s", want, got)
}
}