open-nomad/client/fingerprint/host_test.go
2016-06-23 11:28:17 -04:00

28 lines
571 B
Go

package fingerprint
import (
"testing"
"github.com/hashicorp/nomad/client/config"
"github.com/hashicorp/nomad/nomad/structs"
)
func TestHostFingerprint(t *testing.T) {
f := NewHostFingerprint(testLogger())
node := &structs.Node{
Attributes: make(map[string]string),
}
ok, err := f.Fingerprint(&config.Config{}, node)
if err != nil {
t.Fatalf("err: %v", err)
}
if !ok {
t.Fatalf("should apply")
}
// Host info
for _, key := range []string{"os.name", "os.version", "unique.hostname", "kernel.name"} {
assertNodeAttributeContains(t, node, key)
}
}