@@ -15,7 +15,7 @@ module Jobs::Runtime
1515 end
1616
1717 context 'when the manifest has one buildpack' do
18- let ( :buildpack_fields ) { [ { file : file , options : opts } ] }
18+ let ( :buildpack_fields ) { [ { file : file , options : opts , config_index : 0 } ] }
1919 let ( :single_buildpack_job ) { jobs . first }
2020
2121 shared_examples_for 'passthrough parameters' do
@@ -34,7 +34,7 @@ module Jobs::Runtime
3434
3535 context 'when there is no matching buildpack record by name' do
3636 context 'and there is a detected stack in the zipfile' do
37- let ( :buildpack_fields ) { [ { file : file , options : opts , stack : 'detected stack' } ] }
37+ let ( :buildpack_fields ) { [ { file : file , options : opts , stack : 'detected stack' , config_index : 0 } ] }
3838
3939 include_examples 'passthrough parameters'
4040
@@ -45,6 +45,18 @@ module Jobs::Runtime
4545 it 'sets the stack to the detected stack' do
4646 expect ( single_buildpack_job . stack_name ) . to eq ( 'detected stack' )
4747 end
48+
49+ it 'passes config_index to the create job' do
50+ expect ( single_buildpack_job . config_index ) . to eq ( 0 )
51+ end
52+
53+ context 'with a specific config_index' do
54+ let ( :buildpack_fields ) { [ { file : file , options : opts , stack : 'detected stack' , config_index : 3 } ] }
55+
56+ it 'passes the config_index through' do
57+ expect ( single_buildpack_job . config_index ) . to eq ( 3 )
58+ end
59+ end
4860 end
4961
5062 context 'and there is not a detected stack in the zipfile' do
@@ -66,7 +78,7 @@ module Jobs::Runtime
6678 let! ( :existing_buildpack ) { Buildpack . make ( name : name , stack : existing_stack . name , key : 'new_key' , guid : 'the-guid' ) }
6779
6880 context 'and the buildpack zip has the same stack' do
69- let ( :buildpack_fields ) { [ { file : file , options : opts , stack : existing_stack . name } ] }
81+ let ( :buildpack_fields ) { [ { file : file , options : opts , stack : existing_stack . name , config_index : 0 } ] }
7082
7183 include_examples 'passthrough parameters'
7284
@@ -84,7 +96,7 @@ module Jobs::Runtime
8496 end
8597
8698 context 'and the buildpack zip has a different stack' do
87- let ( :buildpack_fields ) { [ { file : file , options : opts , stack : 'manifest stack' } ] }
99+ let ( :buildpack_fields ) { [ { file : file , options : opts , stack : 'manifest stack' , config_index : 0 } ] }
88100
89101 include_examples 'passthrough parameters'
90102
@@ -98,7 +110,7 @@ module Jobs::Runtime
98110 end
99111
100112 context 'and the manifest stack is nil' do
101- let ( :buildpack_fields ) { [ { file : file , options : opts , stack : nil } ] }
113+ let ( :buildpack_fields ) { [ { file : file , options : opts , stack : nil , config_index : 0 } ] }
102114
103115 it 'errors' do
104116 expect do
@@ -112,7 +124,7 @@ module Jobs::Runtime
112124 let! ( :existing_buildpack ) { Buildpack . make ( name : name , stack : nil , key : 'new_key' , guid : 'the-guid' ) }
113125
114126 context 'and the buildpack zip also has a nil stack' do
115- let ( :buildpack_fields ) { [ { file : file , options : opts , stack : nil } ] }
127+ let ( :buildpack_fields ) { [ { file : file , options : opts , stack : nil , config_index : 0 } ] }
116128
117129 include_examples 'passthrough parameters'
118130
@@ -130,7 +142,7 @@ module Jobs::Runtime
130142 end
131143
132144 context 'but the buildpack zip /has/ a stack' do
133- let ( :buildpack_fields ) { [ { file : file , options : opts , stack : 'manifest stack' } ] }
145+ let ( :buildpack_fields ) { [ { file : file , options : opts , stack : 'manifest stack' , config_index : 0 } ] }
134146
135147 include_examples 'passthrough parameters'
136148
@@ -157,7 +169,7 @@ module Jobs::Runtime
157169 let! ( :another_existing_buildpack ) { Buildpack . make ( name : name , stack : another_existing_stack . name , key : 'new_key' , guid : 'another-guid' ) }
158170
159171 context 'and one matches the manifest stack' do
160- let ( :buildpack_fields ) { [ { file : file , options : opts , stack : existing_stack . name } ] }
172+ let ( :buildpack_fields ) { [ { file : file , options : opts , stack : existing_stack . name , config_index : 0 } ] }
161173
162174 include_examples 'passthrough parameters'
163175
@@ -175,7 +187,7 @@ module Jobs::Runtime
175187 end
176188
177189 context 'and the manifest stack is nil' do
178- let ( :buildpack_fields ) { [ { file : file , options : opts , stack : nil } ] }
190+ let ( :buildpack_fields ) { [ { file : file , options : opts , stack : nil , config_index : 0 } ] }
179191
180192 it 'errors' do
181193 expect do
@@ -185,7 +197,7 @@ module Jobs::Runtime
185197 end
186198
187199 context 'and none match the manifest stack' do
188- let ( :buildpack_fields ) { [ { file : file , options : opts , stack : 'manifest stack' } ] }
200+ let ( :buildpack_fields ) { [ { file : file , options : opts , stack : 'manifest stack' , config_index : 0 } ] }
189201
190202 include_examples 'passthrough parameters'
191203
@@ -202,7 +214,9 @@ module Jobs::Runtime
202214
203215 context 'when the manifest has multiple buildpack entries for one name, with different stacks' do
204216 let ( :another_file ) { 'the-other-file' }
205- let ( :buildpack_fields ) { [ { file : file , options : opts , stack : 'existing stack' } , { file : another_file , options : opts , stack : 'manifest stack' } ] }
217+ let ( :buildpack_fields ) do
218+ [ { file : file , options : opts , stack : 'existing stack' , config_index : 0 } , { file : another_file , options : opts , stack : 'manifest stack' , config_index : 1 } ]
219+ end
206220
207221 context 'and there are no matching Buildpacks' do
208222 it 'plans to create all the Buildpacks' do
@@ -277,7 +291,10 @@ module Jobs::Runtime
277291
278292 let ( :another_existing_stack ) { Stack . make ( name : 'another existing stack' ) }
279293 let! ( :another_existing_buildpack ) { Buildpack . make ( name : name , stack : another_existing_stack . name , key : 'a_different_key' , guid : 'a-different-guid' ) }
280- let ( :buildpack_fields ) { [ { file : file , options : opts , stack : existing_stack . name } , { file : another_file , options : opts , stack : another_existing_stack . name } ] }
294+ let ( :buildpack_fields ) do
295+ [ { file : file , options : opts , stack : existing_stack . name , config_index : 0 } ,
296+ { file : another_file , options : opts , stack : another_existing_stack . name , config_index : 1 } ]
297+ end
281298
282299 context 'and none of them has a nil stack' do
283300 it 'creates a job for each buildpack' do
@@ -297,7 +314,7 @@ module Jobs::Runtime
297314 end
298315
299316 context 'when one of them is stackless' do
300- let ( :buildpack_fields ) { [ { file : file , options : opts } ] }
317+ let ( :buildpack_fields ) { [ { file : file , options : opts , config_index : 0 } ] }
301318
302319 before do
303320 Stack . make ( name : 'existing stack' )
@@ -316,7 +333,7 @@ module Jobs::Runtime
316333
317334 context 'when the manifest has multiple buildpack entries for one name, with the same stack' do
318335 let ( :another_file ) { 'the-other-file' }
319- let ( :buildpack_fields ) { [ { file : file , options : opts , stack : 'stack' } , { file : another_file , options : opts , stack : 'stack' } ] }
336+ let ( :buildpack_fields ) { [ { file : file , options : opts , stack : 'stack' , config_index : 0 } , { file : another_file , options : opts , stack : 'stack' , config_index : 1 } ] }
320337
321338 it 'raises a DuplicateInstall error' do
322339 expect do
@@ -327,7 +344,7 @@ module Jobs::Runtime
327344
328345 context 'when the manifest has multiple buildpack entries for one name, neither specifying a stack' do
329346 let ( :another_file ) { 'the-other-file' }
330- let ( :buildpack_fields ) { [ { file : file , options : opts , stack : nil } , { file : another_file , options : opts , stack : nil } ] }
347+ let ( :buildpack_fields ) { [ { file : file , options : opts , stack : nil , config_index : 0 } , { file : another_file , options : opts , stack : nil , config_index : 1 } ] }
331348
332349 it 'raises a DuplicateInstall error' do
333350 expect do
@@ -338,7 +355,7 @@ module Jobs::Runtime
338355
339356 context 'when the manifest has multiple buildpack entries for one name, one stackful and one stackless' do
340357 let ( :another_file ) { 'the-other-file' }
341- let ( :buildpack_fields ) { [ { file : file , options : opts , stack : 'stack' } , { file : another_file , options : opts , stack : nil } ] }
358+ let ( :buildpack_fields ) { [ { file : file , options : opts , stack : 'stack' , config_index : 0 } , { file : another_file , options : opts , stack : nil , config_index : 1 } ] }
342359
343360 it 'raises a StacklessBuildpackIncompatibilityError error' do
344361 expect do
0 commit comments