Skip to content

Commit

Permalink
chore: fix AMQPWorkerConfig.broker_url
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemDoum committed Jul 8, 2024
1 parent 16133c5 commit 05c6a3b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions icij-worker/icij_worker/tests/worker/test_amqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,3 +417,12 @@ async def test_publish_result(
received_result = TaskResult.parse_raw(message.body)
break
assert received_result == result


async def test_amqp_config_uri():
# Given
config = AMQPWorkerConfig()
# When
url = config.broker_url
# Then
assert url == "amqp://127.0.0.1:5672/%2F"
4 changes: 2 additions & 2 deletions icij-worker/icij_worker/worker/amqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def broker_url(self) -> str:
if amqp_userinfo:
amqp_userinfo += "@"
amqp_authority = (
f"{amqp_userinfo}{self.rabbitmq_host}"
f"{f':{self.rabbitmq_port}' if self.rabbitmq_port else ''}"
f"{amqp_userinfo or ''}{self.rabbitmq_host}"
f"{f':{self.rabbitmq_port}' or ''}"
)
amqp_uri = f"amqp://{amqp_authority}"
if self.rabbitmq_vhost is not None:
Expand Down
2 changes: 1 addition & 1 deletion icij-worker/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "icij-worker"
version = "0.3.0"
version = "0.3.1"
description = "Create asynchronous tasks from Python functions"
authors = [
"Clément Doumouro <cdoumouro@icij.org>",
Expand Down

0 comments on commit 05c6a3b

Please sign in to comment.