2015-08-26 21:27:44 +00:00
|
|
|
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
|
2016-06-23 15:28:17 +00:00
|
|
|
for _, key := range []string{"os.name", "os.version", "unique.hostname", "kernel.name"} {
|
2015-08-27 00:16:34 +00:00
|
|
|
assertNodeAttributeContains(t, node, key)
|
2015-08-26 21:27:44 +00:00
|
|
|
}
|
|
|
|
}
|