@@ -385,19 +385,6 @@ func TestBackend_StaticRole_Rotation_Schedule_ErrorRecover(t *testing.T) {
385
385
// should match because rotations should not occur outside the rotation window
386
386
t .Fatalf ("expected passwords to match, got (%s)" , checkPassword )
387
387
}
388
- if len (eventSender .Events ) == 0 {
389
- t .Fatal ("Expected to have some events but got none" )
390
- }
391
- // check that we got a rotate-fail event
392
- found := false
393
- for _ , event := range eventSender .Events {
394
- if string (event .Type ) == "database/rotate-fail" {
395
- found = true
396
- break
397
- }
398
- }
399
- assert .True (t , found )
400
-
401
388
// Verify new username/password
402
389
verifyPgConn (t , username , checkPassword , connURL )
403
390
@@ -425,7 +412,20 @@ func TestBackend_StaticRole_Rotation_Schedule_ErrorRecover(t *testing.T) {
425
412
// Verify new username/password
426
413
verifyPgConn (t , username , checkPassword , connURL )
427
414
415
+ eventSender .Stop () // avoid race detector
428
416
// check that we got a successful rotation event
417
+ if len (eventSender .Events ) == 0 {
418
+ t .Fatal ("Expected to have some events but got none" )
419
+ }
420
+ // check that we got a rotate-fail event
421
+ found := false
422
+ for _ , event := range eventSender .Events {
423
+ if string (event .Type ) == "database/rotate-fail" {
424
+ found = true
425
+ break
426
+ }
427
+ }
428
+ assert .True (t , found )
429
429
found = false
430
430
for _ , event := range eventSender .Events {
431
431
if string (event .Type ) == "database/rotate" {
0 commit comments