open-nomad/client/fingerprint/os_test.go

29 lines
490 B
Go

package fingerprint
import (
"testing"
"github.com/hashicorp/nomad/client/config"
"github.com/hashicorp/nomad/nomad/structs"
)
func TestOSFingerprint(t *testing.T) {
f := NewOSFingerprint(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")
}
// OS info
if node.Attributes["os"] == "" {
t.Fatalf("missing OS")
}
}