@@ -44,6 +44,7 @@ const githubHeader = "X-Github-Event"
44
44
const gitlabHeader = "X-Gitlab-Event"
45
45
const azuredevopsHeader = "Request-Id"
46
46
47
+ var user = []byte ("user" )
47
48
var secret = []byte ("secret" )
48
49
49
50
func AnyRepo () models.Repo {
@@ -53,7 +54,7 @@ func AnyRepo() models.Repo {
53
54
54
55
func TestPost_NotGithubOrGitlab (t * testing.T ) {
55
56
t .Log ("when the request is not for gitlab or github a 400 is returned" )
56
- e , _ , _ , _ , _ , _ , _ , _ := setup (t )
57
+ e , _ , _ , _ , _ , _ , _ , _ , _ := setup (t )
57
58
w := httptest .NewRecorder ()
58
59
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
59
60
e .Post (w , req )
@@ -62,7 +63,7 @@ func TestPost_NotGithubOrGitlab(t *testing.T) {
62
63
63
64
func TestPost_UnsupportedVCSGithub (t * testing.T ) {
64
65
t .Log ("when the request is for an unsupported vcs a 400 is returned" )
65
- e , _ , _ , _ , _ , _ , _ , _ := setup (t )
66
+ e , _ , _ , _ , _ , _ , _ , _ , _ := setup (t )
66
67
e .SupportedVCSHosts = nil
67
68
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
68
69
req .Header .Set (githubHeader , "value" )
@@ -73,7 +74,7 @@ func TestPost_UnsupportedVCSGithub(t *testing.T) {
73
74
74
75
func TestPost_UnsupportedVCSGitlab (t * testing.T ) {
75
76
t .Log ("when the request is for an unsupported vcs a 400 is returned" )
76
- e , _ , _ , _ , _ , _ , _ , _ := setup (t )
77
+ e , _ , _ , _ , _ , _ , _ , _ , _ := setup (t )
77
78
e .SupportedVCSHosts = nil
78
79
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
79
80
req .Header .Set (gitlabHeader , "value" )
@@ -84,7 +85,7 @@ func TestPost_UnsupportedVCSGitlab(t *testing.T) {
84
85
85
86
func TestPost_InvalidGithubSecret (t * testing.T ) {
86
87
t .Log ("when the github payload can't be validated a 400 is returned" )
87
- e , v , _ , _ , _ , _ , _ , _ := setup (t )
88
+ e , v , _ , _ , _ , _ , _ , _ , _ := setup (t )
88
89
w := httptest .NewRecorder ()
89
90
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
90
91
req .Header .Set (githubHeader , "value" )
@@ -95,7 +96,7 @@ func TestPost_InvalidGithubSecret(t *testing.T) {
95
96
96
97
func TestPost_InvalidGitlabSecret (t * testing.T ) {
97
98
t .Log ("when the gitlab payload can't be validated a 400 is returned" )
98
- e , _ , gl , _ , _ , _ , _ , _ := setup (t )
99
+ e , _ , gl , _ , _ , _ , _ , _ , _ := setup (t )
99
100
w := httptest .NewRecorder ()
100
101
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
101
102
req .Header .Set (gitlabHeader , "value" )
@@ -106,7 +107,7 @@ func TestPost_InvalidGitlabSecret(t *testing.T) {
106
107
107
108
func TestPost_UnsupportedGithubEvent (t * testing.T ) {
108
109
t .Log ("when the event type is an unsupported github event we ignore it" )
109
- e , v , _ , _ , _ , _ , _ , _ := setup (t )
110
+ e , v , _ , _ , _ , _ , _ , _ , _ := setup (t )
110
111
w := httptest .NewRecorder ()
111
112
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
112
113
req .Header .Set (githubHeader , "value" )
@@ -117,7 +118,7 @@ func TestPost_UnsupportedGithubEvent(t *testing.T) {
117
118
118
119
func TestPost_UnsupportedGitlabEvent (t * testing.T ) {
119
120
t .Log ("when the event type is an unsupported gitlab event we ignore it" )
120
- e , _ , gl , _ , _ , _ , _ , _ := setup (t )
121
+ e , _ , gl , _ , _ , _ , _ , _ , _ := setup (t )
121
122
w := httptest .NewRecorder ()
122
123
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
123
124
req .Header .Set (gitlabHeader , "value" )
@@ -129,7 +130,7 @@ func TestPost_UnsupportedGitlabEvent(t *testing.T) {
129
130
// Test that if the comment comes from a commit rather than a merge request,
130
131
// we give an error and ignore it.
131
132
func TestPost_GitlabCommentOnCommit (t * testing.T ) {
132
- e , _ , gl , _ , _ , _ , _ , _ := setup (t )
133
+ e , _ , gl , _ , _ , _ , _ , _ , _ := setup (t )
133
134
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
134
135
w := httptest .NewRecorder ()
135
136
req .Header .Set (gitlabHeader , "value" )
@@ -140,7 +141,7 @@ func TestPost_GitlabCommentOnCommit(t *testing.T) {
140
141
141
142
func TestPost_GithubCommentNotCreated (t * testing.T ) {
142
143
t .Log ("when the event is a github comment but it's not a created event we ignore it" )
143
- e , v , _ , _ , _ , _ , _ , _ := setup (t )
144
+ e , v , _ , _ , _ , _ , _ , _ , _ := setup (t )
144
145
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
145
146
req .Header .Set (githubHeader , "issue_comment" )
146
147
// comment action is deleted, not created
@@ -153,7 +154,7 @@ func TestPost_GithubCommentNotCreated(t *testing.T) {
153
154
154
155
func TestPost_GithubInvalidComment (t * testing.T ) {
155
156
t .Log ("when the event is a github comment without all expected data we return a 400" )
156
- e , v , _ , p , _ , _ , _ , _ := setup (t )
157
+ e , v , _ , _ , p , _ , _ , _ , _ := setup (t )
157
158
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
158
159
req .Header .Set (githubHeader , "issue_comment" )
159
160
event := `{"action": "created"}`
@@ -166,7 +167,7 @@ func TestPost_GithubInvalidComment(t *testing.T) {
166
167
167
168
func TestPost_GitlabCommentInvalidCommand (t * testing.T ) {
168
169
t .Log ("when the event is a gitlab comment with an invalid command we ignore it" )
169
- e , _ , gl , _ , _ , _ , _ , cp := setup (t )
170
+ e , _ , gl , _ , _ , _ , _ , _ , cp := setup (t )
170
171
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
171
172
req .Header .Set (gitlabHeader , "value" )
172
173
When (gl .ParseAndValidate (req , secret )).ThenReturn (gitlab.MergeCommentEvent {}, nil )
@@ -178,7 +179,7 @@ func TestPost_GitlabCommentInvalidCommand(t *testing.T) {
178
179
179
180
func TestPost_GithubCommentInvalidCommand (t * testing.T ) {
180
181
t .Log ("when the event is a github comment with an invalid command we ignore it" )
181
- e , v , _ , p , _ , _ , _ , cp := setup (t )
182
+ e , v , _ , _ , p , _ , _ , _ , cp := setup (t )
182
183
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
183
184
req .Header .Set (githubHeader , "issue_comment" )
184
185
event := `{"action": "created"}`
@@ -319,7 +320,7 @@ func TestPost_GithubCommentNotAllowlistedWithSilenceErrors(t *testing.T) {
319
320
320
321
func TestPost_GitlabCommentResponse (t * testing.T ) {
321
322
// When the event is a gitlab comment that warrants a comment response we comment back.
322
- e , _ , gl , _ , _ , _ , vcsClient , cp := setup (t )
323
+ e , _ , gl , _ , _ , _ , _ , vcsClient , cp := setup (t )
323
324
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
324
325
req .Header .Set (gitlabHeader , "value" )
325
326
When (gl .ParseAndValidate (req , secret )).ThenReturn (gitlab.MergeCommentEvent {}, nil )
@@ -332,7 +333,7 @@ func TestPost_GitlabCommentResponse(t *testing.T) {
332
333
333
334
func TestPost_GithubCommentResponse (t * testing.T ) {
334
335
t .Log ("when the event is a github comment that warrants a comment response we comment back" )
335
- e , v , _ , p , _ , _ , vcsClient , cp := setup (t )
336
+ e , v , _ , _ , p , _ , _ , vcsClient , cp := setup (t )
336
337
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
337
338
req .Header .Set (githubHeader , "issue_comment" )
338
339
event := `{"action": "created"}`
@@ -350,7 +351,7 @@ func TestPost_GithubCommentResponse(t *testing.T) {
350
351
351
352
func TestPost_GitlabCommentSuccess (t * testing.T ) {
352
353
t .Log ("when the event is a gitlab comment with a valid command we call the command handler" )
353
- e , _ , gl , _ , cr , _ , _ , _ := setup (t )
354
+ e , _ , gl , _ , _ , cr , _ , _ , _ := setup (t )
354
355
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
355
356
req .Header .Set (gitlabHeader , "value" )
356
357
When (gl .ParseAndValidate (req , secret )).ThenReturn (gitlab.MergeCommentEvent {}, nil )
@@ -363,7 +364,7 @@ func TestPost_GitlabCommentSuccess(t *testing.T) {
363
364
364
365
func TestPost_GithubCommentSuccess (t * testing.T ) {
365
366
t .Log ("when the event is a github comment with a valid command we call the command handler" )
366
- e , v , _ , p , cr , _ , _ , cp := setup (t )
367
+ e , v , _ , _ , p , cr , _ , _ , cp := setup (t )
367
368
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
368
369
req .Header .Set (githubHeader , "issue_comment" )
369
370
event := `{"action": "created"}`
@@ -382,7 +383,7 @@ func TestPost_GithubCommentSuccess(t *testing.T) {
382
383
383
384
func TestPost_GithubPullRequestInvalid (t * testing.T ) {
384
385
t .Log ("when the event is a github pull request with invalid data we return a 400" )
385
- e , v , _ , p , _ , _ , _ , _ := setup (t )
386
+ e , v , _ , _ , p , _ , _ , _ , _ := setup (t )
386
387
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
387
388
req .Header .Set (githubHeader , "pull_request" )
388
389
@@ -396,7 +397,7 @@ func TestPost_GithubPullRequestInvalid(t *testing.T) {
396
397
397
398
func TestPost_GitlabMergeRequestInvalid (t * testing.T ) {
398
399
t .Log ("when the event is a gitlab merge request with invalid data we return a 400" )
399
- e , _ , gl , p , _ , _ , _ , _ := setup (t )
400
+ e , _ , gl , _ , p , _ , _ , _ , _ := setup (t )
400
401
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
401
402
req .Header .Set (gitlabHeader , "value" )
402
403
When (gl .ParseAndValidate (req , secret )).ThenReturn (gitlab.MergeEvent {}, nil )
@@ -410,7 +411,7 @@ func TestPost_GitlabMergeRequestInvalid(t *testing.T) {
410
411
411
412
func TestPost_GithubPullRequestNotAllowlisted (t * testing.T ) {
412
413
t .Log ("when the event is a github pull request to a non-allowlisted repo we return a 400" )
413
- e , v , _ , _ , _ , _ , _ , _ := setup (t )
414
+ e , v , _ , _ , _ , _ , _ , _ , _ := setup (t )
414
415
var err error
415
416
e .RepoAllowlistChecker , err = events .NewRepoAllowlistChecker ("github.com/nevermatch" )
416
417
Ok (t , err )
@@ -426,7 +427,7 @@ func TestPost_GithubPullRequestNotAllowlisted(t *testing.T) {
426
427
427
428
func TestPost_GitlabMergeRequestNotAllowlisted (t * testing.T ) {
428
429
t .Log ("when the event is a gitlab merge request to a non-allowlisted repo we return a 400" )
429
- e , _ , gl , p , _ , _ , _ , _ := setup (t )
430
+ e , _ , gl , _ , p , _ , _ , _ , _ := setup (t )
430
431
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
431
432
req .Header .Set (gitlabHeader , "value" )
432
433
@@ -445,7 +446,7 @@ func TestPost_GitlabMergeRequestNotAllowlisted(t *testing.T) {
445
446
446
447
func TestPost_GithubPullRequestUnsupportedAction (t * testing.T ) {
447
448
t .Skip ("relies too much on mocks, should use real event parser" )
448
- e , v , _ , _ , _ , _ , _ , _ := setup (t )
449
+ e , v , _ , _ , _ , _ , _ , _ , _ := setup (t )
449
450
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
450
451
req .Header .Set (githubHeader , "pull_request" )
451
452
@@ -460,7 +461,7 @@ func TestPost_GithubPullRequestUnsupportedAction(t *testing.T) {
460
461
func TestPost_GitlabMergeRequestUnsupportedAction (t * testing.T ) {
461
462
t .Skip ("relies too much on mocks, should use real event parser" )
462
463
t .Log ("when the event is a gitlab merge request to a non-allowlisted repo we return a 400" )
463
- e , _ , gl , p , _ , _ , _ , _ := setup (t )
464
+ e , _ , gl , _ , p , _ , _ , _ , _ := setup (t )
464
465
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
465
466
req .Header .Set (gitlabHeader , "value" )
466
467
var event gitlab.MergeEvent
@@ -476,37 +477,8 @@ func TestPost_GitlabMergeRequestUnsupportedAction(t *testing.T) {
476
477
}
477
478
478
479
func TestPost_AzureDevopsPullRequestIgnoreEvent (t * testing.T ) {
479
- u := "user"
480
- user := []byte (u )
481
-
482
480
t .Log ("when the event is an azure devops pull request update that should not trigger workflow we ignore it" )
483
- RegisterMockTestingT (t )
484
- v := mocks .NewMockAzureDevopsRequestValidator ()
485
- p := emocks .NewMockEventParsing ()
486
- cp := emocks .NewMockCommentParsing ()
487
- cr := emocks .NewMockCommandRunner ()
488
- c := emocks .NewMockPullCleaner ()
489
- vcsmock := vcsmocks .NewMockClient ()
490
- repoAllowlistChecker , err := events .NewRepoAllowlistChecker ("*" )
491
- Ok (t , err )
492
- logger := logging .NewNoopLogger (t )
493
- scope , _ , _ := metrics .NewLoggingScope (logger , "null" )
494
- e := events_controllers.VCSEventsController {
495
- TestingMode : true ,
496
- Logger : logger ,
497
- Scope : scope ,
498
- ApplyDisabled : false ,
499
- AzureDevopsWebhookBasicUser : user ,
500
- AzureDevopsWebhookBasicPassword : secret ,
501
- AzureDevopsRequestValidator : v ,
502
- Parser : p ,
503
- CommentParser : cp ,
504
- CommandRunner : cr ,
505
- PullCleaner : c ,
506
- SupportedVCSHosts : []models.VCSHostType {models .AzureDevops },
507
- RepoAllowlistChecker : repoAllowlistChecker ,
508
- VCSClient : vcsmock ,
509
- }
481
+ e , _ , _ , ado , _ , _ , _ , _ , _ := setup (t )
510
482
511
483
event := `{
512
484
"subscriptionId": "11111111-1111-1111-1111-111111111111",
@@ -547,7 +519,7 @@ func TestPost_AzureDevopsPullRequestIgnoreEvent(t *testing.T) {
547
519
payload := fmt .Sprintf (event , c .message )
548
520
req , _ := http .NewRequest ("GET" , "" , strings .NewReader (payload ))
549
521
req .Header .Set (azuredevopsHeader , "reqID" )
550
- When (v .Validate (req , user , secret )).ThenReturn ([]byte (payload ), nil )
522
+ When (ado .Validate (req , user , secret )).ThenReturn ([]byte (payload ), nil )
551
523
w := httptest .NewRecorder ()
552
524
e .Parser = & events.EventParser {}
553
525
e .Post (w , req )
@@ -557,37 +529,8 @@ func TestPost_AzureDevopsPullRequestIgnoreEvent(t *testing.T) {
557
529
}
558
530
559
531
func TestPost_AzureDevopsPullRequestDeletedCommentIgnoreEvent (t * testing.T ) {
560
- u := "user"
561
- user := []byte (u )
562
-
563
532
t .Log ("when the event is an azure devops pull request deleted comment event we ignore it" )
564
- RegisterMockTestingT (t )
565
- v := mocks .NewMockAzureDevopsRequestValidator ()
566
- p := emocks .NewMockEventParsing ()
567
- cp := emocks .NewMockCommentParsing ()
568
- cr := emocks .NewMockCommandRunner ()
569
- c := emocks .NewMockPullCleaner ()
570
- vcsmock := vcsmocks .NewMockClient ()
571
- repoAllowlistChecker , err := events .NewRepoAllowlistChecker ("*" )
572
- Ok (t , err )
573
- logger := logging .NewNoopLogger (t )
574
- scope , _ , _ := metrics .NewLoggingScope (logger , "null" )
575
- e := events_controllers.VCSEventsController {
576
- TestingMode : true ,
577
- Logger : logger ,
578
- Scope : scope ,
579
- ApplyDisabled : false ,
580
- AzureDevopsWebhookBasicUser : user ,
581
- AzureDevopsWebhookBasicPassword : secret ,
582
- AzureDevopsRequestValidator : v ,
583
- Parser : p ,
584
- CommentParser : cp ,
585
- CommandRunner : cr ,
586
- PullCleaner : c ,
587
- SupportedVCSHosts : []models.VCSHostType {models .AzureDevops },
588
- RepoAllowlistChecker : repoAllowlistChecker ,
589
- VCSClient : vcsmock ,
590
- }
533
+ e , _ , _ , ado , _ , _ , _ , _ , _ := setup (t )
591
534
592
535
payload := `{
593
536
"subscriptionId": "11111111-1111-1111-1111-111111111111",
@@ -610,7 +553,7 @@ func TestPost_AzureDevopsPullRequestDeletedCommentIgnoreEvent(t *testing.T) {
610
553
t .Run ("Dev has deleted a pull request comment" , func (t * testing.T ) {
611
554
req , _ := http .NewRequest ("GET" , "" , strings .NewReader (payload ))
612
555
req .Header .Set (azuredevopsHeader , "reqID" )
613
- When (v .Validate (req , user , secret )).ThenReturn ([]byte (payload ), nil )
556
+ When (ado .Validate (req , user , secret )).ThenReturn ([]byte (payload ), nil )
614
557
w := httptest .NewRecorder ()
615
558
e .Parser = & events.EventParser {}
616
559
e .Post (w , req )
@@ -622,7 +565,7 @@ func TestPost_GithubPullRequestClosedErrCleaningPull(t *testing.T) {
622
565
t .Skip ("relies too much on mocks, should use real event parser" )
623
566
t .Log ("when the event is a closed pull request and we have an error calling CleanUpPull we return a 503" )
624
567
RegisterMockTestingT (t )
625
- e , v , _ , p , _ , c , _ , _ := setup (t )
568
+ e , v , _ , _ , p , _ , c , _ , _ := setup (t )
626
569
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
627
570
req .Header .Set (githubHeader , "pull_request" )
628
571
@@ -640,7 +583,7 @@ func TestPost_GithubPullRequestClosedErrCleaningPull(t *testing.T) {
640
583
func TestPost_GitlabMergeRequestClosedErrCleaningPull (t * testing.T ) {
641
584
t .Skip ("relies too much on mocks, should use real event parser" )
642
585
t .Log ("when the event is a closed gitlab merge request and an error occurs calling CleanUpPull we return a 500" )
643
- e , _ , gl , p , _ , c , _ , _ := setup (t )
586
+ e , _ , gl , _ , p , _ , c , _ , _ := setup (t )
644
587
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
645
588
req .Header .Set (gitlabHeader , "value" )
646
589
var event gitlab.MergeEvent
@@ -658,7 +601,7 @@ func TestPost_GitlabMergeRequestClosedErrCleaningPull(t *testing.T) {
658
601
func TestPost_GithubClosedPullRequestSuccess (t * testing.T ) {
659
602
t .Skip ("relies too much on mocks, should use real event parser" )
660
603
t .Log ("when the event is a pull request and everything works we return a 200" )
661
- e , v , _ , p , _ , c , _ , _ := setup (t )
604
+ e , v , _ , _ , p , _ , c , _ , _ := setup (t )
662
605
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
663
606
req .Header .Set (githubHeader , "pull_request" )
664
607
@@ -676,7 +619,7 @@ func TestPost_GithubClosedPullRequestSuccess(t *testing.T) {
676
619
func TestPost_GitlabMergeRequestSuccess (t * testing.T ) {
677
620
t .Skip ("relies too much on mocks, should use real event parser" )
678
621
t .Log ("when the event is a gitlab merge request and the cleanup works we return a 200" )
679
- e , _ , gl , p , _ , _ , _ , _ := setup (t )
622
+ e , _ , gl , _ , p , _ , _ , _ , _ := setup (t )
680
623
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
681
624
req .Header .Set (gitlabHeader , "value" )
682
625
When (gl .ParseAndValidate (req , secret )).ThenReturn (gitlab.MergeEvent {}, nil )
@@ -799,7 +742,7 @@ func TestPost_PullOpenedOrUpdated(t *testing.T) {
799
742
800
743
for _ , c := range cases {
801
744
t .Run (c .Description , func (t * testing.T ) {
802
- e , v , gl , p , cr , _ , _ , _ := setup (t )
745
+ e , v , gl , _ , p , cr , _ , _ , _ := setup (t )
803
746
req , _ := http .NewRequest ("GET" , "" , bytes .NewBuffer (nil ))
804
747
var pullRequest models.PullRequest
805
748
var repo models.Repo
@@ -830,10 +773,11 @@ func TestPost_PullOpenedOrUpdated(t *testing.T) {
830
773
}
831
774
}
832
775
833
- func setup (t * testing.T ) (events_controllers.VCSEventsController , * mocks.MockGithubRequestValidator , * mocks.MockGitlabRequestParserValidator , * emocks.MockEventParsing , * emocks.MockCommandRunner , * emocks.MockPullCleaner , * vcsmocks.MockClient , * emocks.MockCommentParsing ) {
776
+ func setup (t * testing.T ) (events_controllers.VCSEventsController , * mocks.MockGithubRequestValidator , * mocks.MockGitlabRequestParserValidator , * mocks. MockAzureDevopsRequestValidator , * emocks.MockEventParsing , * emocks.MockCommandRunner , * emocks.MockPullCleaner , * vcsmocks.MockClient , * emocks.MockCommentParsing ) {
834
777
RegisterMockTestingT (t )
835
778
v := mocks .NewMockGithubRequestValidator ()
836
779
gl := mocks .NewMockGitlabRequestParserValidator ()
780
+ ado := mocks .NewMockAzureDevopsRequestValidator ()
837
781
p := emocks .NewMockEventParsing ()
838
782
cp := emocks .NewMockCommentParsing ()
839
783
cr := emocks .NewMockCommandRunner ()
@@ -844,20 +788,24 @@ func setup(t *testing.T) (events_controllers.VCSEventsController, *mocks.MockGit
844
788
logger := logging .NewNoopLogger (t )
845
789
scope , _ , _ := metrics .NewLoggingScope (logger , "null" )
846
790
e := events_controllers.VCSEventsController {
847
- TestingMode : true ,
848
- Logger : logger ,
849
- Scope : scope ,
850
- GithubRequestValidator : v ,
851
- Parser : p ,
852
- CommentParser : cp ,
853
- CommandRunner : cr ,
854
- PullCleaner : c ,
855
- GithubWebhookSecret : secret ,
856
- SupportedVCSHosts : []models.VCSHostType {models .Github , models .Gitlab },
857
- GitlabWebhookSecret : secret ,
858
- GitlabRequestParserValidator : gl ,
859
- RepoAllowlistChecker : repoAllowlistChecker ,
860
- VCSClient : vcsmock ,
791
+ TestingMode : true ,
792
+ Logger : logger ,
793
+ Scope : scope ,
794
+ ApplyDisabled : false ,
795
+ AzureDevopsWebhookBasicUser : user ,
796
+ AzureDevopsWebhookBasicPassword : secret ,
797
+ AzureDevopsRequestValidator : ado ,
798
+ GithubRequestValidator : v ,
799
+ Parser : p ,
800
+ CommentParser : cp ,
801
+ CommandRunner : cr ,
802
+ PullCleaner : c ,
803
+ GithubWebhookSecret : secret ,
804
+ SupportedVCSHosts : []models.VCSHostType {models .Github , models .Gitlab , models .AzureDevops },
805
+ GitlabWebhookSecret : secret ,
806
+ GitlabRequestParserValidator : gl ,
807
+ RepoAllowlistChecker : repoAllowlistChecker ,
808
+ VCSClient : vcsmock ,
861
809
}
862
- return e , v , gl , p , cr , c , vcsmock , cp
810
+ return e , v , gl , ado , p , cr , c , vcsmock , cp
863
811
}
0 commit comments