From 71420fd111b8c0826060a7ac3d7b62f0bc2b36a4 Mon Sep 17 00:00:00 2001 From: Joseph Sawaya Date: Tue, 11 Feb 2025 16:47:34 -0500 Subject: [PATCH 1/2] tests: fix sql_alchemy_db fixture for timescale there's a deadlock error that happens where the timescale background worker is running background jobs and we're altering the schema of the tables on which it's running the background job on, so we stop the background worker momentarily to allow the migrations to run. --- conftest.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/conftest.py b/conftest.py index 1b211455b..936dffbcf 100644 --- a/conftest.py +++ b/conftest.py @@ -122,11 +122,23 @@ def sqlalchemy_db(request: pytest.FixtureRequest, django_db_blocker, django_db_s original_test_name = settings.DATABASES["default"]["TEST"]["NAME"] settings.DATABASES["default"]["NAME"] = "sqlalchemy" settings.DATABASES["default"]["TEST"]["NAME"] = "test_postgres_sqlalchemy" + for connection in connections: + if "timeseries" in connection: + with connections[connection].cursor() as cursor: + cursor.execute( + "SELECT _timescaledb_internal.stop_background_workers();" + ) db_cfg = setup_databases( verbosity=request.config.option.verbose, interactive=False, keepdb=keepdb, ) + for connection in connections: + if "timeseries" in connection: + with connections[connection].cursor() as cursor: + cursor.execute( + "SELECT _timescaledb_internal.start_background_workers();" + ) settings.DATABASES["default"]["NAME"] = original_db_name settings.DATABASES["default"]["TEST"]["NAME"] = original_test_name From 7b54b7e21d8195503cd50ea5bc7ccfae160c79dd Mon Sep 17 00:00:00 2001 From: Joseph Sawaya Date: Tue, 11 Feb 2025 16:47:34 -0500 Subject: [PATCH 2/2] build: update shared --- pyproject.toml | 2 +- uv.lock | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1a6dfd46a..23a06ade0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -83,4 +83,4 @@ dev-dependencies = [ [tool.uv.sources] timestring = { git = "https://github.com/codecov/timestring", rev = "d37ceacc5954dff3b5bd2f887936a98a668dda42" } test-results-parser = { git = "https://github.com/codecov/test-results-parser", rev = "190bbc8a911099749928e13d5fe57f6027ca1e74" } -shared = { git = "https://github.com/codecov/shared", rev = "fd909cc93000489899b583beb14bf795202dfbd8" } +shared = { git = "https://github.com/codecov/shared", rev = "1c6200a3f1a6cdefab730b3f7d731c9a5fa036da" } diff --git a/uv.lock b/uv.lock index 733ab0419..c3b9ccc40 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,4 @@ version = 1 -revision = 1 requires-python = "==3.13.*" resolution-markers = [ "platform_python_implementation != 'PyPy'", @@ -1308,6 +1307,8 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/39/1b/d0b013bf7d1af7cf0a6a4fce13f5fe5813ab225313755367b36e714a63f8/pycryptodome-3.21.0-cp36-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:18caa8cfbc676eaaf28613637a89980ad2fd96e00c564135bf90bc3f0b34dd93", size = 2254397 }, { url = "https://files.pythonhosted.org/packages/14/71/4cbd3870d3e926c34706f705d6793159ac49d9a213e3ababcdade5864663/pycryptodome-3.21.0-cp36-abi3-win32.whl", hash = "sha256:280b67d20e33bb63171d55b1067f61fbd932e0b1ad976b3a184303a3dad22764", size = 1775641 }, { url = "https://files.pythonhosted.org/packages/43/1d/81d59d228381576b92ecede5cd7239762c14001a828bdba30d64896e9778/pycryptodome-3.21.0-cp36-abi3-win_amd64.whl", hash = "sha256:b7aa25fc0baa5b1d95b7633af4f5f1838467f1815442b22487426f94e0d66c53", size = 1812863 }, + { url = "https://files.pythonhosted.org/packages/25/b3/09ff7072e6d96c9939c24cf51d3c389d7c345bf675420355c22402f71b68/pycryptodome-3.21.0-pp27-pypy_73-manylinux2010_x86_64.whl", hash = "sha256:2cb635b67011bc147c257e61ce864879ffe6d03342dc74b6045059dfbdedafca", size = 1691593 }, + { url = "https://files.pythonhosted.org/packages/a8/91/38e43628148f68ba9b68dedbc323cf409e537fd11264031961fd7c744034/pycryptodome-3.21.0-pp27-pypy_73-win32.whl", hash = "sha256:4c26a2f0dc15f81ea3afa3b0c87b87e501f235d332b7f27e2225ecb80c0b1cdd", size = 1765997 }, ] [[package]] @@ -1701,7 +1702,7 @@ wheels = [ [[package]] name = "shared" version = "0.1.0" -source = { git = "https://github.com/codecov/shared?rev=fd909cc93000489899b583beb14bf795202dfbd8#fd909cc93000489899b583beb14bf795202dfbd8" } +source = { git = "https://github.com/codecov/shared?rev=1c6200a3f1a6cdefab730b3f7d731c9a5fa036da#1c6200a3f1a6cdefab730b3f7d731c9a5fa036da" } dependencies = [ { name = "amplitude-analytics" }, { name = "boto3" }, @@ -2040,7 +2041,7 @@ requires-dist = [ { name = "regex", specifier = ">=2023.12.25" }, { name = "requests", specifier = ">=2.32.0" }, { name = "sentry-sdk", specifier = ">=2.13.0" }, - { name = "shared", git = "https://github.com/codecov/shared?rev=fd909cc93000489899b583beb14bf795202dfbd8" }, + { name = "shared", git = "https://github.com/codecov/shared?rev=1c6200a3f1a6cdefab730b3f7d731c9a5fa036da" }, { name = "sqlalchemy", specifier = "==1.3.*" }, { name = "sqlparse", specifier = "==0.5.0" }, { name = "statsd", specifier = ">=3.3.0" },