Skip to content

fix: resolve test hang caused by PostgreSQL lock conflict in test_cell.py#695

Open
aabhinavvvvvvv wants to merge 5 commits intojlab-sensing:mainfrom
aabhinavvvvvvv:fix/issue-527-test-hang
Open

fix: resolve test hang caused by PostgreSQL lock conflict in test_cell.py#695
aabhinavvvvvvv wants to merge 5 commits intojlab-sensing:mainfrom
aabhinavvvvvvv:fix/issue-527-test-hang

Conversation

@aabhinavvvvvvv
Copy link
Copy Markdown
Contributor

Root Cause

test_cell.py had two tests using different fixtures (setup_cells and init_database) in the same module. After test_cell_search_by_name ran a SELECT via Cell.search_by_name(), SQLAlchemy left an open implicit transaction holding a PostgreSQL AccessShareLock on the cell table. When init_database then called db.drop_all(), it needed AccessExclusiveLock — which PostgreSQL waited for indefinitely → hang.

@aabhinavvvvvvv aabhinavvvvvvv changed the title fix: resolve test hang caused by PostgreSQL lock conflict in test_cel… fix: resolve test hang caused by PostgreSQL lock conflict in test_cell.py Mar 10, 2026
Copy link
Copy Markdown
Contributor

@jmadden173 jmadden173 left a comment

Choose a reason for hiding this comment

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

lgtm. Checked that the tests ran fully locally. Please fix the upstream conflict and I will merge in.

@jmadden173
Copy link
Copy Markdown
Contributor

Actually looks like I was able to fix the conflict. Can you run black on the code to fix the linting?

@jmadden173 jmadden173 added the awaiting-changes For PRs requiring additional changes. label Mar 21, 2026
@aabhinavvvvvvv aabhinavvvvvvv force-pushed the fix/issue-527-test-hang branch from 8dbf3f8 to 453bcc3 Compare March 23, 2026 13:21
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
backend 70.62% <100.00%> (-0.04%) ⬇️
frontend 52.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
backend/tests/conftest.py 82.89% <ø> (-1.99%) ⬇️
backend/tests/test_cell.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aabhinavvvvvvv
Copy link
Copy Markdown
Contributor Author

@jmadden173 This PR is ready for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-changes For PRs requiring additional changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants