2024-12-30 17:22:02 +00:00
|
|
|
package alert_manager
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/pioz/faker"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestClient_SendAlerts(t *testing.T) {
|
2024-12-31 09:05:36 +00:00
|
|
|
client := NewClient(AlertManagerCfg{AlertManagerHttpURL: "http://localhost:9093"})
|
2024-12-30 17:22:02 +00:00
|
|
|
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")
|
|
|
|
}
|
|
|
|
}
|