@@ -24,26 +24,25 @@ func TestSlugBuilderPodName(t *testing.T) {
2424
2525type slugBuildCase struct {
2626 debug bool
27- withAuth bool
2827 name string
2928 namespace string
3029 env map [string ]interface {}
31- tarURL string
32- putURL string
30+ tarKey string
31+ putKey string
3332 buildPack string
3433 slugBuilderImage string
34+ storageType string
3535}
3636
3737type dockerBuildCase struct {
3838 debug bool
39- withAuth bool
4039 name string
4140 namespace string
4241 env map [string ]interface {}
43- tarURL string
42+ tarKey string
4443 imgName string
45- region string
4644 dockerBuilderImage string
45+ storageType string
4746}
4847
4948func TestBuildPod (t * testing.T ) {
@@ -55,18 +54,18 @@ func TestBuildPod(t *testing.T) {
5554 var pod * api.Pod
5655
5756 slugBuilds := []slugBuildCase {
58- {true , true , "test" , "default" , emptyEnv , "tar" , "put-url" , "" , "" },
59- {true , false , "test" , "default" , emptyEnv , "tar" , "put-url" , "" , "" },
60- {true , true , "test" , "default" , env , "tar" , "put-url" , "" , "" },
61- {true , false , "test" , "default" , env , "tar" , "put-url" , "" , "" },
62- {true , true , "test" , "default" , emptyEnv , "tar" , "put-url" , "buildpack" , "" },
63- {true , false , "test" , "default" , emptyEnv , "tar" , "put-url" , "buildpack" , "" },
64- {true , true , "test" , "default" , env , "tar" , "put-url" , "buildpack" , "" },
65- {true , false , "test" , "default" , env , "tar" , "put-url" , "buildpack" , "customimage" },
57+ {true , "test" , "default" , emptyEnv , "tar" , "put-url" , " " , "" , "" },
58+ {true , "test" , "default" , emptyEnv , "tar" , "put-url" , " " , "" , "" },
59+ {true , "test" , "default" , env , "tar" , "put-url" , " " , "" , "" },
60+ {true , "test" , "default" , env , "tar" , "put-url" , " " , "" , "" },
61+ {true , "test" , "default" , emptyEnv , "tar" , "put-url" , "buildpack" , " " , "" },
62+ {true , "test" , "default" , emptyEnv , "tar" , "put-url" , "buildpack" , " " , "" },
63+ {true , "test" , "default" , env , "tar" , "put-url" , "buildpack" , " " , "" },
64+ {true , "test" , "default" , env , "tar" , "put-url" , "buildpack" , "customimage" , " " },
6665 }
6766
6867 for _ , build := range slugBuilds {
69- pod = slugbuilderPod (build .debug , build .withAuth , build . name , build .namespace , build .env , build .tarURL , build .putURL , build .buildPack , build .slugBuilderImage )
68+ pod = slugbuilderPod (build .debug , build .name , build .namespace , build .env , build .tarKey , build .putKey , build .buildPack , build .slugBuilderImage , build . storageType )
7069
7170 if pod .ObjectMeta .Name != build .name {
7271 t .Errorf ("expected %v but returned %v " , build .name , pod .ObjectMeta .Name )
@@ -76,8 +75,8 @@ func TestBuildPod(t *testing.T) {
7675 t .Errorf ("expected %v but returned %v " , build .namespace , pod .ObjectMeta .Namespace )
7776 }
7877
79- checkForEnv (t , pod , "TAR_URL " , build .tarURL )
80- checkForEnv (t , pod , "put_url " , build .putURL )
78+ checkForEnv (t , pod , "TAR_PATH " , build .tarKey )
79+ checkForEnv (t , pod , "PUT_PATH " , build .putKey )
8180
8281 if build .buildPack != "" {
8382 checkForEnv (t , pod , "BUILDPACK_URL" , build .buildPack )
@@ -91,29 +90,28 @@ func TestBuildPod(t *testing.T) {
9190 }
9291
9392 dockerBuilds := []dockerBuildCase {
94- {true , true , "test" , "default" , emptyEnv , "tar" , "" , "us-east-1 " , "" },
95- {true , false , "test" , "default" , emptyEnv , "tar" , "" , "us-east-1 " , "" },
96- {true , true , "test" , "default" , env , "tar" , "" , "us-east-1 " , "" },
97- {true , false , "test" , "default" , env , "tar" , "" , "us-east-1 " , "" },
98- {true , true , "test" , "default" , emptyEnv , "tar" , "img" , "us-east-1 " , "" },
99- {true , false , "test" , "default" , emptyEnv , "tar" , "img" , "us-east-1 " , "" },
100- {true , true , "test" , "default" , env , "tar" , "img" , "us-east-1 " , "" },
101- {true , false , "test" , "default" , env , "tar" , "img" , "us-east-1 " , "customimage " },
93+ {true , "test" , "default" , emptyEnv , "tar" , "" , "" , "" },
94+ {true , "test" , "default" , emptyEnv , "tar" , "" , "" , "" },
95+ {true , "test" , "default" , env , "tar" , "" , "" , "" },
96+ {true , "test" , "default" , env , "tar" , "" , "" , "" },
97+ {true , "test" , "default" , emptyEnv , "tar" , "img" , "" , "" },
98+ {true , "test" , "default" , emptyEnv , "tar" , "img" , "" , "" },
99+ {true , "test" , "default" , env , "tar" , "img" , "" , "" },
100+ {true , "test" , "default" , env , "tar" , "img" , "customimage " , "" },
102101 }
103102
104103 for _ , build := range dockerBuilds {
105- pod = dockerBuilderPod (build .debug , build .withAuth , build . name , build .namespace , build .env , build .tarURL , build .imgName , build .region , build .dockerBuilderImage )
104+ pod = dockerBuilderPod (build .debug , build .name , build .namespace , build .env , build .tarKey , build .imgName , build .dockerBuilderImage , build .storageType )
106105
107106 if pod .ObjectMeta .Name != build .name {
108107 t .Errorf ("expected %v but returned %v " , build .name , pod .ObjectMeta .Name )
109108 }
110109 if pod .ObjectMeta .Namespace != build .namespace {
111110 t .Errorf ("expected %v but returned %v " , build .namespace , pod .ObjectMeta .Namespace )
112111 }
113- if ! build .withAuth {
114- checkForEnv (t , pod , "TAR_URL" , build .tarURL )
115- checkForEnv (t , pod , "IMG_NAME" , build .imgName )
116- }
112+
113+ checkForEnv (t , pod , "TAR_PATH" , build .tarKey )
114+ checkForEnv (t , pod , "IMG_NAME" , build .imgName )
117115 if build .dockerBuilderImage != "" {
118116 if pod .Spec .Containers [0 ].Image != build .dockerBuilderImage {
119117 t .Errorf ("expected %v but returned %v " , build .dockerBuilderImage , pod .Spec .Containers [0 ].Image )
0 commit comments