mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
* tests: swap testify for test in plugins/csi/client_test.go * tests: swap testify for test in testutil/ * tests: swap testify for test in host_test.go * tests: swap testify for test in plugin_test.go * tests: swap testify for test in utils_test.go * tests: swap testify for test in scheduler/ * tests: swap testify for test in parse_test.go * tests: swap testify for test in attribute_test.go * tests: swap testify for test in plugins/drivers/ * tests: swap testify for test in command/ * tests: fixup some test usages * go: run go mod tidy * windows: cpuset test only on linux
42 lines
1006 B
Go
42 lines
1006 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package host
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/shoenig/test/must"
|
|
)
|
|
|
|
func TestHostUtils(t *testing.T) {
|
|
mounts := mountedPaths()
|
|
must.SliceNotEmpty(t, mounts)
|
|
|
|
du, err := diskUsage("/")
|
|
must.NoError(t, err)
|
|
must.Positive(t, du.DiskMB)
|
|
must.Positive(t, du.UsedMB)
|
|
}
|
|
|
|
func TestMakeHostData(t *testing.T) {
|
|
|
|
t.Setenv("VAULT_TOKEN", "foo")
|
|
t.Setenv("BOGUS_TOKEN", "foo")
|
|
t.Setenv("BOGUS_SECRET", "foo")
|
|
t.Setenv("ryanSECRETS", "foo")
|
|
|
|
host, err := MakeHostData()
|
|
must.NoError(t, err)
|
|
must.NotEq(t, "", host.OS)
|
|
must.SliceNotEmpty(t, host.Network)
|
|
must.NotEq(t, "", host.ResolvConf)
|
|
must.NotEq(t, "", host.Hosts)
|
|
must.MapNotEmpty(t, host.Disk)
|
|
must.MapNotEmpty(t, host.Environment)
|
|
must.Eq(t, "<redacted>", host.Environment["VAULT_TOKEN"])
|
|
must.Eq(t, "<redacted>", host.Environment["BOGUS_TOKEN"])
|
|
must.Eq(t, "<redacted>", host.Environment["BOGUS_SECRET"])
|
|
must.Eq(t, "<redacted>", host.Environment["ryanSECRETS"])
|
|
}
|