Skip to content

Commit

Permalink
Merge pull request #113 from xmidt-org/hotfix/delint
Browse files Browse the repository at this point in the history
goconst
  • Loading branch information
johnabass authored Jul 28, 2021
2 parents c947073 + 4d109a0 commit 6128522
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions basculehttp/metricListener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ import (
"github.com/xmidt-org/touchstone/touchtest"
)

const testServerName = "testserver"

func TestNewMetricListener(t *testing.T) {
m := &AuthValidationMeasures{}
s := "testserver"
tests := []struct {
description string
measures *AuthValidationMeasures
Expand All @@ -42,11 +43,11 @@ func TestNewMetricListener(t *testing.T) {
description: "Success",
measures: m,
options: []Option{
WithServer(s),
WithServer(testServerName),
WithServer(""),
},
expectedMetricListener: &MetricListener{
server: s,
server: testServerName,
measures: m,
},
},
Expand Down Expand Up @@ -81,7 +82,6 @@ func TestNewMetricListener(t *testing.T) {
}

func TestOnAuthenticated(t *testing.T) {
server := "testserver"
tests := []struct {
description string
token bascule.Token
Expand Down Expand Up @@ -113,7 +113,7 @@ func TestOnAuthenticated(t *testing.T) {
)
expectedRegistry.Register(expectedCounter)
expectedCounter.With(prometheus.Labels{
ServerLabel: server,
ServerLabel: testServerName,
OutcomeLabel: tc.expectedOutcome,
}).Inc()
actualRegistry := prometheus.NewPedanticRegistry()
Expand All @@ -129,7 +129,7 @@ func TestOnAuthenticated(t *testing.T) {
actualRegistry.MustRegister(mockMeasures.ValidationOutcome)

m := &MetricListener{
server: server,
server: testServerName,
measures: &mockMeasures,
}
m.OnAuthenticated(bascule.Authentication{Token: tc.token})
Expand All @@ -139,7 +139,6 @@ func TestOnAuthenticated(t *testing.T) {
}
}
func TestOnErrorResponse(t *testing.T) {
server := "testserver"
tests := []struct {
description string
reason ErrorResponseReason
Expand Down Expand Up @@ -181,7 +180,7 @@ func TestOnErrorResponse(t *testing.T) {
)
expectedRegistry.Register(expectedCounter)
expectedCounter.With(prometheus.Labels{
ServerLabel: server,
ServerLabel: testServerName,
OutcomeLabel: tc.reason.String(),
}).Inc()
actualRegistry := prometheus.NewPedanticRegistry()
Expand All @@ -197,7 +196,7 @@ func TestOnErrorResponse(t *testing.T) {
actualRegistry.MustRegister(mockMeasures.ValidationOutcome)

m := &MetricListener{
server: server,
server: testServerName,
measures: &mockMeasures,
}
m.OnErrorResponse(tc.reason, errors.New("testing error"))
Expand Down

0 comments on commit 6128522

Please sign in to comment.