2015-08-19 02:00:27 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestSSH_CreateTLSClient(t *testing.T) {
|
|
|
|
// load the default configuration
|
2016-02-26 22:01:40 +00:00
|
|
|
config, err := LoadSSHHelperConfig("./test-fixtures/agent_config.hcl")
|
2015-08-19 02:00:27 +00:00
|
|
|
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"))
|
|
|
|
}
|
|
|
|
}
|