common/clients/alert_manager/client_test.go

24 lines
586 B
Go
Raw Permalink Normal View History

package alert_manager
import (
"github.com/pioz/faker"
"github.com/stretchr/testify/assert"
"testing"
"time"
)
func TestClient_SendAlerts(t *testing.T) {
client := NewClient(AlertManagerCfg{AlertManagerHttpURL: "http://localhost:9093"})
for i := 0; i < 50; i++ {
err := client.SendAlerts([]Alert{
{
StartsAT: time.Now(),
Annotations: map[string]string{"Annotations": faker.String()},
Labels: map[string]string{"Labels": faker.String()},
GeneratorURL: "http://example.com",
},
})
assert.NoError(t, err, "received err from SendAlerts")
}
}