diff --git a/server/events/plan_command_runner_test.go b/server/events/plan_command_runner_test.go index 6dd488a26..bc8768cd2 100644 --- a/server/events/plan_command_runner_test.go +++ b/server/events/plan_command_runner_test.go @@ -59,9 +59,9 @@ func TestPlanCommandRunner_IsSilenced(t *testing.T) { ExpVCSStatusTotal: 1, }, { - Description: "When planning with silenced VCS status, still clear pending status", + Description: "When planning with silenced VCS status, don't set any status", VCSStatusSilence: true, - ExpVCSStatusSet: true, // Changed: we now update status to clear pending + ExpVCSStatusSet: false, // Silence means no status updates at all ExpSilenced: true, }, { @@ -839,7 +839,7 @@ func TestPlanCommandRunner_SilenceFlagsClearsPendingStatus(t *testing.T) { // ATLANTIS_SILENCE_VCS_STATUS_NO_PROJECTS are true, we still update the status // to clear any pending state that was set earlier (e.g., in command_runner.go) - t.Run("silence flags with no projects should clear pending status", func(t *testing.T) { + t.Run("silence flags with no projects should not set any status", func(t *testing.T) { RegisterMockTestingT(t) _ = setup(t, func(tc *TestConfig) { @@ -866,27 +866,27 @@ func TestPlanCommandRunner_SilenceFlagsClearsPendingStatus(t *testing.T) { // This is the key test: when both conditions are true: // 1. Silence flags are enabled // 2. No projects are found - // We should STILL update the status to clear any pending state + // We should NOT set any VCS status at all // The plan runner is now configured with silence flags - // When it finds no projects, it should clear the pending status - // even though silence is enabled + // When it finds no projects, it should not set any VCS status + // because silence means no status checks at all // Run through the plan command (which will internally check for projects) cmd := &events.CommentCommand{Name: command.Plan} planCommandRunner.Run(ctx, cmd) - // CRITICAL VERIFICATION: With the fix, even with silence flags enabled, - // we should update the status to Success with 0/0 to clear pending state - // This prevents PRs from being stuck in pending state (issue #5389) - commitUpdater.VerifyWasCalled(AtLeast(1)).UpdateCombinedCount( + // CRITICAL VERIFICATION: With silence flags enabled, no status should be set at all + // This prevents any VCS status checks from being created (issue #5389) + // The silence flags mean "don't create any status checks" + commitUpdater.VerifyWasCalled(Never()).UpdateCombinedCount( Any[logging.SimpleLogging](), Any[models.Repo](), Any[models.PullRequest](), - Eq[models.CommitStatus](models.SuccessCommitStatus), - Eq[command.Name](command.Plan), - Eq(0), - Eq(0), + Any[models.CommitStatus](), + Any[command.Name](), + Any[int](), + Any[int](), ) }) }