Raise on database error in recorder.migration._add_constraint (#123646)

* Raise on database error in recorder.migration._add_constraint

* Fix test
This commit is contained in:
Erik Montnemery 2024-08-14 13:59:06 +02:00 committed by GitHub
parent b698dd8f32
commit 80f5683cd6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -962,9 +962,10 @@ def test_restore_foreign_key_constraints_with_error(
engine = Mock()
session_maker = Mock(return_value=session)
migration._restore_foreign_key_constraints(
session_maker, engine, constraints_to_restore
)
with pytest.raises(InternalError):
migration._restore_foreign_key_constraints(
session_maker, engine, constraints_to_restore
)
assert "Could not update foreign options in events table" in caplog.text