Merge pull request #1871 from hashicorp/b-tls-tests
Fixed a bunch of TLS related failures
This commit is contained in:
commit
6c527581af
|
@ -4,8 +4,6 @@ import (
|
|||
"fmt"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
||||
"github.com/hashicorp/go-cleanhttp"
|
||||
)
|
||||
|
||||
// Nodes is used to query node-related API endpoints
|
||||
|
@ -82,10 +80,7 @@ func (n *Nodes) Stats(nodeID string, q *QueryOptions) (*HostStats, error) {
|
|||
if node.HTTPAddr == "" {
|
||||
return nil, fmt.Errorf("http addr of the node %q is running is not advertised", nodeID)
|
||||
}
|
||||
client, err := NewClient(&Config{
|
||||
Address: fmt.Sprintf("http://%s", node.HTTPAddr),
|
||||
HttpClient: cleanhttp.DefaultClient(),
|
||||
})
|
||||
client, err := NewClient(n.client.config.CopyConfig(node.HTTPAddr, node.TLSEnabled))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -554,7 +554,7 @@ func TestAllocRunner_MoveAllocDir(t *testing.T) {
|
|||
|
||||
// Create another alloc runner
|
||||
alloc1 := mock.Alloc()
|
||||
task = alloc.Job.TaskGroups[0].Tasks[0]
|
||||
task = alloc1.Job.TaskGroups[0].Tasks[0]
|
||||
task.Driver = "mock_driver"
|
||||
task.Config = map[string]interface{}{
|
||||
"run_for": "1s",
|
||||
|
|
|
@ -292,17 +292,23 @@ func TestAllocDir_Snapshot(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAllocDir_Move(t *testing.T) {
|
||||
tmp, err := ioutil.TempDir("", "AllocDir")
|
||||
tmp1, err := ioutil.TempDir("", "AllocDir")
|
||||
if err != nil {
|
||||
t.Fatalf("Couldn't create temp dir: %v", err)
|
||||
}
|
||||
defer os.RemoveAll(tmp)
|
||||
defer os.RemoveAll(tmp1)
|
||||
|
||||
tmp2, err := ioutil.TempDir("", "AllocDir")
|
||||
if err != nil {
|
||||
t.Fatalf("Couldn't create temp dir: %v", err)
|
||||
}
|
||||
defer os.RemoveAll(tmp2)
|
||||
|
||||
// Create two alloc dirs
|
||||
d1 := NewAllocDir(tmp)
|
||||
d1 := NewAllocDir(tmp1)
|
||||
defer d1.Destroy()
|
||||
|
||||
d2 := NewAllocDir(tmp)
|
||||
d2 := NewAllocDir(tmp2)
|
||||
defer d2.Destroy()
|
||||
|
||||
tasks := []*structs.Task{t1, t2}
|
||||
|
|
|
@ -158,6 +158,7 @@ func DefaultConfig() *Config {
|
|||
LogOutput: os.Stderr,
|
||||
Region: "global",
|
||||
StatsCollectionInterval: 1 * time.Second,
|
||||
TLSConfig: &config.TLSConfig{},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ func TestConfig_Parse(t *testing.T) {
|
|||
TaskTokenTTL: "1s",
|
||||
Token: "12345",
|
||||
},
|
||||
TLSConfig: &TLSConfig{
|
||||
TLSConfig: &config.TLSConfig{
|
||||
EnableHTTP: true,
|
||||
EnableRPC: true,
|
||||
VerifyServerHostname: true,
|
||||
|
|
|
@ -16,7 +16,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/hashicorp/nomad/client/allocdir"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
"github.com/hashicorp/nomad/testutil"
|
||||
"github.com/ugorji/go/codec"
|
||||
)
|
||||
|
|
|
@ -18,7 +18,18 @@ func TestMeta_FlagSet(t *testing.T) {
|
|||
},
|
||||
{
|
||||
FlagSetClient,
|
||||
[]string{"address", "no-color", "region"},
|
||||
[]string{
|
||||
"address",
|
||||
"no-color",
|
||||
"region",
|
||||
"address",
|
||||
"ca-cert",
|
||||
"ca-path",
|
||||
"client-cert",
|
||||
"client-key",
|
||||
"insecure",
|
||||
"tls-skip-verify",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -243,6 +243,7 @@ func DefaultConfig() *Config {
|
|||
ConsulConfig: config.DefaultConsulConfig(),
|
||||
VaultConfig: config.DefaultVaultConfig(),
|
||||
RPCHoldTimeout: 5 * time.Second,
|
||||
TLSConfig: &config.TLSConfig{},
|
||||
}
|
||||
|
||||
// Enable all known schedulers by default
|
||||
|
|
Loading…
Reference in a new issue