Remove config argument from event handlers

For the purpose of migrating to Celery to run event handler inside a
worker, Config object is not serializable. And from the usage of config
argument, every event handler can just access module_build_service.conf
directly. This removal would make the migration easier.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
This commit is contained in:
Chenxiong Qi
2019-10-29 16:19:50 +08:00
committed by mprahl
parent 9c76f27d78
commit e1581ac831
12 changed files with 92 additions and 125 deletions

View File

@@ -72,7 +72,7 @@ class TestModuleInit:
db_session.commit()
msg = MBSModule(msg_id=None, module_build_id=2, module_build_state="init")
self.fn(config=conf, msg=msg)
self.fn(msg=msg)
build = ModuleBuild.get_by_id(db_session, 2)
# Make sure the module entered the wait state
@@ -113,7 +113,7 @@ class TestModuleInit:
)
msg = MBSModule(msg_id=None, module_build_id=2, module_build_state="init")
self.fn(config=conf, msg=msg)
self.fn(msg=msg)
build = ModuleBuild.get_by_id(db_session, 2)
# Make sure the module entered the failed state
@@ -139,7 +139,7 @@ class TestModuleInit:
ModuleBuild.create(
db_session, conf, "includemodule", "1", 3, mmd_to_str(mmd), scmurl, "mprahl")
msg = MBSModule(msg_id=None, module_build_id=3, module_build_state="init")
self.fn(config=conf, msg=msg)
self.fn(msg=msg)
build = ModuleBuild.get_by_id(db_session, 3)
assert build.state == 1
assert build.name == "includemodule"
@@ -177,7 +177,7 @@ class TestModuleInit:
build = ModuleBuild.get_by_id(db_session, 2)
mocked_from_module_event.return_value = build
self.fn(config=conf, msg=msg)
self.fn(msg=msg)
# Query the database again to make sure the build object is updated
db_session.refresh(build)