github.com/hhrutter/nomad@v0.6.0-rc2.0.20170723054333-80c4b03f0705/client/fingerprint/nomad_test.go (about) 1 package fingerprint 2 3 import ( 4 "testing" 5 6 "github.com/hashicorp/nomad/client/config" 7 "github.com/hashicorp/nomad/nomad/structs" 8 ) 9 10 func TestNomadFingerprint(t *testing.T) { 11 f := NewNomadFingerprint(testLogger()) 12 node := &structs.Node{ 13 Attributes: make(map[string]string), 14 } 15 v := "foo" 16 r := "123" 17 c := &config.Config{ 18 Version: v, 19 Revision: r, 20 } 21 ok, err := f.Fingerprint(c, node) 22 if err != nil { 23 t.Fatalf("err: %v", err) 24 } 25 if !ok { 26 t.Fatalf("should apply") 27 } 28 if node.Attributes["nomad.version"] != v { 29 t.Fatalf("incorrect version") 30 } 31 if node.Attributes["nomad.revision"] != r { 32 t.Fatalf("incorrect revision") 33 } 34 }