@@ -318,8 +318,54 @@ func TestGithubReleaseSource_GetMatchedRelease(t *testing.T) {
318
318
})
319
319
}
320
320
321
- func TestGetGithubReleaseWithTag (t * testing.T ) {
322
- t .Run ("when get release with tag api request fails" , func (t * testing.T ) {
321
+ func TestGithubReleaseSource_GetGithubReleaseWithTag (t * testing.T ) {
322
+ t .Run ("when RepositoryOwnerAndNameFromPath fails" , func (t * testing.T ) {
323
+ damnIt := NewWithT (t )
324
+
325
+ ctx := context .TODO ()
326
+
327
+ grsMock := & component.GithubReleaseSource {
328
+ Logger : log .New (GinkgoWriter , "[test] " , log .Default ().Flags ()),
329
+ ReleaseSourceConfig : cargo.ReleaseSourceConfig {
330
+ Type : component .ReleaseSourceTypeGithub ,
331
+ Org : "cloudfoundry" ,
332
+ GithubToken : "fake-token" ,
333
+ },
334
+ }
335
+ s := cargo.BOSHReleaseTarballSpecification {
336
+ Name : "routing" ,
337
+ Version : "0.226.0" ,
338
+ GitHubRepository : "invalid-uri" ,
339
+ }
340
+
341
+ _ , err := grsMock .GetGithubReleaseWithTag (ctx , s )
342
+ damnIt .Expect (err ).To (MatchError (component .ErrNotFound ))
343
+ })
344
+
345
+ t .Run ("when the GitHubRepository owner does not match the configured Org" , func (t * testing.T ) {
346
+ damnIt := NewWithT (t )
347
+
348
+ ctx := context .TODO ()
349
+
350
+ grsMock := & component.GithubReleaseSource {
351
+ Logger : log .New (GinkgoWriter , "[test] " , log .Default ().Flags ()),
352
+ ReleaseSourceConfig : cargo.ReleaseSourceConfig {
353
+ Type : component .ReleaseSourceTypeGithub ,
354
+ Org : "cloudnotfoundry" ,
355
+ GithubToken : "fake-token" ,
356
+ },
357
+ }
358
+ s := cargo.BOSHReleaseTarballSpecification {
359
+ Name : "routing" ,
360
+ Version : "0.226.0" ,
361
+ GitHubRepository : "https://github.com/cloudfoundry/routing-release" ,
362
+ }
363
+
364
+ _ , err := grsMock .GetGithubReleaseWithTag (ctx , s )
365
+ damnIt .Expect (err ).To (MatchError (component .ErrNotFound ))
366
+ })
367
+
368
+ t .Run ("when GetReleaseByTag fails" , func (t * testing.T ) {
323
369
damnIt := NewWithT (t )
324
370
325
371
releaseGetter := new (fakes.ReleaseByTagGetter )
0 commit comments