Use health check to detect mariadb startup and skip volume modifier on M1 #25805
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Partial resolution of #25428. See also discussion in #25648. This PR gets modules which use mariadb running clean with
-Dstart-containerson M1 with podman as the container implementation. I know some of the files in this change have mysql-* names, but they’re actually using mariadb, so I included them.To test these changes, this sequence should be sufficient. It runs clean for me on my M1 after
podman machine start:(and it should run much faster than before the changes, on all platforms).
Note that I do still see some errors in quarkus-integration-test-hibernate-orm-tenancy-connection-resolver-legacy-qualifiers with
-Dstart-containers -Dtest-containers. Fixing those is outside the scope of this changeset, which is only looking at getting-Dstart-containersgoing.There is some whitespace in the diffs, but I think most of the changes are ‘correct’. Ideally, those changes wouldn’t be contaminating this changeset, but see https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/IntelliJ.20formatting.20setup/near/283912797. Getting our xml formatting consistent will need a bigger effort.
What’s changed?
Readiness checks
I had a problem with tcp-ping based readiness checks for mariadb. Only one test used it, so we can switch to using an sqladmin ping check. Several tests do a ping inside a in the . However, a inside a isn’t a true readiness check. The plugin will always wait for the and then run the`. A better (but more verbose) option is to use a container health check.
This was only strictly necessary where the tests were using a tcp ping to check for readiness (which did not work on podman), but I think it’s an improvement elsewhere.
This sped up the tests quite a bit for me since it will cut the wait short if the database is ready before the timeout pops. I saw a factor of two improvement on tests which used mariadb, but on slower hardware the effect may not be so noticeable.
Be aware when testing healthcheck scripts, caching of named images can cause apparently non-deterministic behaviour. Change the name if making changes.
I also found that trying to extract common code to parent poms caused tests not to be able to connect to the containers. I don’t understand the reason - perhaps some crucial fabric8 state ends up in a target directory at the parent level?
Volume mounts access modifier
The ':Z' SELinux access label seems to cause problems on M1. I think this is related to containers/podman#13631. We mount config files to speed up mariadb, so I’ve parameterised the access modifier so that the mount works on M1.