Skip to content

Commit d0eab0f

Browse files
fix(tests): correct the location of the Harness cleanup (#1719)
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 <marcelo.neppel@canonical.com>
1 parent bca13f9 commit d0eab0f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tests/unit/test_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ def test_get_extensions(harness):
175175
default: false
176176
type: boolean"""
177177
harness = Harness(PostgresqlOperatorCharm, config=config)
178-
harness.cleanup()
179178
harness.begin()
180179
assert harness.charm.legacy_db_relation._get_extensions(relation) == (
181180
[extensions[1], extensions[2]],
182181
{extensions[2]},
183182
)
183+
harness.cleanup()
184184

185185

186186
def test_set_up_relation(harness):

0 commit comments

Comments
 (0)