from juju.model import Model
+log = logging.getLogger(__name__)
+
+MB = 1024 * 1024
async def run():
model = Model()
service_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()