canonical / mysql-k8s-bundle

A bundle for mysql and mysql-router k8s charms
https://charmhub.io/mysql-k8s-bundle
Apache License 2.0
2 stars 1 forks source link

Use exactly match on 'pgrep mysqld' due to mysqld_exporter availability #50

Closed taurus-forever closed 1 year ago

taurus-forever commented 1 year ago

Issue

The integration test is randomly crashing on GH with error:

> Traceback (most recent call last):
>   File "/home/runner/work/mysql-k8s-bundle/mysql-k8s-bundle/tests/integration/test_bundle.py", line 67, in test_mysql_primary_switchover
>     mysql_pid = await get_process_pid(
>   File "/home/runner/work/mysql-k8s-bundle/mysql-k8s-bundle/tests/integration/helpers.py", line 160, in get_process_pid
>     return int(stripped_pid)
> ValueError: invalid literal for int() with base 10: '69\n353\n409'

Solution

Use pgrep with exact match flag (-x):

> ubuntu@juju-82de18-16:~$ pgrep -a mysqld
> 3774 /snap/charmed-mysql/24/bin/mysqld_exporter ...
> 3996 /bin/sh /snap/charmed-mysql/24/usr/bin/mysqld_safe ...
> 4866 /snap/charmed-mysql/24/usr/sbin/mysqld ...
> ubuntu@juju-82de18-16:~$

> ubuntu@juju-82de18-16:~$ pgrep -a -x mysqld
> 4866 /snap/charmed-mysql/24/usr/sbin/mysqld ...
> ubuntu@juju-82de18-16:~$
carlcsaposs-canonical commented 1 year ago

Looks like the test is still failing AssertionError: Failed getting pid

taurus-forever commented 1 year ago

Looks like the test is still failing AssertionError: Failed getting pid

Yeah, I suspect the test is broken for a while (after migration to charmed-snap) but can't find the root of the issue here. Good ideas are welcome.

taurus-forever commented 1 year ago

Well done @shayancanonical ! Thank you!