Merge ~alemar99/maas-ci/+git/system-tests:openapi_system_test into ~maas-committers/maas-ci/+git/system-tests:master

Proposed by Alessandro Marcolini
Status: Merged
Approved by: Alessandro Marcolini
Approved revision: 7329088c3ad3bb7baefb820944c00e3c9f7c4716
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~alemar99/maas-ci/+git/system-tests:openapi_system_test
Merge into: ~maas-committers/maas-ci/+git/system-tests:master
Diff against target: 23 lines (+17/-0)
1 file modified
systemtests/general_tests/test_openapi.py (+17/-0)
Reviewer Review Type Date Requested Status
Jacopo Rota Approve
MAAS Lander Approve
Review via email: mp+467341@code.launchpad.net

Commit message

feat: verify openapi spec is in sync with nginx proxy rules

Description of the change

Mimic the test in src/tests/maasapiserver/test_main.py to ensure there is consistency with nginx proxy rules.

To post a comment you must log in.
Revision history for this message
Jacopo Rota (r00ta) :
7329088... by Alessandro Marcolini

refactor: assert that client url ends with "MAAS/"

Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b openapi_system_test lp:~alemar99/maas-ci/+git/system-tests into -b master lp:~maas-committers/maas-ci/+git/system-tests

STATUS: SUCCESS
COMMIT: b68d63faf691a5794dc642255bb1a5d0117a26c2

review: Approve
Revision history for this message
Alessandro Marcolini (alemar99) :
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b openapi_system_test lp:~alemar99/maas-ci/+git/system-tests into -b master lp:~maas-committers/maas-ci/+git/system-tests

STATUS: SUCCESS
COMMIT: 7329088c3ad3bb7baefb820944c00e3c9f7c4716

review: Approve
Revision history for this message
Jacopo Rota (r00ta) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/systemtests/general_tests/test_openapi.py b/systemtests/general_tests/test_openapi.py
2new file mode 100644
3index 0000000..1d7644f
4--- /dev/null
5+++ b/systemtests/general_tests/test_openapi.py
6@@ -0,0 +1,17 @@
7+import json
8+
9+from systemtests.api import UnauthenticatedMAASAPIClient
10+
11+
12+def test_openapi_proxy(
13+ unauthenticated_maas_api_client: UnauthenticatedMAASAPIClient,
14+) -> None:
15+ assert unauthenticated_maas_api_client.url.endswith("MAAS/")
16+ openapi = unauthenticated_maas_api_client.execute(
17+ [f"{unauthenticated_maas_api_client.url}/a/openapi.json"],
18+ base_cmd=["curl", "-s", "-k"],
19+ )
20+ openapi_json = json.loads(openapi)
21+ for path, specs in openapi_json["paths"].items():
22+ assert path.startswith("/MAAS/a")
23+ assert specs is not None

Subscribers

People subscribed via source and target branches