2015-08-27 19:58:37 +00:00
|
|
|
package fingerprint
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/hashicorp/nomad/client/config"
|
|
|
|
"github.com/hashicorp/nomad/nomad/structs"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMemoryFingerprint(t *testing.T) {
|
|
|
|
f := NewMemoryFingerprint(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")
|
|
|
|
}
|
|
|
|
|
2015-08-27 21:01:47 +00:00
|
|
|
assertNodeAttributeContains(t, node, "memory.totalbytes")
|
|
|
|
|
|
|
|
if node.Resources == nil {
|
|
|
|
t.Fatalf("Node Resources was nil")
|
2015-08-27 19:58:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|