-
Notifications
You must be signed in to change notification settings - Fork 12
Support juju 4 in integration tests #596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
320f069
fa9e27d
7912111
e1325e5
139adc4
7fae349
1aa8bbc
3ffef08
3ab1eb4
b31ea66
d841cc4
71174e8
a654ff1
7db71a1
38a7248
0f9821f
bf986a4
82f22e1
90d6e37
a516330
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,3 +38,4 @@ haproxy-route-policy/.python-version | |
| artifacts.build.yaml | ||
|
|
||
| .worktrees | ||
| **/superpowers/** | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Copyright 2026 Canonical Ltd. | ||
| # See LICENSE file for licensing details. | ||
|
|
||
| juju: | ||
| channel: 3/stable | ||
| model-defaults: | ||
| test-mode: "true" | ||
| automatically-retry-hooks: "false" | ||
|
|
||
| providers: | ||
| lxd: | ||
| enable: true | ||
| bootstrap: true | ||
| k8s: | ||
| enable: true | ||
| bootstrap: false | ||
| channel: 1.32-classic/stable | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason to not be on 1.35-classic/stable? |
||
| features: | ||
| load-balancer: | ||
| enabled: true | ||
| l2-mode: true | ||
| cidrs: 10.43.45.0/24 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright 2026 Canonical Ltd. | ||
| # See LICENSE file for licensing details. | ||
|
|
||
| juju: | ||
| channel: 3/stable | ||
| model-defaults: | ||
| test-mode: "true" | ||
| automatically-retry-hooks: "false" | ||
|
|
||
| providers: | ||
| lxd: | ||
| enable: true | ||
| bootstrap: true | ||
|
|
||
| host: | ||
| snaps: | ||
| charmcraft: | ||
| channel: latest/stable | ||
| classic: true |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -92,7 +92,10 @@ def certificate_provider_application_fixture( | |||||||||||||||||||||||||||||||||
| logger.warning("Using existing application: %s", SELF_SIGNED_CERTIFICATES_APP_NAME) | ||||||||||||||||||||||||||||||||||
| return SELF_SIGNED_CERTIFICATES_APP_NAME | ||||||||||||||||||||||||||||||||||
| juju.deploy( | ||||||||||||||||||||||||||||||||||
| "self-signed-certificates", app=SELF_SIGNED_CERTIFICATES_APP_NAME, channel="1/edge" | ||||||||||||||||||||||||||||||||||
| "self-signed-certificates", | ||||||||||||||||||||||||||||||||||
| app=SELF_SIGNED_CERTIFICATES_APP_NAME, | ||||||||||||||||||||||||||||||||||
| channel="1/edge", | ||||||||||||||||||||||||||||||||||
| force=True, | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| return SELF_SIGNED_CERTIFICATES_APP_NAME | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
@@ -334,6 +337,14 @@ def haproxy_route_tcp_relation_fixture( | |||||||||||||||||||||||||||||||||
| f"{configured_application_with_tls}:haproxy-route-tcp", | ||||||||||||||||||||||||||||||||||
| any_charm_haproxy_route_tcp_requirer, | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| juju.wait( | ||||||||||||||||||||||||||||||||||
| lambda status: ( | ||||||||||||||||||||||||||||||||||
| status.apps[configured_application_with_tls].is_blocked | ||||||||||||||||||||||||||||||||||
| and jubilant.all_agents_idle( | ||||||||||||||||||||||||||||||||||
| status, configured_application_with_tls, any_charm_haproxy_route_tcp_requirer | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+340
to
+347
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit
Suggested change
|
||||||||||||||||||||||||||||||||||
| juju.run( | ||||||||||||||||||||||||||||||||||
| f"{any_charm_haproxy_route_tcp_requirer}/0", | ||||||||||||||||||||||||||||||||||
| "rpc", | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |||||||||||||||||||||||||||||||||
| import pytest | ||||||||||||||||||||||||||||||||||
| from requests import Session | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| from .conftest import TEST_EXTERNAL_HOSTNAME_CONFIG, get_unit_ip_address | ||||||||||||||||||||||||||||||||||
| from .conftest import TEST_EXTERNAL_HOSTNAME_CONFIG, all_active_and_idle, get_unit_ip_address | ||||||||||||||||||||||||||||||||||
| from .helper import DNSResolverHTTPSAdapter | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| HAPROXY_ROUTE_REQUIRER_HOSTNAME = f"ok.{TEST_EXTERNAL_HOSTNAME_CONFIG}" | ||||||||||||||||||||||||||||||||||
|
|
@@ -28,10 +28,18 @@ def test_haproxy_route_integration( | |||||||||||||||||||||||||||||||||
| f"{configured_application_with_tls}:haproxy-route", | ||||||||||||||||||||||||||||||||||
| f"{haproxy_route_requirer}:require-haproxy-route", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| juju.wait( | ||||||||||||||||||||||||||||||||||
| lambda status: ( | ||||||||||||||||||||||||||||||||||
| status.apps[configured_application_with_tls].is_blocked | ||||||||||||||||||||||||||||||||||
| and jubilant.all_agents_idle( | ||||||||||||||||||||||||||||||||||
| status, configured_application_with_tls, haproxy_route_requirer | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+38
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit
Suggested change
|
||||||||||||||||||||||||||||||||||
| juju.run(f"{haproxy_route_requirer}/0", "rpc", {"method": "update_relation"}) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| juju.wait( | ||||||||||||||||||||||||||||||||||
| lambda status: jubilant.all_active( | ||||||||||||||||||||||||||||||||||
| lambda status: all_active_and_idle( | ||||||||||||||||||||||||||||||||||
| status, configured_application_with_tls, haproxy_route_requirer | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,8 @@ | |
| import jubilant | ||
| import pytest | ||
|
|
||
| from .conftest import all_active_and_idle | ||
|
|
||
|
|
||
| @pytest.mark.abort_on_fail | ||
| def test_action( | ||
|
|
@@ -23,6 +25,14 @@ def test_action( | |
| juju.integrate( | ||
| f"{configured_application_with_tls}:haproxy-route", any_charm_haproxy_route_requirer | ||
| ) | ||
| juju.wait( | ||
| lambda status: ( | ||
| status.apps[configured_application_with_tls].is_blocked | ||
| and jubilant.all_agents_idle( | ||
| status, configured_application_with_tls, any_charm_haproxy_route_requirer | ||
| ) | ||
| ), | ||
| ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless I misunderstood previous suggestions from Fouad, they may apply here too? |
||
|
|
||
| juju.run( | ||
| f"{any_charm_haproxy_route_requirer}/0", | ||
|
|
@@ -43,7 +53,7 @@ def test_action( | |
| }, | ||
| ) | ||
| juju.wait( | ||
| lambda status: jubilant.all_active( | ||
| lambda status: all_active_and_idle( | ||
| status, configured_application_with_tls, any_charm_haproxy_route_requirer | ||
| ) | ||
| ) | ||
|
|
@@ -79,7 +89,9 @@ def test_action( | |
| assert task.results == {"endpoints": "[]"}, task.results | ||
|
|
||
| # get-configuration returns exactly the configuration currently on disk. | ||
| on_disk = juju.ssh(f"{configured_application_with_tls}/0", "cat /etc/haproxy/haproxy.cfg") | ||
| on_disk = juju.exec( | ||
| "cat /etc/haproxy/haproxy.cfg", unit=f"{configured_application_with_tls}/0" | ||
| ).stdout | ||
| task = juju.run(f"{configured_application_with_tls}/0", "get-configuration") | ||
| assert task.results["source"] == "disk", task.results | ||
| assert task.results["configuration"].splitlines() == on_disk.splitlines(), task.results | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline