X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=examples%2Fconfig.py;h=579308b55b929f601b868b54415684184c0a6936;hb=d2fa820fda0498109ed316c5e1506695f151ce18;hp=616c7805e2e332ba73a33fbd4320133d631bc708;hpb=55ae2c120ce031f57ac210f3d7bd203db739f1e9;p=osm%2FN2VC.git diff --git a/examples/config.py b/examples/config.py index 616c780..579308b 100644 --- a/examples/config.py +++ b/examples/config.py @@ -11,6 +11,9 @@ import logging from juju.model import Model +log = logging.getLogger(__name__) + +MB = 1024 * 1024 async def run(): model = Model() @@ -19,15 +22,26 @@ async def run(): ubuntu_app = await model.deploy( 'mysql', - service_name='mysql', + application_name='mysql', series='trusty', channel='stable', + config={ + 'tuning-level': 'safest', + }, constraints={ - 'mem': 512 * 1024 * 1024 + 'mem': 256 * MB, }, ) - print(await ubuntu_app.get_config()) - print(await ubuntu_app.get_constraints()) + + # update and check app config + await ubuntu_app.set_config({'tuning-level': 'fast'}) + config = await ubuntu_app.get_config() + assert(config['tuning-level']['value'] == 'fast') + + # update and check app constraints + await ubuntu_app.set_constraints({'mem': 512 * MB}) + constraints = await ubuntu_app.get_constraints() + assert(constraints['mem'] == 512 * MB) await model.disconnect() model.loop.stop()