mirror of https://github.com/hashicorp/consul
More test cleanup
parent
4aeab3897c
commit
7c7c858a9a
|
@ -565,9 +565,6 @@ func (a *Agent) ForceLeave(node string) error {
|
||||||
|
|
||||||
// ConnectAuthorize is used to authorize an incoming connection
|
// ConnectAuthorize is used to authorize an incoming connection
|
||||||
// to a natively integrated Connect service.
|
// to a natively integrated Connect service.
|
||||||
//
|
|
||||||
// TODO(mitchellh): we need to test this better once we have a way to
|
|
||||||
// configure CAs from the API package (when the CA work is done).
|
|
||||||
func (a *Agent) ConnectAuthorize(auth *AgentAuthorizeParams) (*AgentAuthorize, error) {
|
func (a *Agent) ConnectAuthorize(auth *AgentAuthorizeParams) (*AgentAuthorize, error) {
|
||||||
r := a.c.newRequest("POST", "/v1/agent/connect/authorize")
|
r := a.c.newRequest("POST", "/v1/agent/connect/authorize")
|
||||||
r.obj = auth
|
r.obj = auth
|
||||||
|
@ -585,9 +582,6 @@ func (a *Agent) ConnectAuthorize(auth *AgentAuthorizeParams) (*AgentAuthorize, e
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConnectCARoots returns the list of roots.
|
// ConnectCARoots returns the list of roots.
|
||||||
//
|
|
||||||
// TODO(mitchellh): we need to test this better once we have a way to
|
|
||||||
// configure CAs from the API package (when the CA work is done).
|
|
||||||
func (a *Agent) ConnectCARoots(q *QueryOptions) (*CARootList, *QueryMeta, error) {
|
func (a *Agent) ConnectCARoots(q *QueryOptions) (*CARootList, *QueryMeta, error) {
|
||||||
r := a.c.newRequest("GET", "/v1/agent/connect/ca/roots")
|
r := a.c.newRequest("GET", "/v1/agent/connect/ca/roots")
|
||||||
r.setQueryOptions(q)
|
r.setQueryOptions(q)
|
||||||
|
|
|
@ -1044,7 +1044,9 @@ func TestAPI_AgentConnectCARoots_empty(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
c, s := makeClient(t)
|
c, s := makeClientWithConfig(t, nil, func(c *testutil.TestServerConfig) {
|
||||||
|
c.Connect = nil // disable connect to prevent CA beening bootstrapped
|
||||||
|
})
|
||||||
defer s.Stop()
|
defer s.Stop()
|
||||||
|
|
||||||
agent := c.Agent()
|
agent := c.Agent()
|
||||||
|
@ -1058,12 +1060,7 @@ func TestAPI_AgentConnectCARoots_list(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
c, s := makeClientWithConfig(t, nil, func(c *testutil.TestServerConfig) {
|
c, s := makeClient(t)
|
||||||
// Force auto port range to 1 port so we have deterministic response.
|
|
||||||
c.Connect = map[string]interface{}{
|
|
||||||
"enabled": true,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
defer s.Stop()
|
defer s.Stop()
|
||||||
|
|
||||||
agent := c.Agent()
|
agent := c.Agent()
|
||||||
|
@ -1077,12 +1074,7 @@ func TestAPI_AgentConnectCALeaf(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
c, s := makeClientWithConfig(t, nil, func(c *testutil.TestServerConfig) {
|
c, s := makeClient(t)
|
||||||
// Force auto port range to 1 port so we have deterministic response.
|
|
||||||
c.Connect = map[string]interface{}{
|
|
||||||
"enabled": true,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
defer s.Stop()
|
defer s.Stop()
|
||||||
|
|
||||||
agent := c.Agent()
|
agent := c.Agent()
|
||||||
|
@ -1109,9 +1101,6 @@ func TestAPI_AgentConnectCALeaf(t *testing.T) {
|
||||||
require.True(leaf.ValidBefore.After(time.Now()))
|
require.True(leaf.ValidBefore.After(time.Now()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(banks): once we have CA stuff setup properly we can probably make this
|
|
||||||
// much more complete. This is just a sanity check that the agent code basically
|
|
||||||
// works.
|
|
||||||
func TestAPI_AgentConnectAuthorize(t *testing.T) {
|
func TestAPI_AgentConnectAuthorize(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
|
@ -1151,6 +1140,7 @@ func TestAPI_AgentConnectProxyConfig(t *testing.T) {
|
||||||
Port: 8000,
|
Port: 8000,
|
||||||
Connect: &AgentServiceConnect{
|
Connect: &AgentServiceConnect{
|
||||||
Proxy: &AgentServiceConnectProxy{
|
Proxy: &AgentServiceConnectProxy{
|
||||||
|
Command: []string{"consul connect proxy"},
|
||||||
Config: map[string]interface{}{
|
Config: map[string]interface{}{
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
},
|
},
|
||||||
|
@ -1167,7 +1157,7 @@ func TestAPI_AgentConnectProxyConfig(t *testing.T) {
|
||||||
ProxyServiceID: "foo-proxy",
|
ProxyServiceID: "foo-proxy",
|
||||||
TargetServiceID: "foo",
|
TargetServiceID: "foo",
|
||||||
TargetServiceName: "foo",
|
TargetServiceName: "foo",
|
||||||
ContentHash: "e662ea8600d84cf0",
|
ContentHash: "93baee1d838888ae",
|
||||||
ExecMode: "daemon",
|
ExecMode: "daemon",
|
||||||
Command: []string{"consul connect proxy"},
|
Command: []string{"consul connect proxy"},
|
||||||
Config: map[string]interface{}{
|
Config: map[string]interface{}{
|
||||||
|
@ -1178,5 +1168,5 @@ func TestAPI_AgentConnectProxyConfig(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
require.Equal(t, expectConfig, config)
|
require.Equal(t, expectConfig, config)
|
||||||
require.Equal(t, "e662ea8600d84cf0", qm.LastContentHash)
|
require.Equal(t, expectConfig.ContentHash, qm.LastContentHash)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue