Switch to kingpin flags (#639)
* Switch to kingpin flags * Fix logrus vendoring * Fix flags in main tests * Fix vendoring versions
This commit is contained in:
parent
1467d845fb
commit
dfe07eaae8
84 changed files with 9904 additions and 196 deletions
|
|
@ -14,14 +14,14 @@
|
|||
package collector
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/procfs"
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
func TestDefaultProcPath(t *testing.T) {
|
||||
if err := flag.Set("collector.procfs", procfs.DefaultMountPoint); err != nil {
|
||||
if _, err := kingpin.CommandLine.Parse([]string{"--collector.procfs", procfs.DefaultMountPoint}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func TestDefaultProcPath(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCustomProcPath(t *testing.T) {
|
||||
if err := flag.Set("collector.procfs", "./../some/./place/"); err != nil {
|
||||
if _, err := kingpin.CommandLine.Parse([]string{"--collector.procfs", "./../some/./place/"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ func TestCustomProcPath(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDefaultSysPath(t *testing.T) {
|
||||
if err := flag.Set("collector.sysfs", "/sys"); err != nil {
|
||||
if _, err := kingpin.CommandLine.Parse([]string{"--collector.sysfs", "/sys"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ func TestDefaultSysPath(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCustomSysPath(t *testing.T) {
|
||||
if err := flag.Set("collector.sysfs", "./../some/./place/"); err != nil {
|
||||
if _, err := kingpin.CommandLine.Parse([]string{"--collector.sysfs", "./../some/./place/"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue