Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit 652028d

Browse files
committed
build fix
1 parent 4fa5140 commit 652028d

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/cli/onefuzz/debug.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -645,42 +645,46 @@ def test_template(
645645
) -> responses.NotificationTestResponse:
646646
"""Test a notification template"""
647647

648+
the_report: Union[Report, RegressionReport, None] = None
649+
648650
if report is not None:
649651
try:
650-
report = RegressionReport.parse_raw(report)
652+
the_report = RegressionReport.parse_raw(report)
651653
print("testing regression report")
652654
except Exception:
653-
report = Report.parse_raw(report)
655+
the_report = Report.parse_raw(report)
654656
print("testing normal report")
655657

656658
if task_id is not None:
657659
task = self.onefuzz.tasks.get(task_id)
658-
if report is None:
660+
if the_report is None:
659661
input_blob_ref = BlobRef(
660662
account="dummy-storage-account",
661663
container="test-notification-crashes",
662664
name="fake-crash-sample",
663665
)
664-
report = self._create_report(
666+
the_report = self._create_report(
665667
task.job_id, task.task_id, "fake_target.exe", input_blob_ref
666668
)
667-
elif isinstance(report, RegressionReport):
668-
report.crash_test_result.crash_report.task_id = task.task_id
669-
report.crash_test_result.crash_report.job_id = task.job_id
669+
elif isinstance(the_report, RegressionReport):
670+
if the_report.crash_test_result.crash_report is None:
671+
raise Exception("invalid regression report: no crash report")
672+
the_report.crash_test_result.crash_report.task_id = task.task_id
673+
the_report.crash_test_result.crash_report.job_id = task.job_id
670674
else:
671-
report.task_id = task.task_id
672-
report.job_id = task.job_id
673-
elif report is None:
675+
the_report.task_id = task.task_id
676+
the_report.job_id = task.job_id
677+
elif the_report is None:
674678
raise Exception("must specify either task_id or report")
675679

676-
report.report_url = "https://dummy-container.blob.core.windows.net/dummy-reports/dummy-report.json"
680+
the_report.report_url = "https://dummy-container.blob.core.windows.net/dummy-reports/dummy-report.json"
677681

678682
endpoint = Endpoint(self.onefuzz)
679683
return endpoint._req_model(
680684
"POST",
681685
responses.NotificationTestResponse,
682686
data=requests.NotificationTest(
683-
report=report,
687+
report=the_report,
684688
notification=models.Notification(
685689
container=Container("test-notification-reports"),
686690
notification_id=uuid.uuid4(),

0 commit comments

Comments
 (0)