Skip to content
Snippets Groups Projects
Commit 2b27e82b authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added transaction back to repository db tests.

parent c1be7695
No related branches found
No related tags found
1 merge request!34Merged latest changes torwards 4.2.
Pipeline #44806 passed
......@@ -222,6 +222,9 @@ def create_postgres_infra(monkeysession=None, **kwargs):
connection, _ = infrastructure.sqlalchemy_repository_db(**db_args)
assert connection is not None
# we use a transaction around the session to rollback anything that happens within
# test execution
trans = connection.begin()
db = Session(bind=connection, autocommit=True)
old_connection, old_db = None, None
......@@ -238,6 +241,7 @@ def create_postgres_infra(monkeysession=None, **kwargs):
monkeysession.setattr('nomad.infrastructure.repository_db', old_db)
monkeysession.setattr('nomad.config.repository_db', old_config)
trans.rollback()
db.expunge_all()
db.invalidate()
db.close_all()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment