@@ -57,7 +57,8 @@ func testCreateBuilderOs(os string, t *testing.T, when spec.G, it spec.S) {
5757 registryClient = registryfakes .NewFakeClient ()
5858
5959 keychainFactory = & registryfakes.FakeKeychainFactory {}
60- keychain = authn .NewMultiKeychain (authn .DefaultKeychain )
60+ builderKeychain = authn .NewMultiKeychain (authn .DefaultKeychain )
61+ stackKeychain = authn .NewMultiKeychain (authn .DefaultKeychain )
6162 secretRef = registry.SecretRef {}
6263
6364 ctx = context .Background ()
@@ -190,7 +191,7 @@ func testCreateBuilderOs(os string, t *testing.T, when spec.G, it spec.S) {
190191 )
191192
192193 it .Before (func () {
193- keychainFactory .AddKeychainForSecretRef (t , secretRef , keychain )
194+ keychainFactory .AddKeychainForSecretRef (t , secretRef , builderKeychain )
194195
195196 buildpack1 := buildpackLayer {
196197 v1Layer : buildpack1Layer ,
@@ -267,7 +268,7 @@ func testCreateBuilderOs(os string, t *testing.T, when spec.G, it spec.S) {
267268 fetcher .AddBuildpack (t , "io.buildpack.2" , "v2" , []buildpackLayer {buildpack3 , buildpack2 })
268269 })
269270
270- registryClient .AddSaveKeychain ("custom/example" , keychain )
271+ registryClient .AddSaveKeychain ("custom/example" , builderKeychain )
271272
272273 when ("CreateBuilder" , func () {
273274 var (
@@ -286,7 +287,7 @@ func testCreateBuilderOs(os string, t *testing.T, when spec.G, it spec.S) {
286287 config .OS = os
287288 buildImg , err = mutate .ConfigFile (buildImg , config )
288289
289- registryClient .AddImage (buildImage , buildImg , keychain )
290+ registryClient .AddImage (buildImage , buildImg , stackKeychain )
290291
291292 lifecycleProvider .metadata = LifecycleMetadata {
292293 LifecycleInfo : LifecycleInfo {
@@ -314,7 +315,7 @@ func testCreateBuilderOs(os string, t *testing.T, when spec.G, it spec.S) {
314315 })
315316
316317 it ("creates a custom builder" , func () {
317- builderRecord , err := subject .CreateBuilder (ctx , keychain , fetcher , stack , clusterBuilderSpec )
318+ builderRecord , err := subject .CreateBuilder (ctx , builderKeychain , stackKeychain , fetcher , stack , clusterBuilderSpec )
318319 require .NoError (t , err )
319320
320321 assert .Len (t , builderRecord .Buildpacks , 3 )
@@ -576,11 +577,11 @@ func testCreateBuilderOs(os string, t *testing.T, when spec.G, it spec.S) {
576577 })
577578
578579 it ("creates images deterministically " , func () {
579- original , err := subject .CreateBuilder (ctx , keychain , fetcher , stack , clusterBuilderSpec )
580+ original , err := subject .CreateBuilder (ctx , builderKeychain , stackKeychain , fetcher , stack , clusterBuilderSpec )
580581 require .NoError (t , err )
581582
582583 for i := 1 ; i <= 50 ; i ++ {
583- other , err := subject .CreateBuilder (ctx , keychain , fetcher , stack , clusterBuilderSpec )
584+ other , err := subject .CreateBuilder (ctx , builderKeychain , stackKeychain , fetcher , stack , clusterBuilderSpec )
584585 require .NoError (t , err )
585586
586587 require .Equal (t , original .Image , other .Image )
@@ -610,7 +611,7 @@ func testCreateBuilderOs(os string, t *testing.T, when spec.G, it spec.S) {
610611 },
611612 }
612613
613- _ , err := subject .CreateBuilder (ctx , keychain , fetcher , stack , clusterBuilderSpec )
614+ _ , err := subject .CreateBuilder (ctx , builderKeychain , stackKeychain , fetcher , stack , clusterBuilderSpec )
614615 require .EqualError (t , err , "validating buildpack io.buildpack.unsupported.stack@v4: stack io.buildpacks.stacks.some-stack is not supported" )
615616 })
616617
@@ -634,7 +635,7 @@ func testCreateBuilderOs(os string, t *testing.T, when spec.G, it spec.S) {
634635 }},
635636 }}
636637
637- _ , err := subject .CreateBuilder (ctx , keychain , fetcher , stack , clusterBuilderSpec )
638+ _ , err := subject .CreateBuilder (ctx , builderKeychain , stackKeychain , fetcher , stack , clusterBuilderSpec )
638639 require .EqualError (t , err , "validating buildpack io.buildpack.unsupported.mixin@v4: stack missing mixin(s): something-missing-mixin, something-missing-mixin2" )
639640 })
640641
@@ -679,7 +680,7 @@ func testCreateBuilderOs(os string, t *testing.T, when spec.G, it spec.S) {
679680 }},
680681 }}
681682
682- _ , err := subject .CreateBuilder (ctx , keychain , fetcher , stack , clusterBuilderSpec )
683+ _ , err := subject .CreateBuilder (ctx , builderKeychain , stackKeychain , fetcher , stack , clusterBuilderSpec )
683684 require .Nil (t , err )
684685 })
685686
@@ -704,7 +705,7 @@ func testCreateBuilderOs(os string, t *testing.T, when spec.G, it spec.S) {
704705 }},
705706 }}
706707
707- _ , err := subject .CreateBuilder (ctx , keychain , fetcher , stack , clusterBuilderSpec )
708+ _ , err := subject .CreateBuilder (ctx , builderKeychain , nil , fetcher , stack , clusterBuilderSpec )
708709 require .Error (t , err , "validating buildpack io.buildpack.relaxed.old.mixin@v4: stack missing mixin(s): build:common-mixin, run:common-mixin, another-common-mixin" )
709710 })
710711
@@ -727,7 +728,7 @@ func testCreateBuilderOs(os string, t *testing.T, when spec.G, it spec.S) {
727728 }},
728729 }}
729730
730- _ , err := subject .CreateBuilder (ctx , keychain , fetcher , stack , clusterBuilderSpec )
731+ _ , err := subject .CreateBuilder (ctx , builderKeychain , stackKeychain , fetcher , stack , clusterBuilderSpec )
731732 require .EqualError (t , err , "validating buildpack io.buildpack.unsupported.buildpack.api@v4: unsupported buildpack api: 0.1, expecting: 0.2, 0.3" )
732733 })
733734
@@ -770,7 +771,7 @@ func testCreateBuilderOs(os string, t *testing.T, when spec.G, it spec.S) {
770771 }},
771772 }}
772773
773- _ , err := subject .CreateBuilder (ctx , keychain , fetcher , stack , clusterBuilderSpec )
774+ _ , err := subject .CreateBuilder (ctx , builderKeychain , stackKeychain , fetcher , stack , clusterBuilderSpec )
774775 require .NoError (t , err )
775776 })
776777 })
@@ -797,7 +798,7 @@ func testCreateBuilderOs(os string, t *testing.T, when spec.G, it spec.S) {
797798 },
798799 }
799800
800- _ , err := subject .CreateBuilder (ctx , keychain , fetcher , stack , clusterBuilderSpec )
801+ _ , err := subject .CreateBuilder (ctx , builderKeychain , stackKeychain , fetcher , stack , clusterBuilderSpec )
801802 require .EqualError (t , err , "unsupported platform apis in kpack lifecycle: 0.1, 0.2, 0.999, expecting one of: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8" )
802803 })
803804 })
0 commit comments