Skip to content

fix: flaky TestDrainConfigRoutine failing with "database is closed" - #7489

Merged
atzoum merged 1 commit into
masterfrom
fix.drainConfigTestRace
Oct 20, 2026
Merged

atzoum merged 1 commit into
masterfrom
fix.drainConfigTestRace

Conversation

@atzoum

@atzoum atzoum commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Description

TestDrainConfigRoutine never cancelled its context, so Stop() could close the DB while CleanupRoutine was mid-query; the routine then returned db cleanup: sql: database is closed instead of a clean exit, failing the test intermittently. The test now cancels before Stop(), as the HTTP handler test and production callers already do.

Linear Ticket

n/a

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.30.1
@atzoum
atzoum force-pushed the fix.drainConfigTestRace branch from c3cdc2c to 308882a Compare October 15, 2026 11:53
@atzoum atzoum changed the title fix: cancel drain config test context before stopping the manager fix: flaky TestDrainConfigRoutine failing with "database is closed" Oct 15, 2026
}, 1*time.Second, 100*time.Millisecond, "should read from drain config table")
require.Nil(t, conf.GetStringSliceVar(nil, "drain.jobRunIDs"), "should've cleaned up")

cancel()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use defer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should cancel before Stop

@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.04%. Comparing base (bba1c21) to head (308882a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7489      +/-   ##
==========================================
+ Coverage   84.59%   85.04%   +0.45%     
==========================================
  Files         632      632              
  Lines       62838    62838              
==========================================
+ Hits        53157    53442     +285     
+ Misses       9678     9393     -285     
  Partials        3        3              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@atzoum
atzoum enabled auto-merge (squash) October 15, 2026 15:04
@atzoum
atzoum merged commit 2ca7d06 into master Oct 20, 2026
75 checks passed
@atzoum
atzoum deleted the fix.drainConfigTestRace branch October 20, 2026 10:59
fracasula added a commit that referenced this pull request Oct 20, 2026
# Description

Syncing release v1.91.0 to main branch

**WARNING: Do NOT rewrite git history and ALWAYS use a "Merge Commit"
for merging!**

**↓↓ Please review and edit commit overrides before merging ↓↓**

BEGIN_COMMIT_OVERRIDE
fix: flaky TestDrainConfigRoutine failing with "database is closed"
(#7489)
END_COMMIT_OVERRIDE
itsmihir pushed a commit that referenced this pull request Oct 26, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.92.0-rc.1](v1.91.0...v1.92.0-rc.1)
(2026-10-26)


### Features

* **processor:** pyt test-pod deployer sets PYT_MODE=test
([#7506](#7506))
([a050ed6](a050ed6))
* **processor:** reset the per-workspace pyt client on 421
([#7494](#7494))
([83db4d6](83db4d6))
* **router:** re-fetch the cached OAuth token when the control plane
holds a newer secret (PRO-5947)
([#7478](#7478))
([742779d](742779d))
* **router:** tag oauth_action counters with destinationId and count
AUTH_STATUS_INACTIVE (PRO-5946)
([#7477](#7477))
([0e15eb4](0e15eb4))


### Bug Fixes

* flaky TestDrainConfigRoutine failing with "database is closed"
([#7489](#7489))
([9baa89f](9baa89f))


### Miscellaneous

* block new ginkgo/gomega usage in tests
([#7502](#7502))
([e1c9d38](e1c9d38))
* bump dependency versions
([#7522](#7522))
([1067ff4](1067ff4))
* enforce errors.AsType and point CLAUDE.md at AGENTS.md
([#7521](#7521))
([5c7e088](5c7e088))
* go 1.27.3
([#7516](#7516))
([3c240a3](3c240a3))
* migrate debugger, services, async destination and utils tests from
ginkgo to testify
([#7503](#7503))
([1a8c85a](1a8c85a))
* migrate gateway, rsources, reporting, batchrouter and manager tests
from ginkgo to testify
([#7507](#7507))
([ffdd505](ffdd505))
* remove ginkgo and gomega from tests
([#7508](#7508))
([d3e7e0f](d3e7e0f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
itsmihir pushed a commit that referenced this pull request Oct 27, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.92.0](v1.91.0...v1.92.0)
(2026-10-26)


### Features

* **processor:** pyt test-pod deployer sets PYT_MODE=test
([#7506](#7506))
([a050ed6](a050ed6))
* **processor:** reset the per-workspace pyt client on 421
([#7494](#7494))
([83db4d6](83db4d6))
* **router:** re-fetch the cached OAuth token when the control plane
holds a newer secret (PRO-5947)
([#7478](#7478))
([742779d](742779d))
* **router:** tag oauth_action counters with destinationId and count
AUTH_STATUS_INACTIVE (PRO-5946)
([#7477](#7477))
([0e15eb4](0e15eb4))


### Bug Fixes

* flaky TestDrainConfigRoutine failing with "database is closed"
([#7489](#7489))
([9baa89f](9baa89f))


### Miscellaneous

* block new ginkgo/gomega usage in tests
([#7502](#7502))
([e1c9d38](e1c9d38))
* bump dependency versions
([#7522](#7522))
([1067ff4](1067ff4))
* enforce errors.AsType and point CLAUDE.md at AGENTS.md
([#7521](#7521))
([5c7e088](5c7e088))
* go 1.27.3
([#7516](#7516))
([3c240a3](3c240a3))
* migrate debugger, services, async destination and utils tests from
ginkgo to testify
([#7503](#7503))
([1a8c85a](1a8c85a))
* migrate gateway, rsources, reporting, batchrouter and manager tests
from ginkgo to testify
([#7507](#7507))
([ffdd505](ffdd505))
* remove ginkgo and gomega from tests
([#7508](#7508))
([d3e7e0f](d3e7e0f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants