Skip to content

[MISC] Rework helpers to avoid connections from test host - #372

Open
astrojuanlu wants to merge 12 commits into
8.4/edgefrom
juanlu/8.4/robust-execute_queries_on_unit
Open

[MISC] Rework helpers to avoid connections from test host#372
astrojuanlu wants to merge 12 commits into
8.4/edgefrom
juanlu/8.4/robust-execute_queries_on_unit

Conversation

@astrojuanlu

@astrojuanlu astrojuanlu commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Issue

Make execute_queries_on_unit and is_connection_possible independent from MicroK8s routes.

This makes it easier to run the test suite against HA Canonical K8s, which is closer to how production setups actually are.

Solution

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

@astrojuanlu
astrojuanlu force-pushed the juanlu/8.4/robust-execute_queries_on_unit branch 2 times, most recently from 6ee6394 to ce4fb64 Compare June 17, 2026 09:48
@astrojuanlu
astrojuanlu requested a review from Copilot June 17, 2026 09:49

This comment was marked as outdated.

@astrojuanlu
astrojuanlu force-pushed the juanlu/8.4/robust-execute_queries_on_unit branch from ce4fb64 to 9528f5a Compare June 17, 2026 11:08
@astrojuanlu astrojuanlu changed the title [MISC] Robust execute_queries_on_unit [MISC] Rework helpers to avoid connections from test host Jun 17, 2026
@astrojuanlu astrojuanlu added the not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes label Jun 17, 2026
@astrojuanlu
astrojuanlu requested a review from Copilot June 17, 2026 11:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Comment thread kubernetes/tests/integration/helpers_ha.py Outdated
Comment thread kubernetes/tests/integration/helpers_ha.py
Comment thread kubernetes/tests/integration/helpers_ha.py
@astrojuanlu
astrojuanlu marked this pull request as ready for review June 17, 2026 11:36

@paulomach paulomach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also be able to get rid of mysql-connector-python dependency in integration group of pyproject.toml.

And I am happy to merge this to unblock #341 but we should try to use the same approach on the machine tests also.

@astrojuanlu
astrojuanlu marked this pull request as draft June 18, 2026 07:46
@astrojuanlu
astrojuanlu force-pushed the juanlu/8.4/robust-execute_queries_on_unit branch 2 times, most recently from 45c3a8d to 967692d Compare June 18, 2026 09:07
@astrojuanlu

Copy link
Copy Markdown
Contributor Author

After discussing with @paulomach , we realized that we actually don't need this for #341. Canonical K8s will allow external connections, just not in HA mode.

At the same time, I ran into some challenges with this PR, in particular with test_saturate_max_connections.py. So I'm leaving this in draft until we have time to go back to it.

@astrojuanlu
astrojuanlu force-pushed the juanlu/8.4/robust-execute_queries_on_unit branch 2 times, most recently from 1fa820d to 7711b64 Compare June 18, 2026 15:40
@astrojuanlu

Copy link
Copy Markdown
Contributor Author

Actually, on second thought, leaving that test aside, this was ready for review and most tests were passing.

@astrojuanlu
astrojuanlu marked this pull request as ready for review June 18, 2026 15:45
@astrojuanlu

Copy link
Copy Markdown
Contributor Author

(This means that we can't remove the mysql-connector-python dependency yet, but we are much closer)

@astrojuanlu
astrojuanlu requested a review from paulomach June 18, 2026 15:46
astrojuanlu and others added 8 commits July 6, 2026 12:19
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Juan Luis Cano Rodríguez <hello@juanlu.space>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Juan Luis Cano Rodríguez <hello@juanlu.space>
@astrojuanlu
astrojuanlu force-pushed the juanlu/8.4/robust-execute_queries_on_unit branch from 7711b64 to a888840 Compare July 6, 2026 10:23
@astrojuanlu

Copy link
Copy Markdown
Contributor Author

Rebased. LMK @paulomach if you still think it's worth moving forward with this.

@paulomach

Copy link
Copy Markdown
Contributor

Rebased. LMK @paulomach if you still think it's worth moving forward with this.

Yes, but not right now. We can keep it dormant for now and get back after current pulse(TM)

@sinclert-canonical sinclert-canonical left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋🏻 Hey folks! I remember seeing this PR and being confused. A few questions to start:

  • What is the context around this PR?
  • Are we migrating our MySQL 8.4 test suite to HA Canonical K8s?
  • Why do we need to issue SET ROLE ALL queries explicitly?

@paulomach

Copy link
Copy Markdown
Contributor

👋🏻 Hey folks! I remember seeing this PR and being confused. A few questions to start:

* What is the context around this PR?

I've sent @astrojuanlu on a wrong path about canonical k8s, as I initially thought that ck8s was not routing local external traffic to pods. It does. I saw this issue while running repo tests against a ck8s HA setup (not a local snap). So the idea boils down to ditch usage of local mysql-connector-python to run queries on pods/units, and use a juju.ssh leveraging the mysqlsh cli always present on the units to execute queries, allowing us to (1) drop mysql-connector-python requirement and (2) exactly same method for the substrates, as side-effects

* Are we migrating our MySQL 8.4 test suite to HA Canonical K8s?

No, that will make runners cry.

* Why do we need to issue `SET ROLE ALL` queries explicitly?

Don't know.

@astrojuanlu

Copy link
Copy Markdown
Contributor Author

Why do we need to issue SET ROLE ALL queries explicitly?

Turns out MySQL Shell does not respect activate_all_roles_on_login = ON when using the X protocol, which is the default for SQL and Python modes. This affects all the tests that use extra roles.

This might be a fundamental feature of how the X protocol works, but I haven't been able to pinpoint that in the official documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants