forked from dynport/metrix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdf_test.go
31 lines (25 loc) · 791 Bytes
/
df_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestDf(t *testing.T) {
Convey("Df", t, func() {
mh := new(MetricHandler)
col := &Df{
RawSpace: readFile("fixtures/df.txt"),
RawInode: readFile("fixtures/df_inode.txt"),
}
stats, e := mh.Collect(col)
So(e, ShouldBeNil)
So(len(stats), ShouldEqual, 8)
So(stats[0].Key, ShouldEqual, "df.space.Total")
So(stats[0].Value, ShouldEqual, int64(20511356))
So(stats[0].Tags["file_system"], ShouldEqual, "/dev/sda")
So(stats[0].Tags["mounted_on"], ShouldEqual, "/")
So(stats[4].Key, ShouldEqual, "df.inode.Total")
So(stats[4].Value, ShouldEqual, int64(1310720))
So(stats[4].Tags["file_system"], ShouldEqual, "/dev/sda")
So(stats[4].Tags["mounted_on"], ShouldEqual, "/")
})
}