github.com/hhrutter/nomad@v0.6.0-rc2.0.20170723054333-80c4b03f0705/client/fingerprint/vault_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 "github.com/hashicorp/nomad/testutil" 9 ) 10 11 func TestVaultFingerprint(t *testing.T) { 12 tv := testutil.NewTestVault(t).Start() 13 defer tv.Stop() 14 15 fp := NewVaultFingerprint(testLogger()) 16 node := &structs.Node{ 17 Attributes: make(map[string]string), 18 } 19 20 config := config.DefaultConfig() 21 config.VaultConfig = tv.Config 22 23 ok, err := fp.Fingerprint(config, node) 24 if err != nil { 25 t.Fatalf("Failed to fingerprint: %s", err) 26 } 27 if !ok { 28 t.Fatalf("Failed to apply node attributes") 29 } 30 31 assertNodeAttributeContains(t, node, "vault.accessible") 32 assertNodeAttributeContains(t, node, "vault.version") 33 assertNodeAttributeContains(t, node, "vault.cluster_id") 34 assertNodeAttributeContains(t, node, "vault.cluster_name") 35 }