Skip to content

Commit b4cae47

Browse files
rootBr1an67
authored andcommitted
fix(es): add delay in TestPasswordFromFile to prevent flakiness
The ES client has background health check goroutines that may continue running briefly after Close() is called. When the password changes and a new client is created, the old client is closed but its health check may still make requests with the old password. This adds a small delay after the client changes to allow the old client's background goroutines to fully shut down before the test proceeds to verify the new password. Fixes #4743 Signed-off-by: root <root@C20251020184286.local>
1 parent ae8709f commit b4cae47

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/storage/v1/elasticsearch/factory_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,12 @@ func runPasswordFromFileTest(t *testing.T) {
428428
"expecting es.Client to change for the new password",
429429
)
430430

431+
// Give the old client time to fully shut down its background goroutines
432+
// (e.g., health checks) after being closed in onClientPasswordChange.
433+
// This prevents flakiness where the old client might still make requests
434+
// with the old password after the client has been swapped.
435+
time.Sleep(100 * time.Millisecond)
436+
431437
span2 := &dbmodel.Span{
432438
Process: dbmodel.Process{ServiceName: "foo"},
433439
}

0 commit comments

Comments
 (0)