Loading tests/conformance/test_eam_conformance.py +41 −1 Changes for tests/conformance/test_eam_conformance.py: 41 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,10 +8,16 @@ northbound interface diverges from CAMARA. from pathlib import Path from typing import TYPE_CHECKING from uuid import uuid4 import pytest import schemathesis import yaml from fastapi.testclient import TestClient from open_exposure_gateway.api.camara.edge_application_management.v0_1_0_alpha_1.router import ( BASE_PATH, ) from tests.conformance.harness import app if TYPE_CHECKING: Loading @@ -31,7 +37,25 @@ SPEC = ( / "edge-application-management-0.1.0-alpha.1.yaml" ) schema = schemathesis.openapi.from_path(SPEC) STUBBED = { ("PATCH", "/deployments/{appDeploymentId}"), ("GET", "/clusters"), } # componentSpec x networkInterfaces allows 100x100 items, so generated AppManifest bodies # routinely overrun Hypothesis's size budget and POST /apps fails its filter_too_much # health check. Capping both arrays in memory (the vendored spec is untouched) keeps the # health check enabled; 5 was already reliable, 3 leaves margin. raw_spec = yaml.safe_load(SPEC.read_text()) component_spec = raw_spec["components"]["schemas"]["AppManifest"]["properties"]["componentSpec"] component_spec["maxItems"] = 3 component_spec["items"]["properties"]["networkInterfaces"]["maxItems"] = 3 schema = ( schemathesis.openapi.from_dict(raw_spec) .exclude(method="PATCH", path="/deployments/{appDeploymentId}") .exclude(method="GET", path="/clusters") ) schema.app = app schema.config.generation.update(max_examples=10, no_shrink=True) # 501 is spec-documented, not a crash; not_a_server_error flags all 5xx. Loading @@ -50,3 +74,19 @@ schema.config.checks.positive_data_acceptance.expected_statuses = [ @schema.parametrize() def test_eam_conformance(case: "OpenApiCase") -> None: case.call_and_validate() def test_stubbed_operations_still_return_501() -> None: """Guards the STUBBED exclusion above. Implement either operation -- or change what it returns -- and this fails, forcing the exclusion to be revisited.""" client = TestClient(app) statuses = { ("PATCH", "/deployments/{appDeploymentId}"): client.patch( f"{BASE_PATH}/deployments/{uuid4()}", content=b'{"appDeploymentName": "x"}', headers={"Content-Type": "application/merge-patch+json"}, ).status_code, ("GET", "/clusters"): client.get(f"{BASE_PATH}/clusters").status_code, } assert set(statuses) == STUBBED assert statuses == dict.fromkeys(STUBBED, 501) tests/conformance/test_qod_conformance.py +30 −1 Changes for tests/conformance/test_qod_conformance.py: 30 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,10 +8,13 @@ northbound interface diverges from CAMARA. from pathlib import Path from typing import TYPE_CHECKING from uuid import uuid4 import pytest import schemathesis from fastapi.testclient import TestClient from open_exposure_gateway.api.camara.quality_on_demand.v1_1_0.router import BASE_PATH from tests.conformance.harness import app if TYPE_CHECKING: Loading @@ -30,7 +33,16 @@ SPEC = ( / "qod-api.yaml" ) schema = schemathesis.openapi.from_path(SPEC) STUBBED = { ("POST", "/sessions/{sessionId}/extend"), ("POST", "/retrieve-sessions"), } schema = ( schemathesis.openapi.from_path(SPEC) .exclude(method="POST", path="/sessions/{sessionId}/extend") .exclude(method="POST", path="/retrieve-sessions") ) schema.app = app schema.config.generation.update(max_examples=10, no_shrink=True) # ApplicationServer accepts empty ipv4/ipv6 strings at the schema level; our Loading @@ -38,9 +50,26 @@ schema.config.generation.update(max_examples=10, no_shrink=True) schema.config.checks.positive_data_acceptance.expected_statuses = [ *schema.config.checks.positive_data_acceptance.expected_statuses, "400", "422", ] @schema.parametrize() def test_qod_conformance(case: "OpenApiCase") -> None: case.call_and_validate() def test_stubbed_operations_still_return_501() -> None: client = TestClient(app) statuses = { ("POST", "/sessions/{sessionId}/extend"): client.post( f"{BASE_PATH}/sessions/{uuid4()}/extend", json={"requestedAdditionalDuration": 60}, ).status_code, ("POST", "/retrieve-sessions"): client.post( f"{BASE_PATH}/retrieve-sessions", json={"device": {"phoneNumber": "+123456789"}}, ).status_code, } assert set(statuses) == STUBBED assert statuses == dict.fromkeys(STUBBED, 501) Loading
tests/conformance/test_eam_conformance.py +41 −1 Changes for tests/conformance/test_eam_conformance.py: 41 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,10 +8,16 @@ northbound interface diverges from CAMARA. from pathlib import Path from typing import TYPE_CHECKING from uuid import uuid4 import pytest import schemathesis import yaml from fastapi.testclient import TestClient from open_exposure_gateway.api.camara.edge_application_management.v0_1_0_alpha_1.router import ( BASE_PATH, ) from tests.conformance.harness import app if TYPE_CHECKING: Loading @@ -31,7 +37,25 @@ SPEC = ( / "edge-application-management-0.1.0-alpha.1.yaml" ) schema = schemathesis.openapi.from_path(SPEC) STUBBED = { ("PATCH", "/deployments/{appDeploymentId}"), ("GET", "/clusters"), } # componentSpec x networkInterfaces allows 100x100 items, so generated AppManifest bodies # routinely overrun Hypothesis's size budget and POST /apps fails its filter_too_much # health check. Capping both arrays in memory (the vendored spec is untouched) keeps the # health check enabled; 5 was already reliable, 3 leaves margin. raw_spec = yaml.safe_load(SPEC.read_text()) component_spec = raw_spec["components"]["schemas"]["AppManifest"]["properties"]["componentSpec"] component_spec["maxItems"] = 3 component_spec["items"]["properties"]["networkInterfaces"]["maxItems"] = 3 schema = ( schemathesis.openapi.from_dict(raw_spec) .exclude(method="PATCH", path="/deployments/{appDeploymentId}") .exclude(method="GET", path="/clusters") ) schema.app = app schema.config.generation.update(max_examples=10, no_shrink=True) # 501 is spec-documented, not a crash; not_a_server_error flags all 5xx. Loading @@ -50,3 +74,19 @@ schema.config.checks.positive_data_acceptance.expected_statuses = [ @schema.parametrize() def test_eam_conformance(case: "OpenApiCase") -> None: case.call_and_validate() def test_stubbed_operations_still_return_501() -> None: """Guards the STUBBED exclusion above. Implement either operation -- or change what it returns -- and this fails, forcing the exclusion to be revisited.""" client = TestClient(app) statuses = { ("PATCH", "/deployments/{appDeploymentId}"): client.patch( f"{BASE_PATH}/deployments/{uuid4()}", content=b'{"appDeploymentName": "x"}', headers={"Content-Type": "application/merge-patch+json"}, ).status_code, ("GET", "/clusters"): client.get(f"{BASE_PATH}/clusters").status_code, } assert set(statuses) == STUBBED assert statuses == dict.fromkeys(STUBBED, 501)
tests/conformance/test_qod_conformance.py +30 −1 Changes for tests/conformance/test_qod_conformance.py: 30 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,10 +8,13 @@ northbound interface diverges from CAMARA. from pathlib import Path from typing import TYPE_CHECKING from uuid import uuid4 import pytest import schemathesis from fastapi.testclient import TestClient from open_exposure_gateway.api.camara.quality_on_demand.v1_1_0.router import BASE_PATH from tests.conformance.harness import app if TYPE_CHECKING: Loading @@ -30,7 +33,16 @@ SPEC = ( / "qod-api.yaml" ) schema = schemathesis.openapi.from_path(SPEC) STUBBED = { ("POST", "/sessions/{sessionId}/extend"), ("POST", "/retrieve-sessions"), } schema = ( schemathesis.openapi.from_path(SPEC) .exclude(method="POST", path="/sessions/{sessionId}/extend") .exclude(method="POST", path="/retrieve-sessions") ) schema.app = app schema.config.generation.update(max_examples=10, no_shrink=True) # ApplicationServer accepts empty ipv4/ipv6 strings at the schema level; our Loading @@ -38,9 +50,26 @@ schema.config.generation.update(max_examples=10, no_shrink=True) schema.config.checks.positive_data_acceptance.expected_statuses = [ *schema.config.checks.positive_data_acceptance.expected_statuses, "400", "422", ] @schema.parametrize() def test_qod_conformance(case: "OpenApiCase") -> None: case.call_and_validate() def test_stubbed_operations_still_return_501() -> None: client = TestClient(app) statuses = { ("POST", "/sessions/{sessionId}/extend"): client.post( f"{BASE_PATH}/sessions/{uuid4()}/extend", json={"requestedAdditionalDuration": 60}, ).status_code, ("POST", "/retrieve-sessions"): client.post( f"{BASE_PATH}/retrieve-sessions", json={"device": {"phoneNumber": "+123456789"}}, ).status_code, } assert set(statuses) == STUBBED assert statuses == dict.fromkeys(STUBBED, 501)