notify: remove wechat unit test (#1350)

The unit test was making a request to the public Wechat endpoint which
caused flaky results.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Simon Pasquier 2018-04-30 20:01:38 +02:00 committed by stuart nelson
parent b04e9ad19b
commit b3cc6229a2
1 changed files with 0 additions and 52 deletions

View File

@ -15,7 +15,6 @@ import (
"github.com/prometheus/alertmanager/config"
"github.com/prometheus/alertmanager/template"
"github.com/prometheus/alertmanager/types"
commoncfg "github.com/prometheus/common/config"
"github.com/prometheus/common/model"
)
@ -261,54 +260,3 @@ func TestOpsGenie(t *testing.T) {
require.Equal(t, true, retry)
require.Equal(t, expectedBody, readBody(t, req))
}
func TestWechat(t *testing.T) {
logger := log.NewNopLogger()
tmpl := createTmpl(t)
conf := &config.WechatConfig{
NotifierConfig: config.NotifierConfig{
VSendResolved: true,
},
Message: `{{ template "wechat.default.message" . }}`,
APIURL: config.DefaultGlobalConfig.WeChatAPIURL,
APISecret: "invalidSecret",
CorpID: "invalidCorpID",
AgentID: "1",
ToUser: "admin",
HTTPConfig: &commoncfg.HTTPClientConfig{},
}
notifier := NewWechat(conf, tmpl, logger)
ctx := context.Background()
alert := &types.Alert{
Alert: model.Alert{
Labels: model.LabelSet{
"Message": "message",
"Description": "description",
"Source": "http://prometheus",
"Teams": "TeamA,TeamB,",
"Tags": "tag1,tag2",
"Note": "this is a note",
"Priotity": "P1",
},
StartsAt: time.Now(),
EndsAt: time.Now().Add(time.Hour),
},
}
// miss group key
retry, err := notifier.Notify(ctx, alert)
require.False(t, retry)
require.Error(t, err)
ctx = WithGroupKey(ctx, "2")
// invalid secret
retry, err = notifier.Notify(ctx, alert)
require.False(t, retry)
require.Error(t, err)
}