Skip to content

Commit

Permalink
fix: WORKER-P8R (#702)
Browse files Browse the repository at this point in the history
  • Loading branch information
giovanni-guidini authored Sep 11, 2024
1 parent eab4eb5 commit 7ebdf9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions services/bundle_analysis/notify/contexts/commit_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ def load_cache_ttl(self) -> Self:

@sentry_sdk.trace
def evaluate_should_use_upgrade_message(self) -> Self:
if self._notification_context.pull is None:
self._notification_context.should_use_upgrade_comment = False
return self
activate_seat_info = determine_seat_activation(self._notification_context.pull)
match activate_seat_info.should_activate_seat:
case ShouldActivateSeat.AUTO_ACTIVATE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,16 @@ def test_initialize_from_context(self, dbsession, mocker):
assert context.pull == other_context.pull
assert other_context.bundle_analysis_comparison == fake_comparison

def test_evaluate_should_use_upgrade_message_no_pull(self, dbsession, mocker):
head_commit, _ = get_commit_pair(dbsession)
user_yaml = UserYaml.from_dict({})
builder = CommitStatusNotificationContextBuilder().initialize(
head_commit, user_yaml, GITHUB_APP_INSTALLATION_DEFAULT_NAME
)
builder._notification_context.pull = None
builder.evaluate_should_use_upgrade_message()
assert builder._notification_context.should_use_upgrade_comment is False

@pytest.mark.parametrize(
"activation_result, auto_activate_succeeds, expected",
[
Expand Down

0 comments on commit 7ebdf9f

Please sign in to comment.