Skip to content
Merged
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
10 changes: 8 additions & 2 deletions libmozevent/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{:.2f}% of all tasks ({}/{})

"""
TASK_MD = "* [{0}](https://tools.taskcluster.net/task-inspector/#{0})"
TASK_MD = "* [{task_id}]({base_url}/tasks/{task_id})"
TASKCLUSTER_NAMESPACE = "project.releng.services.tasks.{task_id}"


Expand Down Expand Up @@ -43,6 +43,7 @@ def __init__(
self.notify = taskcluster_config.get_service("notify")
self.queue = taskcluster_config.get_service("queue")
self.index = taskcluster_config.get_service("index")
self.taskcluster_base_url = taskcluster_config.default_url

def register(self, bus):
self.bus = bus
Expand Down Expand Up @@ -195,7 +196,12 @@ def send_report(self):
content += GROUP_MD.format(
status, 100.0 * nb_tasks / total, nb_tasks, total
)
content += "\n".join([TASK_MD.format(task) for task in tasks])
content += "\n".join(
[
TASK_MD.format(task_id=task, base_url=self.taskcluster_base_url)
for task in tasks
]
)
contents.append(content)

if len(contents):
Expand Down
6 changes: 4 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,9 @@ def mock_taskcluster():
Mock Tasklcuster authentication
"""
tc = TaskclusterConfig("http://taskcluster.test")
tc.auth()
tc.options["maxRetries"] = 1

# Force options to avoid auto proxy detection
tc.auth("client", "token")
tc.default_url = "http://taskcluster.test"
tc.options["maxRetries"] = 1
return tc
12 changes: 6 additions & 6 deletions tests/test_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ async def test_monitoring(QueueMock, NotifyMock, mock_taskcluster):

66.67% of all tasks (2/3)

* [Task1-completed](https://tools.taskcluster.net/task-inspector/#Task1-completed)
* [Task2-completed](https://tools.taskcluster.net/task-inspector/#Task2-completed)
* [Task1-completed](http://taskcluster.test/tasks/Task1-completed)
* [Task2-completed](http://taskcluster.test/tasks/Task2-completed)

## exception

Expand All @@ -89,7 +89,7 @@ async def test_monitoring(QueueMock, NotifyMock, mock_taskcluster):

33.33% of all tasks (1/3)

* [Task-failed](https://tools.taskcluster.net/task-inspector/#Task-failed)
* [Task-failed](http://taskcluster.test/tasks/Task-failed)

# Hook2 tasks for the last period

Expand All @@ -104,7 +104,7 @@ async def test_monitoring(QueueMock, NotifyMock, mock_taskcluster):

100.00% of all tasks (1/1)

* [Task-exception](https://tools.taskcluster.net/task-inspector/#Task-exception)
* [Task-exception](http://taskcluster.test/tasks/Task-exception)

## failed

Expand Down Expand Up @@ -184,7 +184,7 @@ async def test_monitoring_whiteline_between_failed_and_hook(

100.00% of all tasks (1/1)

* [Task-failed](https://tools.taskcluster.net/task-inspector/#Task-failed)
* [Task-failed](http://taskcluster.test/tasks/Task-failed)

# Hook2 tasks for the last period

Expand All @@ -205,7 +205,7 @@ async def test_monitoring_whiteline_between_failed_and_hook(

100.00% of all tasks (1/1)

* [Task-failed](https://tools.taskcluster.net/task-inspector/#Task-failed)"""
* [Task-failed](http://taskcluster.test/tasks/Task-failed)"""

monitoring.send_report()
assert NotifyMock.email_obj["address"] == "pinco@pallino"
Expand Down