Moving the attributes from HaclusterScaleBackAndForthTest to
HaclusterBaseTest allows HaclusterTest to access them and identify the
hacluster application correctly.
The skipVersion decorator was proving to be tricky to use because
it took an application name which we didn't want to hard-code,
since it is in hacluster/tests.py. One alternative was to pass a
charm name instead of application name, but if there were mutiple
hacluster applications in the model (e.g. keystone-hacluster and
nova-hacluster) we would have to pick just one to test the package
version on. After further discussion we decided to change the
decorator to a function so that we could use existing class
variables to generate the desired hacluster application name.
The crmsh package available in kinetic fails to put a cluster node in
maintenance mode, this is part of the scaleback process, more details on
the failure available at the related bug.
This change introduces a new decorator skipVersion() that allows to
provide a list of package versions with an operation flag on how dpkg
should compare the version(s).
The test HaclusterTest.test_930_scaleback() is disabled when running
crmsh-4.4.0-1ubuntu1, at the moment this would be kinetic, although if
any new package gets released this test will be re-enabled automatically
allowing us catch early if the test got fixed or not.
Related-Bug: http://pad.lv/1972730
Removing and re-adding two units out of a cluster of three
so fast seems to be too stressful for corosync/pacemaker,
which makes the test fail in rare cases. Removing and
re-adding one unit only is enough in order to validate the
functionality. This also makes the test execution time
much shorter.
The automatic corosync cleanup on Juju >= 2.8 turned out
not to work and has been removed from charm-hacluster.
The 'update-ring' action is now always needed.
Tidy up hacluster tests. In the process this fixes the error:
```
UnboundLocalError: local variable 'primary_status' referenced before assignment
```
This was caused by libjuju now returning an empty dict rather than
None when listing a subordinates units.
The hacluster tests assume that all the subordinates are hacluster.
However, with mysql8 there is a mysql-router subordinate as well, and it
doesn't support the clean-up action. This change ensures that the tests
checks that the subordinate IS hacluter prior to applying the
action/test.
The hacluster tests used to pause the hacluster subordinate but
then rely on the unintended side-effect of the prinicple going
into a blocked state to confirm the action was complete. This is
not what the old amulet tests used to do. Also, more importantly,
the side-effect has been fixed so the tests no longer worrk.