@@ -253,6 +253,7 @@ func setup(t *testing.T, options ...func(testConfig *TestConfig)) *vcsmocks.Mock
253
253
PreWorkflowHooksCommandRunner : preWorkflowHooksCommandRunner ,
254
254
PostWorkflowHooksCommandRunner : postWorkflowHooksCommandRunner ,
255
255
PullStatusFetcher : testConfig .backend ,
256
+ CommitStatusUpdater : commitUpdater ,
256
257
}
257
258
258
259
return vcsClient
@@ -440,15 +441,8 @@ func TestRunCommentCommandApply_NoProjects_SilenceEnabled(t *testing.T) {
440
441
ch .RunCommentCommand (testdata .GithubRepo , nil , nil , testdata .User , testdata .Pull .Num , & events.CommentCommand {Name : command .Apply })
441
442
vcsClient .VerifyWasCalled (Never ()).CreateComment (
442
443
Any [logging.SimpleLogging ](), Any [models.Repo ](), Any [int ](), Any [string ](), Any [string ]())
443
- commitUpdater .VerifyWasCalledOnce ().UpdateCombinedCount (
444
- Any [logging.SimpleLogging ](),
445
- Any [models.Repo ](),
446
- Any [models.PullRequest ](),
447
- Eq [models.CommitStatus ](models .SuccessCommitStatus ),
448
- Eq [command.Name ](command .Apply ),
449
- Eq (0 ),
450
- Eq (0 ),
451
- )
444
+ commitUpdater .VerifyWasCalledOnce ().UpdateCombined (
445
+ Any [logging.SimpleLogging ](), Any [models.Repo ](), Any [models.PullRequest ](), Eq (models .PendingCommitStatus ), Eq (command .Apply ))
452
446
}
453
447
454
448
func TestRunCommentCommandApprovePolicy_NoProjects_SilenceEnabled (t * testing.T ) {
@@ -463,15 +457,6 @@ func TestRunCommentCommandApprovePolicy_NoProjects_SilenceEnabled(t *testing.T)
463
457
ch .RunCommentCommand (testdata .GithubRepo , nil , nil , testdata .User , testdata .Pull .Num , & events.CommentCommand {Name : command .ApprovePolicies })
464
458
vcsClient .VerifyWasCalled (Never ()).CreateComment (
465
459
Any [logging.SimpleLogging ](), Any [models.Repo ](), Any [int ](), Any [string ](), Any [string ]())
466
- commitUpdater .VerifyWasCalledOnce ().UpdateCombinedCount (
467
- Any [logging.SimpleLogging ](),
468
- Any [models.Repo ](),
469
- Any [models.PullRequest ](),
470
- Eq [models.CommitStatus ](models .SuccessCommitStatus ),
471
- Eq [command.Name ](command .PolicyCheck ),
472
- Eq (0 ),
473
- Eq (0 ),
474
- )
475
460
}
476
461
477
462
func TestRunCommentCommandUnlock_NoProjects_SilenceEnabled (t * testing.T ) {
@@ -485,6 +470,8 @@ func TestRunCommentCommandUnlock_NoProjects_SilenceEnabled(t *testing.T) {
485
470
486
471
ch .RunCommentCommand (testdata .GithubRepo , nil , nil , testdata .User , testdata .Pull .Num , & events.CommentCommand {Name : command .Unlock })
487
472
vcsClient .VerifyWasCalled (Never ()).CreateComment (Any [logging.SimpleLogging ](), Any [models.Repo ](), Any [int ](), Any [string ](), Any [string ]())
473
+ commitUpdater .VerifyWasCalled (Never ()).UpdateCombined (
474
+ Any [logging.SimpleLogging ](), Any [models.Repo ](), Any [models.PullRequest ](), Eq (models .PendingCommitStatus ), Any [command.Name ]())
488
475
}
489
476
490
477
func TestRunCommentCommandImport_NoProjects_SilenceEnabled (t * testing.T ) {
@@ -535,7 +522,7 @@ func TestRunCommentCommand_DisableAutoplan(t *testing.T) {
535
522
CommandName : command .Plan ,
536
523
},
537
524
}, nil )
538
-
525
+ When ( commitUpdater . UpdateCombinedCount ( Any [logging. SimpleLogging ](), Any [models. Repo ](), Any [models. PullRequest ](), Any [models. CommitStatus ](), Any [command. Name ](), Any [ int ](), Any [ int ]())). ThenReturn ( nil )
539
526
ch .RunAutoplanCommand (testdata .GithubRepo , testdata .GithubRepo , modelPull , testdata .User )
540
527
projectCommandBuilder .VerifyWasCalled (Never ()).BuildAutoplanCommands (Any [* command.Context ]())
541
528
}
@@ -831,6 +818,10 @@ func TestRunAutoplanCommand_FailedPreWorkflowHook_FailOnPreWorkflowHookError_Fal
831
818
ch .RunAutoplanCommand (testdata .GithubRepo , testdata .GithubRepo , testdata .Pull , testdata .User )
832
819
pendingPlanFinder .VerifyWasCalledOnce ().DeletePlans (tmp )
833
820
lockingLocker .VerifyWasCalledOnce ().UnlockByPull (testdata .Pull .BaseRepo .FullName , testdata .Pull .Num )
821
+ commitUpdater .VerifyWasCalledOnce ().UpdateCombined (Any [logging.SimpleLogging ](), Any [models.Repo ](), Any [models.PullRequest ](),
822
+ Eq (models .PendingCommitStatus ), Eq (command .Plan ))
823
+ commitUpdater .VerifyWasCalled (Never ()).UpdateCombined (Any [logging.SimpleLogging ](), Any [models.Repo ](), Any [models.PullRequest ](),
824
+ Eq (models .FailedCommitStatus ), Any [command.Name ]())
834
825
}
835
826
836
827
func TestRunAutoplanCommand_FailedPreWorkflowHook_FailOnPreWorkflowHookError_True (t * testing.T ) {
@@ -853,6 +844,8 @@ func TestRunAutoplanCommand_FailedPreWorkflowHook_FailOnPreWorkflowHookError_Tru
853
844
ch .RunAutoplanCommand (testdata .GithubRepo , testdata .GithubRepo , testdata .Pull , testdata .User )
854
845
pendingPlanFinder .VerifyWasCalled (Never ()).DeletePlans (Any [string ]())
855
846
lockingLocker .VerifyWasCalled (Never ()).UnlockByPull (Any [string ](), Any [int ]())
847
+ commitUpdater .VerifyWasCalledOnce ().UpdateCombined (Any [logging.SimpleLogging ](), Any [models.Repo ](), Any [models.PullRequest ](),
848
+ Eq (models .PendingCommitStatus ), Eq (command .Plan ))
856
849
}
857
850
858
851
func TestRunCommentCommand_FailedPreWorkflowHook_FailOnPreWorkflowHookError_False (t * testing.T ) {
0 commit comments