Alerting: Speed up unit and integration tests. (#60067)

This change marks tests in the `sender` package that use an external
process as integration tests instead of unit tests. This speeds up the
package's unit tests by about 20 seconds.

This change also reduces the number of alert instances in the `store`
package's bulk write integration test from 20_000 to 10_000. This is
still enough to exercise the bulk-write code but speeds up the package
tests from about 250s to 130s.

Put together, integration tests go to about 160s while also speeding up
unit tests by 20s.
This commit is contained in:
Joe Blubaugh
2022-12-12 14:21:06 +08:00
committed by GitHub
parent 50c4430661
commit 1a8d0e2736
3 changed files with 15 additions and 9 deletions

View File

@@ -59,9 +59,9 @@ func TestIntegrationAlertInstanceBulkWrite(t *testing.T) {
_, dbstore := tests.SetupTestEnv(t, baseIntervalSeconds)
orgIDs := []int64{1, 2, 3, 4, 5}
counts := []int{20_000, 200, 503, 0, 1256}
instances := []models.AlertInstance{}
keys := []models.AlertInstanceKey{}
counts := []int{10_000, 200, 503, 0, 1256}
instances := make([]models.AlertInstance, 0, 10_000+200+503+0+1256)
keys := make([]models.AlertInstanceKey, 0, 10_000+200+503+0+1256)
for i, id := range orgIDs {
alertRule := tests.CreateTestAlertRule(t, ctx, dbstore, 60, id)