open-nomad/client/fingerprint/arch_test.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
791 B
Go
Raw Normal View History

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
2015-08-20 23:29:19 +00:00
package fingerprint
import (
"testing"
"github.com/hashicorp/nomad/ci"
"github.com/hashicorp/nomad/client/config"
2018-06-13 22:33:25 +00:00
"github.com/hashicorp/nomad/helper/testlog"
2015-08-20 23:29:19 +00:00
"github.com/hashicorp/nomad/nomad/structs"
)
func TestArchFingerprint(t *testing.T) {
ci.Parallel(t)
f := NewArchFingerprint(testlog.HCLogger(t))
2015-08-20 23:29:19 +00:00
node := &structs.Node{
Attributes: make(map[string]string),
}
request := &FingerprintRequest{Config: &config.Config{}, Node: node}
var response FingerprintResponse
err := f.Fingerprint(request, &response)
2015-08-20 23:29:19 +00:00
if err != nil {
t.Fatalf("err: %v", err)
}
2018-01-31 22:03:55 +00:00
if !response.Detected {
t.Fatalf("expected response to be applicable")
}
assertNodeAttributeContains(t, response.Attributes, "cpu.arch")
2015-08-20 23:29:19 +00:00
}