MCPcopy
hub / github.com/prometheus/node_exporter / TestDefaultSysPath

Function TestDefaultSysPath

collector/paths_test.go:51–63  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestDefaultSysPath(t *testing.T) {
52 if _, err := kingpin.CommandLine.Parse([]string{"--path.sysfs", "/sys"}); err != nil {
53 t.Fatal(err)
54 }
55
56 if got, want := sysFilePath("somefile"), "/sys/somefile"; got != want {
57 t.Errorf("Expected: %s, Got: %s", want, got)
58 }
59
60 if got, want := sysFilePath("some/file"), "/sys/some/file"; got != want {
61 t.Errorf("Expected: %s, Got: %s", want, got)
62 }
63}
64
65func TestCustomSysPath(t *testing.T) {
66 if _, err := kingpin.CommandLine.Parse([]string{"--path.sysfs", "./../some/./place/"}); err != nil {

Callers

nothing calls this directly

Calls 1

sysFilePathFunction · 0.85

Tested by

no test coverage detected