mirror of https://github.com/hashicorp/consul
Makes the metrics ACL test call the right endpoint.
This also required setting up a proper in-mem sink so we don't get metrics-related errors. Fixes #3655pull/3661/head
parent
172d5c0c40
commit
aa199ab6ba
|
@ -243,14 +243,14 @@ func TestAgent_Metrics_ACLDeny(t *testing.T) {
|
|||
|
||||
t.Run("no token", func(t *testing.T) {
|
||||
req, _ := http.NewRequest("GET", "/v1/agent/metrics", nil)
|
||||
if _, err := a.srv.AgentSelf(nil, req); !acl.IsErrPermissionDenied(err) {
|
||||
if _, err := a.srv.AgentMetrics(nil, req); !acl.IsErrPermissionDenied(err) {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("agent master token", func(t *testing.T) {
|
||||
req, _ := http.NewRequest("GET", "/v1/agent/metrics?token=towel", nil)
|
||||
if _, err := a.srv.AgentSelf(nil, req); err != nil {
|
||||
if _, err := a.srv.AgentMetrics(nil, req); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
})
|
||||
|
@ -258,7 +258,7 @@ func TestAgent_Metrics_ACLDeny(t *testing.T) {
|
|||
t.Run("read-only token", func(t *testing.T) {
|
||||
ro := makeReadOnlyAgentACL(t, a.srv)
|
||||
req, _ := http.NewRequest("GET", fmt.Sprintf("/v1/agent/metrics?token=%s", ro), nil)
|
||||
if _, err := a.srv.AgentSelf(nil, req); err != nil {
|
||||
if _, err := a.srv.AgentMetrics(nil, req); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -144,7 +144,7 @@ func (a *TestAgent) Start() *TestAgent {
|
|||
agent.LogOutput = logOutput
|
||||
agent.LogWriter = a.LogWriter
|
||||
agent.logger = log.New(logOutput, a.Name+" - ", log.LstdFlags|log.Lmicroseconds)
|
||||
agent.MemSink = &metrics.InmemSink{}
|
||||
agent.MemSink = metrics.NewInmemSink(1*time.Second, time.Minute)
|
||||
|
||||
// we need the err var in the next exit condition
|
||||
if err := agent.Start(); err == nil {
|
||||
|
|
Loading…
Reference in New Issue