canonical / mysql-test-app

Test app for Charmed MySQL K8s/VM
https://charmhub.io/mysql-test-app
Apache License 2.0
0 stars 1 forks source link

support for legacy mysql/mariadb #4

Closed paulomach closed 1 year ago

paulomach commented 1 year ago

Issue

Usage of mysql-test-app all across our charm tests, replacing test applications within the test code. Tests that use 3rd party apps for testing should remain the same.

Part of DPE-1465

Solution

Added support for a mysql/mariadb legacy relation

paulomach commented 1 year ago
1. after removing modern relation (created by `juju remove-rea mysql:database mysql-test-app:database`) the charm doesn't stop continuous writes via `/usr/bin/python3 src/continuous_writes.py relation-10 3Ft2t2lQWMcDntnFLl5Ela1A continuous_writes_database data 1 10.85.186.121 3306`

33e986a

2. the test-app charm stays `waiting` after relation using legacy interface IF `mysql-interface-database` AND `mysql-interface-user` are not set (both are empty by default). Also `mysql-interface-database` must be set to value `continuous_writes_database`. Also this information printed as DEBUG:

DEBUG unit.mysql/0.juju-log mysql:3: mysql legacy interface user or database not defined.

What about:

* print this as `ERROR:  `mysql` legacy interface user or database not defined.` (as charm cannot continue) + set blocked status

* also, avoid using "or" in error messages, it confuses a lot, print two lines if necessary:
  > ERROR:  `mysql` legacy interface user not defined, set using config `mysql-interface-user`
  > ERROR:  `mysql` legacy interface database not defined, set using config `mysql-interface-database`

* after manually set options above relation have to be re-created... meh... should mysql-k8s charm reacts on event `config_changed` without errors, e.g: https://pastebin.canonical.com/p/mJwSJhknjd/

The above we need to do in mysql charms. Registered here

* consider to generate `mysql-interface-user` automatically if not specified in config

Should not be done, as it breaks existing behavior.

* can mysql-test-app set `mysql-interface-database=continuous_writes_database` through relation?

Not supported by the relation interface.

* add information about `mysql-interface-database=continuous_writes_database` to test-app README?

Sure, absolutely - 6a476ba

3. `continious_writes` is not started automatically after relating `mysql` legacy interface. Expected?

1981a10

4. `get_inserted_data_action` returns `empty` for legacy relation. Expected?

1981a10

5. mysql+mysql-test-app cannot be removed if related using legacy interface:

juju remove-application mysql mysql-test-app logs: https://pastebin.canonical.com/p/7PXxZHjy42/

There's and old related task on removing things.

P.S. we are on a right path!

carlcsaposs-canonical commented 1 year ago

@taurus-forever Has https://github.com/canonical/data-platform/pull/14 been applied? It looks like the branch for this PR wasn't automatically deleted