@@ -157,6 +157,81 @@ def test_jdk11plus_jshell_cmd(self):
157
157
expected_string = 'CMD ["jshell"]'
158
158
self .assertNotIn (expected_string , rendered_template )
159
159
160
+ def test_binutils_inclusion (self ):
161
+ template_name = "ubuntu.Dockerfile.j2"
162
+ template = self .env .get_template (template_name )
163
+
164
+ # Binutils should be included for jdk images with version >= 13
165
+ with self .subTest ("jdk 13+ should include binutils" ):
166
+ context = {
167
+ "version" : 13 ,
168
+ "image_type" : "jdk" ,
169
+ "os" : "ubuntu" ,
170
+ "arch_data" : {},
171
+ }
172
+ rendered_template = template .render (** context )
173
+ self .assertIn ("binutils" , rendered_template )
174
+
175
+ # Binutils should not be included for jre images regardless of version
176
+ with self .subTest ("jre 13+ should not include binutils" ):
177
+ context = {
178
+ "version" : 13 ,
179
+ "image_type" : "jre" ,
180
+ "os" : "ubuntu" ,
181
+ "arch_data" : {},
182
+ }
183
+ rendered_template = template .render (** context )
184
+ self .assertNotIn ("binutils" , rendered_template )
185
+
186
+ # Binutils should not be included for jdk images with version < 13
187
+ with self .subTest ("jdk < 13 should not include binutils" ):
188
+ context = {
189
+ "version" : 12 ,
190
+ "image_type" : "jdk" ,
191
+ "os" : "ubuntu" ,
192
+ "arch_data" : {},
193
+ }
194
+ rendered_template = template .render (** context )
195
+ self .assertNotIn ("binutils" , rendered_template )
196
+
197
+ def test_arch_data_population (self ):
198
+ template_name = "ubuntu.Dockerfile.j2"
199
+ template = self .env .get_template (template_name )
200
+
201
+ # Simulate API response
202
+ arch_data = {
203
+ "amd64" : {
204
+ "download_url" : "http://fake-url.com" ,
205
+ "checksum" : "fake-checksum" ,
206
+ }
207
+ }
208
+
209
+ context = {
210
+ "version" : 11 ,
211
+ "image_type" : "jdk" ,
212
+ "os" : "ubuntu" ,
213
+ "arch_data" : arch_data ,
214
+ }
215
+ rendered_template = template .render (** context )
216
+
217
+ self .assertIn ("http://fake-url.com" , rendered_template )
218
+ self .assertIn ("fake-checksum" , rendered_template )
219
+
220
+ def test_entrypoint_rendering (self ):
221
+ template_name = "entrypoint.sh.j2"
222
+ template = self .env .get_template (template_name )
223
+
224
+ context = {
225
+ "image_type" : "jdk" ,
226
+ "os" : "ubuntu" ,
227
+ "version" : 11 ,
228
+ }
229
+ rendered_template = template .render (** context )
230
+
231
+ # Ensure that the entrypoint script contains expected commands
232
+ self .assertIn ("update-ca-certificates" , rendered_template )
233
+ self .assertIn ("exec \" $@\" " , rendered_template )
234
+
160
235
161
236
if __name__ == "__main__" :
162
237
unittest .main ()
0 commit comments