@@ -16,11 +16,12 @@ import (
1616func TestPullRequestGithubGenerateParams (t * testing.T ) {
1717 ctx := t .Context ()
1818 cases := []struct {
19- selectFunc func (context.Context , * argoprojiov1alpha1.PullRequestGenerator , * argoprojiov1alpha1.ApplicationSet ) (pullrequest.PullRequestService , error )
20- values map [string ]string
21- expected []map [string ]any
22- expectedErr error
23- applicationSet argoprojiov1alpha1.ApplicationSet
19+ selectFunc func (context.Context , * argoprojiov1alpha1.PullRequestGenerator , * argoprojiov1alpha1.ApplicationSet ) (pullrequest.PullRequestService , error )
20+ values map [string ]string
21+ expected []map [string ]any
22+ expectedErr error
23+ applicationSet argoprojiov1alpha1.ApplicationSet
24+ continueOnRepoNotFoundError bool
2425 }{
2526 {
2627 selectFunc : func (context.Context , * argoprojiov1alpha1.PullRequestGenerator , * argoprojiov1alpha1.ApplicationSet ) (pullrequest.PullRequestService , error ) {
@@ -171,6 +172,30 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
171172 expected : nil ,
172173 expectedErr : errors .New ("error listing repos: fake error" ),
173174 },
175+ {
176+ selectFunc : func (context.Context , * argoprojiov1alpha1.PullRequestGenerator , * argoprojiov1alpha1.ApplicationSet ) (pullrequest.PullRequestService , error ) {
177+ return pullrequest .NewFakeService (
178+ ctx ,
179+ nil ,
180+ pullrequest .NewRepositoryNotFoundError (errors .New ("repository not found" )),
181+ )
182+ },
183+ expected : []map [string ]any {},
184+ expectedErr : nil ,
185+ continueOnRepoNotFoundError : true ,
186+ },
187+ {
188+ selectFunc : func (context.Context , * argoprojiov1alpha1.PullRequestGenerator , * argoprojiov1alpha1.ApplicationSet ) (pullrequest.PullRequestService , error ) {
189+ return pullrequest .NewFakeService (
190+ ctx ,
191+ nil ,
192+ pullrequest .NewRepositoryNotFoundError (errors .New ("repository not found" )),
193+ )
194+ },
195+ expected : nil ,
196+ expectedErr : errors .New ("error listing repos: repository not found" ),
197+ continueOnRepoNotFoundError : false ,
198+ },
174199 {
175200 selectFunc : func (context.Context , * argoprojiov1alpha1.PullRequestGenerator , * argoprojiov1alpha1.ApplicationSet ) (pullrequest.PullRequestService , error ) {
176201 return pullrequest .NewFakeService (
@@ -260,7 +285,8 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
260285 }
261286 generatorConfig := argoprojiov1alpha1.ApplicationSetGenerator {
262287 PullRequest : & argoprojiov1alpha1.PullRequestGenerator {
263- Values : c .values ,
288+ Values : c .values ,
289+ ContinueOnRepoNotFoundError : c .continueOnRepoNotFoundError ,
264290 },
265291 }
266292
0 commit comments