@@ -321,43 +321,70 @@ async def app_no_runner(
321
321
yield basic_app
322
322
323
323
324
+ @pytest_asyncio .fixture (scope = "module" )
325
+ async def openstack_model_proxy (
326
+ openstack_http_proxy : str ,
327
+ openstack_https_proxy : str ,
328
+ openstack_no_proxy : str ,
329
+ model : Model ,
330
+ ) -> None :
331
+ await model .set_config (
332
+ {
333
+ "juju-http-proxy" : openstack_http_proxy ,
334
+ "juju-https-proxy" : openstack_https_proxy ,
335
+ "juju-no-proxy" : openstack_no_proxy ,
336
+ "logging-config" : "<root>=INFO;unit=DEBUG" ,
337
+ }
338
+ )
339
+
340
+
324
341
@pytest_asyncio .fixture (scope = "module" , name = "image_builder" )
325
342
async def image_builder_fixture (
326
343
model : Model ,
327
344
private_endpoint_config : PrivateEndpointConfigs | None ,
328
345
existing_app : Optional [str ],
346
+ flavor_name : str ,
347
+ network_name : str ,
348
+ openstack_model_proxy : None ,
349
+ openstack_connection ,
329
350
):
330
351
"""The image builder application for OpenStack runners."""
331
352
if not private_endpoint_config :
332
353
raise ValueError ("Private endpoints are required for testing OpenStack runners." )
333
354
if not existing_app :
355
+ application_name = f"github-runner-image-builder-{ '' .join (random .choices (string .ascii_lowercase + string .digits , k = 8 ))} "
334
356
app = await model .deploy (
335
357
"github-runner-image-builder" ,
358
+ application_name = application_name ,
336
359
channel = "latest/edge" ,
337
- revision = 2 ,
338
- constraints = "cores=2 mem=2G root-disk=20G virt-type=virtual-machine" ,
360
+ revision = 55 ,
339
361
config = {
340
- "app-channel" : "edge" ,
341
362
"build-interval" : "12" ,
342
- # There are several tests running simulteously, all with the same images.
343
- # Until we update the image-builder to create different names for the images,
344
- # the history limit should be big enough so that tests do not interfere.
345
- "revision-history-limit" : "15" ,
363
+ "revision-history-limit" : "2" ,
346
364
"openstack-auth-url" : private_endpoint_config ["auth_url" ],
347
365
# Bandit thinks this is a hardcoded password
348
366
"openstack-password" : private_endpoint_config ["password" ], # nosec: B105
349
367
"openstack-project-domain-name" : private_endpoint_config ["project_domain_name" ],
350
368
"openstack-project-name" : private_endpoint_config ["project_name" ],
351
369
"openstack-user-domain-name" : private_endpoint_config ["user_domain_name" ],
352
370
"openstack-user-name" : private_endpoint_config ["username" ],
371
+ "experimental-external-build" : "true" ,
372
+ "experimental-external-build-flavor" : flavor_name ,
373
+ "experimental-external-build-network" : network_name ,
353
374
},
354
375
)
355
376
await model .wait_for_idle (
356
- apps = [app .name ], wait_for_active = True , timeout = IMAGE_BUILDER_DEPLOY_TIMEOUT_IN_SECONDS
377
+ apps = [app .name ], status = "blocked" , timeout = IMAGE_BUILDER_DEPLOY_TIMEOUT_IN_SECONDS
357
378
)
358
379
else :
359
380
app = model .applications ["github-runner-image-builder" ]
360
- return app
381
+ yield app
382
+ # The github-image-builder does not clean keypairs. Until it does,
383
+ # we clean them manually here.
384
+ for key in openstack_connection .list_keypairs ():
385
+ key_name : str = key .name
386
+ if key_name .startswith (application_name ):
387
+ openstack_connection .delete_keypair (key_name )
361
388
362
389
363
390
@pytest_asyncio .fixture (scope = "module" , name = "app_openstack_runner" )
0 commit comments