mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Fix data races and improve testing (#81994)
* Alerting: fix race condition in (*ngalert/sender.ExternalAlertmanager).Run * Chore: Fix data races when accessing members of *ngalert/state.FakeInstanceStore * Chore: Fix data races in tests in ngalert/schedule and enable some parallel tests * Chore: fix linters * Chore: add TODO comment to remove loopvar once we move to Go 1.22
This commit is contained in:
committed by
GitHub
parent
06b5875c3c
commit
9c29e1a783
@@ -42,7 +42,7 @@ func TestAsyncStatePersister_Async(t *testing.T) {
|
||||
|
||||
// Check if the state was saved
|
||||
require.Eventually(t, func() bool {
|
||||
return len(store.RecordedOps) == 1
|
||||
return len(store.RecordedOps()) == 1
|
||||
}, time.Second*5, time.Second)
|
||||
})
|
||||
t.Run("It should save on context done", func(t *testing.T) {
|
||||
@@ -71,7 +71,7 @@ func TestAsyncStatePersister_Async(t *testing.T) {
|
||||
|
||||
// Check if the context cancellation was handled correctly
|
||||
require.Eventually(t, func() bool {
|
||||
return len(store.RecordedOps) == 1
|
||||
return len(store.RecordedOps()) == 1
|
||||
}, time.Second*5, time.Second)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user