@@ -320,6 +320,55 @@ func testRemoteFetcher(t *testing.T, context spec.G, it spec.S) {
320
320
})
321
321
})
322
322
323
+ context ("when there is a v prepending the release tag" , func () {
324
+ it .Before (func () {
325
+ gitReleaseFetcher .GetCall .Returns .Release = github.Release {
326
+ TagName : "v1.2.3" ,
327
+ Assets : []github.ReleaseAsset {
328
+ {
329
+ URL : "some-url" ,
330
+ },
331
+ },
332
+ TarballURL : "some-tarball-url" ,
333
+ }
334
+
335
+ buildpackCache .GetCall .Returns .CacheEntry = freezer.CacheEntry {
336
+ Version : "some-other-tag" ,
337
+ }
338
+
339
+ Expect (os .MkdirAll (filepath .Join (cacheDir , "some-org" , "some-repo" ), os .ModePerm )).To (Succeed ())
340
+ })
341
+
342
+ it ("removes the v from the tag" , func () {
343
+ uri , err := remoteFetcher .Get (remoteBuildpack )
344
+ Expect (err ).ToNot (HaveOccurred ())
345
+
346
+ Expect (gitReleaseFetcher .GetCall .Receives .Org ).To (Equal ("some-org" ))
347
+ Expect (gitReleaseFetcher .GetCall .Receives .Repo ).To (Equal ("some-repo" ))
348
+
349
+ Expect (buildpackCache .GetCall .Receives .Key ).To (Equal ("some-org:some-repo" ))
350
+
351
+ Expect (gitReleaseFetcher .GetReleaseAssetCall .Receives .Asset ).To (Equal (github.ReleaseAsset {
352
+ URL : "some-url" ,
353
+ }))
354
+
355
+ Expect (filepath .Join (cacheDir , "some-org" , "some-repo" , "1.2.3.tgz" )).To (BeAnExistingFile ())
356
+ file , err := os .Open (filepath .Join (cacheDir , "some-org" , "some-repo" , "1.2.3.tgz" ))
357
+ Expect (err ).ToNot (HaveOccurred ())
358
+
359
+ err = vacation .NewArchive (file ).Decompress (filepath .Join (cacheDir , "some-org" , "some-repo" ))
360
+ Expect (err ).ToNot (HaveOccurred ())
361
+
362
+ content , err := os .ReadFile (filepath .Join (cacheDir , "some-org" , "some-repo" , "some-file" ))
363
+ Expect (err ).NotTo (HaveOccurred ())
364
+ Expect (string (content )).To (Equal ("some content" ))
365
+
366
+ Expect (buildpackCache .SetCall .CallCount ).To (Equal (1 ))
367
+
368
+ Expect (uri ).To (Equal (filepath .Join (cacheDir , "some-org" , "some-repo" , "1.2.3.tgz" )))
369
+ })
370
+ })
371
+
323
372
context ("failure cases" , func () {
324
373
context ("when there is a failure in the gitReleaseFetcher get" , func () {
325
374
it .Before (func () {
0 commit comments