Browse Source

fix lint

pull/305/head
Richard van der Hoff 6 years ago
parent
commit
05aaf714d3
  1. 2
      src/github.com/matrix-org/go-neb/services/alertmanager/alertmanager.go
  2. 22
      src/github.com/matrix-org/go-neb/services/alertmanager/alertmanager_test.go

2
src/github.com/matrix-org/go-neb/services/alertmanager/alertmanager.go

@ -11,8 +11,8 @@ import (
"github.com/matrix-org/gomatrix"
html "html/template"
"net/http"
text "text/template"
"strings"
text "text/template"
)
// ServiceType of the Alertmanager service.

22
src/github.com/matrix-org/go-neb/services/alertmanager/alertmanager_test.go

@ -1,19 +1,19 @@
package alertmanager
import (
"bytes"
"encoding/json"
"fmt"
"github.com/matrix-org/go-neb/database"
"github.com/matrix-org/go-neb/testutils"
"github.com/matrix-org/go-neb/types"
"github.com/matrix-org/gomatrix"
"net/http"
"strings"
"fmt"
"encoding/json"
"io/ioutil"
"bytes"
"testing"
"github.com/matrix-org/go-neb/types"
"net/http"
"net/http/httptest"
"regexp"
"strings"
"testing"
)
func TestNotify(t *testing.T) {
@ -40,7 +40,7 @@ func TestNotify(t *testing.T) {
matrixCli.Client = &http.Client{Transport: matrixTrans}
// create the service
html_template, err := json.Marshal(
htmlTemplate, err := json.Marshal(
`{{range .Alerts}}
{{index .Labels "severity" }} : {{- index .Labels "alertname" -}}
<a href="{{ .GeneratorURL }}">source</a>
@ -53,7 +53,7 @@ func TestNotify(t *testing.T) {
t.Fatal(err)
}
text_template, err := json.Marshal(`{{range .Alerts}}{{index .Labels "alertname"}} {{end}}`)
textTemplate, err := json.Marshal(`{{range .Alerts}}{{index .Labels "alertname"}} {{end}}`)
if err != nil {
t.Fatal(err)
}
@ -64,7 +64,7 @@ func TestNotify(t *testing.T) {
"html_template":%s,
"msg_type":"m.text"
}}
}`, text_template, html_template,
}`, textTemplate, htmlTemplate,
)
srv, err := types.CreateService("id", "alertmanager", "@neb:hs", []byte(config))
@ -124,7 +124,7 @@ func TestNotify(t *testing.T) {
continue
}
matchedSilence += 1
matchedSilence++
m := silenceRegexp.FindStringSubmatch(line)
if m == nil {
t.Errorf("silence line %s had bad format", line)

Loading…
Cancel
Save