node_exporter/collector/netstat_test.go
Tobias Schmidt 974f6fc762 Fix tests
2014-11-24 18:34:02 -05:00

28 lines
543 B
Go

package collector
import (
"os"
"testing"
)
func TestNetStats(t *testing.T) {
file, err := os.Open("fixtures/netstat")
if err != nil {
t.Fatal(err)
}
defer file.Close()
netStats, err := parseNetStats(file)
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)
}
}