Vault SSH: TLS client creation test

This commit is contained in:
vishalnayak
2015-08-18 19:00:27 -07:00
parent 99736663e2
commit d6c5031169
4 changed files with 65 additions and 11 deletions

30
api/ssh_agent_test.go Normal file
View File

@@ -0,0 +1,30 @@
package api
import (
"fmt"
"testing"
)
func TestSSH_CreateTLSClient(t *testing.T) {
// load the default configuration
config, err := LoadSSHAgentConfig("./test-fixtures/agent_config.hcl")
if err != nil {
panic(fmt.Sprintf("error loading agent's config file: %s", err))
}
client, err := config.NewClient()
if err != nil {
panic(fmt.Sprintf("error creating the client: %s", err))
}
// Provide a certificate and enforce setting of transport
config.CACert = "./test-fixtures/vault.crt"
client, err = config.NewClient()
if err != nil {
panic(fmt.Sprintf("error creating the client: %s", err))
}
if client.config.HttpClient.Transport == nil {
panic(fmt.Sprintf("error creating client with TLS transport"))
}
}