@@ -11,11 +11,12 @@ import (
1111)
1212
1313type useLocalRegistryTestCase struct {
14- name string
15- client kubectl.Client
16- config * latest.Config
17- skipPush bool
18- expected bool
14+ name string
15+ client kubectl.Client
16+ config * latest.Config
17+ imageConfig * latest.Image
18+ skipPush bool
19+ expected bool
1920}
2021
2122func TestUseLocalRegistry (t * testing.T ) {
@@ -304,10 +305,64 @@ func TestUseLocalRegistry(t *testing.T) {
304305 },
305306 expected : false ,
306307 },
308+ {
309+ name : "Remote Cluster BuildKit In Cluster Build Config" ,
310+ client : & kubectltesting.Client {
311+ Context : "arn:aws:eks:us-west-2:1234567890:cluster/remote-eks" ,
312+ },
313+ config : & latest.Config {
314+ LocalRegistry : nil ,
315+ },
316+ imageConfig : & latest.Image {
317+ BuildKit : & latest.BuildKitConfig {
318+ InCluster : & latest.BuildKitInClusterConfig {},
319+ },
320+ },
321+ expected : false ,
322+ },
323+ {
324+ name : "Remote Cluster BuildKit Build Config" ,
325+ client : & kubectltesting.Client {
326+ Context : "arn:aws:eks:us-west-2:1234567890:cluster/remote-eks" ,
327+ },
328+ config : & latest.Config {
329+ LocalRegistry : nil ,
330+ },
331+ imageConfig : & latest.Image {
332+ BuildKit : & latest.BuildKitConfig {},
333+ },
334+ expected : true ,
335+ },
336+ {
337+ name : "Remote Cluster Kaniko Build Config" ,
338+ client : & kubectltesting.Client {
339+ Context : "arn:aws:eks:us-west-2:1234567890:cluster/remote-eks" ,
340+ },
341+ config : & latest.Config {
342+ LocalRegistry : nil ,
343+ },
344+ imageConfig : & latest.Image {
345+ Kaniko : & latest.KanikoConfig {},
346+ },
347+ expected : false ,
348+ },
349+ {
350+ name : "Remote Cluster Custom Build Config" ,
351+ client : & kubectltesting.Client {
352+ Context : "arn:aws:eks:us-west-2:1234567890:cluster/remote-eks" ,
353+ },
354+ config : & latest.Config {
355+ LocalRegistry : nil ,
356+ },
357+ imageConfig : & latest.Image {
358+ Custom : & latest.CustomConfig {},
359+ },
360+ expected : false ,
361+ },
307362 }
308363
309364 for _ , testCase := range testCases {
310- actual := UseLocalRegistry (testCase .client , testCase .config , nil , nil , testCase .skipPush )
365+ actual := UseLocalRegistry (testCase .client , testCase .config , testCase . imageConfig , nil , testCase .skipPush )
311366 assert .Equal (t , actual , testCase .expected , "Unexpected result in test case %s" , testCase .name )
312367 }
313368}
0 commit comments