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"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/hashicorp/go-cleanhttp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Nodes is used to query node-related API endpoints
|
// 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 == "" {
|
if node.HTTPAddr == "" {
|
||||||
return nil, fmt.Errorf("http addr of the node %q is running is not advertised", nodeID)
|
return nil, fmt.Errorf("http addr of the node %q is running is not advertised", nodeID)
|
||||||
}
|
}
|
||||||
client, err := NewClient(&Config{
|
client, err := NewClient(n.client.config.CopyConfig(node.HTTPAddr, node.TLSEnabled))
|
||||||
Address: fmt.Sprintf("http://%s", node.HTTPAddr),
|
|
||||||
HttpClient: cleanhttp.DefaultClient(),
|
|
||||||
})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -554,7 +554,7 @@ func TestAllocRunner_MoveAllocDir(t *testing.T) {
|
||||||
|
|
||||||
// Create another alloc runner
|
// Create another alloc runner
|
||||||
alloc1 := mock.Alloc()
|
alloc1 := mock.Alloc()
|
||||||
task = alloc.Job.TaskGroups[0].Tasks[0]
|
task = alloc1.Job.TaskGroups[0].Tasks[0]
|
||||||
task.Driver = "mock_driver"
|
task.Driver = "mock_driver"
|
||||||
task.Config = map[string]interface{}{
|
task.Config = map[string]interface{}{
|
||||||
"run_for": "1s",
|
"run_for": "1s",
|
||||||
|
|
|
@ -292,17 +292,23 @@ func TestAllocDir_Snapshot(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAllocDir_Move(t *testing.T) {
|
func TestAllocDir_Move(t *testing.T) {
|
||||||
tmp, err := ioutil.TempDir("", "AllocDir")
|
tmp1, err := ioutil.TempDir("", "AllocDir")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Couldn't create temp dir: %v", err)
|
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
|
// Create two alloc dirs
|
||||||
d1 := NewAllocDir(tmp)
|
d1 := NewAllocDir(tmp1)
|
||||||
defer d1.Destroy()
|
defer d1.Destroy()
|
||||||
|
|
||||||
d2 := NewAllocDir(tmp)
|
d2 := NewAllocDir(tmp2)
|
||||||
defer d2.Destroy()
|
defer d2.Destroy()
|
||||||
|
|
||||||
tasks := []*structs.Task{t1, t2}
|
tasks := []*structs.Task{t1, t2}
|
||||||
|
|
|
@ -158,6 +158,7 @@ func DefaultConfig() *Config {
|
||||||
LogOutput: os.Stderr,
|
LogOutput: os.Stderr,
|
||||||
Region: "global",
|
Region: "global",
|
||||||
StatsCollectionInterval: 1 * time.Second,
|
StatsCollectionInterval: 1 * time.Second,
|
||||||
|
TLSConfig: &config.TLSConfig{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ func TestConfig_Parse(t *testing.T) {
|
||||||
TaskTokenTTL: "1s",
|
TaskTokenTTL: "1s",
|
||||||
Token: "12345",
|
Token: "12345",
|
||||||
},
|
},
|
||||||
TLSConfig: &TLSConfig{
|
TLSConfig: &config.TLSConfig{
|
||||||
EnableHTTP: true,
|
EnableHTTP: true,
|
||||||
EnableRPC: true,
|
EnableRPC: true,
|
||||||
VerifyServerHostname: true,
|
VerifyServerHostname: true,
|
||||||
|
|
|
@ -16,7 +16,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/nomad/client/allocdir"
|
"github.com/hashicorp/nomad/client/allocdir"
|
||||||
"github.com/hashicorp/nomad/nomad/structs"
|
|
||||||
"github.com/hashicorp/nomad/testutil"
|
"github.com/hashicorp/nomad/testutil"
|
||||||
"github.com/ugorji/go/codec"
|
"github.com/ugorji/go/codec"
|
||||||
)
|
)
|
||||||
|
|
|
@ -18,7 +18,18 @@ func TestMeta_FlagSet(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
FlagSetClient,
|
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(),
|
ConsulConfig: config.DefaultConsulConfig(),
|
||||||
VaultConfig: config.DefaultVaultConfig(),
|
VaultConfig: config.DefaultVaultConfig(),
|
||||||
RPCHoldTimeout: 5 * time.Second,
|
RPCHoldTimeout: 5 * time.Second,
|
||||||
|
TLSConfig: &config.TLSConfig{},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable all known schedulers by default
|
// Enable all known schedulers by default
|
||||||
|
|
Loading…
Reference in a new issue