7b53474a6e
public fields and remove getter functions
33 lines
817 B
Go
33 lines
817 B
Go
package fingerprint
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hashicorp/nomad/client/config"
|
|
cstructs "github.com/hashicorp/nomad/client/structs"
|
|
"github.com/hashicorp/nomad/nomad/structs"
|
|
)
|
|
|
|
func TestMemoryFingerprint(t *testing.T) {
|
|
f := NewMemoryFingerprint(testLogger())
|
|
node := &structs.Node{
|
|
Attributes: make(map[string]string),
|
|
}
|
|
|
|
request := &cstructs.FingerprintRequest{Config: &config.Config{}, Node: node}
|
|
var response cstructs.FingerprintResponse
|
|
err := f.Fingerprint(request, &response)
|
|
if err != nil {
|
|
t.Fatalf("err: %v", err)
|
|
}
|
|
|
|
assertNodeAttributeContains(t, response.Attributes, "memory.totalbytes")
|
|
|
|
if response.Resources == nil {
|
|
t.Fatalf("response resources should not be nil")
|
|
}
|
|
if response.Resources.MemoryMB == 0 {
|
|
t.Fatalf("Expected node.Resources.MemoryMB to be non-zero")
|
|
}
|
|
}
|