Skip to content

Commit

Permalink
[FIX] runbot: fix test logs
Browse files Browse the repository at this point in the history
The first issue is just an hardcoded db_name

The second issue is a patched commit that will prevent netsvc from
commiting to the log database when testing runbot.
  • Loading branch information
Xavier-Do committed Mar 1, 2023
1 parent b9e4bbc commit ca06677
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion runbot/models/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,8 +1042,9 @@ def _cmd(self, python_params=None, py_version=None, local_only=True, sub_command
elif grep(config_path, "--xmlrpc-interface"):
command.add_config_tuple("xmlrpc_interface", "127.0.0.1")

log_db = self.env['ir.config_parameter'].get_param('runbot.logdb_name')
if grep(config_path, "log-db"):
command.add_config_tuple("log_db", "runbot_logs")
command.add_config_tuple("log_db", log_db)
if grep(config_path, 'log-db-level'):
command.add_config_tuple("log_db_level", '25')

Expand Down
6 changes: 5 additions & 1 deletion runbot/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ def setUp(self):
self.start_patcher('docker_stop', 'odoo.addons.runbot.container._docker_stop')
self.start_patcher('docker_get_gateway_ip', 'odoo.addons.runbot.models.build_config.docker_get_gateway_ip', None)

self.start_patcher('cr_commit', 'odoo.sql_db.Cursor.commit', None)
self.start_patcher('repo_commit', 'odoo.addons.runbot.models.runbot.Runbot._commit', None)
self.start_patcher('_local_cleanup_patcher', 'odoo.addons.runbot.models.build.BuildResult._local_cleanup')
self.start_patcher('_local_pg_dropdb_patcher', 'odoo.addons.runbot.models.build.BuildResult._local_pg_dropdb')
Expand All @@ -194,6 +193,11 @@ def setUp(self):

self.start_patcher('_get_py_version', 'odoo.addons.runbot.models.build.BuildResult._get_py_version', 3)

def no_commit(*_args, **_kwargs):
_logger.info('Skipping commit')

self.patch(self.env.cr, 'commit', no_commit)


def start_patcher(self, patcher_name, patcher_path, return_value=DEFAULT, side_effect=DEFAULT, new=DEFAULT):

Expand Down

0 comments on commit ca06677

Please sign in to comment.