Skip to content

Commit

Permalink
fix: test results flow success event (#513)
Browse files Browse the repository at this point in the history
Signed-off-by: joseph-sentry <[email protected]>
  • Loading branch information
joseph-sentry authored Jun 21, 2024
1 parent 099e190 commit bafde3e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion helpers/checkpoint_logger/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class UploadFlow(BaseFlow):


@failure_events("TEST_RESULTS_ERROR")
@success_events("TEST_RESULTS_BEGIN")
@success_events("TEST_RESULTS_NOTIFY")
@subflows(
("test_results_notification_latency", "TEST_RESULTS_BEGIN", "TEST_RESULTS_NOTIFY"),
("flake_notification_latency", "TEST_RESULTS_BEGIN", "FLAKE_DETECTION_NOTIFY"),
Expand Down
2 changes: 1 addition & 1 deletion services/notification/notifiers/mixins/message/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ async def write_section_to_msg(
for line in await section_writer.write_section(
comparison, diff, changes, links, behind_by=behind_by
):
wrote_something |= line != None
wrote_something |= line is not None
write(line)
if wrote_something:
write("")
Expand Down
4 changes: 2 additions & 2 deletions services/notification/notifiers/mixins/message/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ def has_project_status(yaml: UserYaml) -> bool:
project_status_details = read_yaml_field(
yaml, ("coverage", "status", "project"), False
)
if type(project_status_details) == bool:
if isinstance(project_status_details, bool):
return project_status_details
# If it's not a bool, it has to be a dict
if type(project_status_details) == dict:
if isinstance(project_status_details, dict):
if "enabled" in project_status_details:
return project_status_details["enabled"]
return True
Expand Down
18 changes: 9 additions & 9 deletions tasks/tests/unit/test_upload_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from database.tests.factories import CommitFactory, OwnerFactory, RepositoryFactory
from database.tests.factories.core import ReportFactory
from helpers.checkpoint_logger import CheckpointLogger, _kwargs_key
from helpers.checkpoint_logger.flows import UploadFlow
from helpers.checkpoint_logger.flows import TestResultsFlow, UploadFlow
from helpers.exceptions import RepositoryWithoutValidBotError
from services.archive import ArchiveService
from services.report import NotReadyToBuildReportYetError, ReportService
Expand Down Expand Up @@ -329,16 +329,16 @@ def test_upload_task_call_test_results(
report_code=None,
),
)

notify_sig = test_results_finisher_task.signature(
kwargs=dict(
repoid=commit.repoid,
commitid=commit.commitid,
commit_yaml={"codecov": {"max_report_age": "1y ago"}},
checkpoints_TestResultsFlow=None,
)
kwargs = dict(
repoid=commit.repoid,
commitid=commit.commitid,
commit_yaml={"codecov": {"max_report_age": "1y ago"}},
checkpoints_TestResultsFlow=None,
)

kwargs[_kwargs_key(TestResultsFlow)] = mocker.ANY
notify_sig = test_results_finisher_task.signature(kwargs=kwargs)

chord.assert_called_with([processor_sig], notify_sig)

def test_upload_task_call_no_jobs(
Expand Down
2 changes: 2 additions & 0 deletions tasks/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ def run_impl_within_lock(
log.warning(
"CheckpointLogger failed to log/submit", extra=dict(error=e)
)
elif report_type == ReportType.TEST_RESULTS:
checkpoints = checkpoints_from_kwargs(TestResultsFlow, kwargs)

commit = None
commits = db_session.query(Commit).filter(
Expand Down

0 comments on commit bafde3e

Please sign in to comment.