github.com/mackerelio/mackerel-agent-plugins@v0.89.3/mackerel-plugin-conntrack/lib/conntrack_test.go (about) 1 package mpconntrack 2 3 import ( 4 "fmt" 5 "testing" 6 ) 7 8 func TestCurrentValue(t *testing.T) { 9 samplePaths := []string{ 10 "./sample/nf_conntrack_count", 11 } 12 13 _, err := CurrentValue(samplePaths) 14 if err != nil { 15 t.Errorf("%v", err) 16 } 17 18 failPaths := []string{ 19 "./sample/nf_conntrack_unknown", 20 } 21 22 expect := fmt.Sprintf("Cannot find files %s", failPaths) 23 _, err = CurrentValue(failPaths) 24 if err.Error() != expect { 25 t.Errorf("expect %q to be equal %q", err, expect) 26 } 27 }