pkg/sysinfo: remove github.com/docker/go-units dependency
It was only used in a test, and only for a single const; define it locally. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
6a516acb2e
commit
09ea6744fe
1 changed files with 7 additions and 6 deletions
|
@ -6,8 +6,6 @@ package sysinfo
|
|||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
units "github.com/docker/go-units"
|
||||
)
|
||||
|
||||
// TestMemInfo tests parseMemInfo with a static meminfo string
|
||||
|
@ -23,20 +21,23 @@ func TestMemInfo(t *testing.T) {
|
|||
Malformed3: 2 MB
|
||||
Malformed4: X kB
|
||||
`
|
||||
|
||||
const KiB = 1024
|
||||
|
||||
meminfo, err := parseMemInfo(strings.NewReader(input))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if meminfo.MemTotal != 1*units.KiB {
|
||||
if meminfo.MemTotal != 1*KiB {
|
||||
t.Fatalf("Unexpected MemTotal: %d", meminfo.MemTotal)
|
||||
}
|
||||
if meminfo.MemFree != 3*units.KiB {
|
||||
if meminfo.MemFree != 3*KiB {
|
||||
t.Fatalf("Unexpected MemFree: %d", meminfo.MemFree)
|
||||
}
|
||||
if meminfo.SwapTotal != 4*units.KiB {
|
||||
if meminfo.SwapTotal != 4*KiB {
|
||||
t.Fatalf("Unexpected SwapTotal: %d", meminfo.SwapTotal)
|
||||
}
|
||||
if meminfo.SwapFree != 5*units.KiB {
|
||||
if meminfo.SwapFree != 5*KiB {
|
||||
t.Fatalf("Unexpected SwapFree: %d", meminfo.SwapFree)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue