From b9b785cff4b9888d738108767d42859da89e8c61 Mon Sep 17 00:00:00 2001 From: Marcelo Henrique Neppel Date: Thu, 28 May 2026 16:36:26 -0300 Subject: [PATCH] fix(tests): correct the location of the Harness cleanup test_get_extensions called cleanup() on the Harness before using it, so begin() and the assertion ran against an already-cleaned harness. This only worked because of a Harness bug that leaves a dangling sqlite3 reference; the fix for that bug (canonical/operator#2507) makes cleanup() tear down properly and breaks the test. Call cleanup() once the harness is finished with instead. Signed-off-by: Marcelo Henrique Neppel --- tests/unit/test_db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_db.py b/tests/unit/test_db.py index 65a9e01a4be..c474ca1bf70 100644 --- a/tests/unit/test_db.py +++ b/tests/unit/test_db.py @@ -175,12 +175,12 @@ def test_get_extensions(harness): default: false type: boolean""" harness = Harness(PostgresqlOperatorCharm, config=config) - harness.cleanup() harness.begin() assert harness.charm.legacy_db_relation._get_extensions(relation) == ( [extensions[1], extensions[2]], {extensions[2]}, ) + harness.cleanup() def test_set_up_relation(harness):