github.com/smithx10/nomad@v0.9.1-rc1/client/fingerprint/arch_test.go (about)

     1  package fingerprint
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/nomad/client/config"
     7  	"github.com/hashicorp/nomad/helper/testlog"
     8  	"github.com/hashicorp/nomad/nomad/structs"
     9  )
    10  
    11  func TestArchFingerprint(t *testing.T) {
    12  	f := NewArchFingerprint(testlog.HCLogger(t))
    13  	node := &structs.Node{
    14  		Attributes: make(map[string]string),
    15  	}
    16  
    17  	request := &FingerprintRequest{Config: &config.Config{}, Node: node}
    18  	var response FingerprintResponse
    19  	err := f.Fingerprint(request, &response)
    20  	if err != nil {
    21  		t.Fatalf("err: %v", err)
    22  	}
    23  
    24  	if !response.Detected {
    25  		t.Fatalf("expected response to be applicable")
    26  	}
    27  
    28  	assertNodeAttributeContains(t, response.Attributes, "cpu.arch")
    29  }