Commit 16b8ce85 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Improved repo db tests.

parent 1d933eb1
Pipeline #44768 canceled with stages
......@@ -222,9 +222,6 @@ 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
......@@ -241,7 +238,6 @@ 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()
......
......@@ -111,14 +111,14 @@ def test_add_upload(processed: processing.Upload):
assert_coe_upload(processed.upload_id, upload_with_metadata)
# def test_rollback_upload(processed: processing.Upload, postgres):
# assert Upload.from_upload_id(processed.upload_id) is None
# upload_with_metadata = processed.to_upload_with_metadata()
# assert Upload.publish(upload_with_metadata)(False) == -1
# assert Upload.from_upload_id(processed.upload_id) is None
def test_rollback_upload(processed: processing.Upload, postgres):
assert Upload.from_upload_id(processed.upload_id) is None
upload_with_metadata = processed.to_upload_with_metadata()
assert Upload.publish(upload_with_metadata)(False) == -1
assert Upload.from_upload_id(processed.upload_id) is None
# Upload.publish(upload_with_metadata)(True)
# assert_coe_upload(processed.upload_id, upload_with_metadata)
Upload.publish(upload_with_metadata)(True)
assert_coe_upload(processed.upload_id, upload_with_metadata)
# def test_large_upload(processed: processing.Upload, example_user_metadata):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment