Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][FIX] queue_job test #576

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion queue_job/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "Job Queue",
"version": "15.0.2.3.0",
"version": "15.0.2.3.1",
"author": "Camptocamp,ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/queue",
"license": "LGPL-3",
Expand Down
8 changes: 7 additions & 1 deletion queue_job/jobrunner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
or ``False`` if unset.
- ``ODOO_QUEUE_JOB_JOBRUNNER_DB_PASSWORD=passdb``, default ``db_password``
or ``False`` if unset.
- ``ODOO_QUEUE_JOB_JOBRUNNER_DB_NAME=firstdb,seconddb``, default ``db_name``

* Alternatively, configure the channels through the Odoo configuration
file, like:
Expand All @@ -54,6 +55,7 @@
http_auth_password = s3cr3t
jobrunner_db_host = master-db
jobrunner_db_port = 5432
jobrunner_db_name = firstdb,seconddb
jobrunner_db_user = userdb
jobrunner_db_password = passdb

Expand Down Expand Up @@ -398,7 +400,11 @@
return runner

def get_db_names(self):
if config["db_name"]:
if os.environ.get("ODOO_QUEUE_JOB_JOBRUNNER_DB_NAME"):
db_names = os.environ["ODOO_QUEUE_JOB_JOBRUNNER_DB_NAME"].split(",")

Check warning on line 404 in queue_job/jobrunner/runner.py

View check run for this annotation

Codecov / codecov/patch

queue_job/jobrunner/runner.py#L404

Added line #L404 was not covered by tests
elif queue_job_config.get("jobrunner_db_name"):
db_names = queue_job_config["jobrunner_db_name"].split(",")

Check warning on line 406 in queue_job/jobrunner/runner.py

View check run for this annotation

Codecov / codecov/patch

queue_job/jobrunner/runner.py#L406

Added line #L406 was not covered by tests
elif config["db_name"]:
db_names = config["db_name"].split(",")
else:
db_names = odoo.service.db.exp_list(True)
Expand Down
13 changes: 13 additions & 0 deletions queue_job/tests/test_db_names.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import os
from odoo.tests.common import TransactionCase
from odoo.tools import config

class TestGetDbNames(TransactionCase):

def test_get_db_names(self):
os.environ["ODOO_QUEUE_JOB_JOBRUNNER_DB_NAME"] = "db1,db2"
config["db_name"] = False

db_names = self.env["queue.job"].get_db_names()
self.assertEqual(db_names, ["db1", "db2"])

Loading