Commit 721a3fbc authored by vpitsilis's avatar vpitsilis
Browse files

Adaptations for artefacts & minor fixes

parent c780e71a
Loading
Loading
Loading
Loading
Loading
+32 −3
Original line number Diff line number Diff line
@@ -32,6 +32,9 @@ from sunrise6g_opensdk.edgecloud.adapters.errors import EdgeCloudPlatformError
from sunrise6g_opensdk.edgecloud.adapters.i2edge.client import (
    EdgeApplicationManager as I2EdgeClient,
)
from sunrise6g_opensdk.edgecloud.adapters.aeros.client import (
    EdgeApplicationManager as aerosClient,
)
from sunrise6g_opensdk.edgecloud.core import gsma_schemas
from tests.edgecloud.test_cases import test_cases
from tests.edgecloud.test_config_gsma import CONFIG
@@ -78,6 +81,11 @@ def test_config_gsma_compliance(edgecloud_client):
            patch_payload = config["PATCH_ONBOARDED_APP_GSMA"]
            gsma_schemas.PatchOnboardedAppGSMA(**patch_payload)
        
        # Validate ARTEFACT creation payload is GSMA-compliant
        if "ARTEFACT_PAYLOAD_GSMA" in config:
            artefact_payload = config["ARTEFACT_PAYLOAD_GSMA"]
            gsma_schemas.Artefact(**artefact_payload)

    except Exception as e:
        pytest.fail(f"Configuration is not GSMA-compliant for {edgecloud_client.client_name}: {e}")

@@ -173,6 +181,21 @@ def test_artefact_methods_gsma(edgecloud_client):
            pytest.fail(f"Artefact creation failed: {e}")


@pytest.mark.parametrize("edgecloud_client", test_cases, ids=id_func, indirect=True)
def test_artefact_create_gsma(edgecloud_client):
    config = CONFIG[edgecloud_client.client_name]
    if isinstance(edgecloud_client, aerosClient):
        try:
            response = edgecloud_client.create_artefact_gsma(
                request_body=config["ARTEFACT_PAYLOAD_GSMA"]
            )
            assert response.status_code == 201
        except EdgeCloudPlatformError as e:
            pytest.fail(f"Artefact creation failed: {e}")




@pytest.mark.parametrize("edgecloud_client", test_cases, ids=id_func, indirect=True)
def test_get_artefact_gsma(edgecloud_client):
    config = CONFIG[edgecloud_client.client_name]
@@ -204,7 +227,7 @@ def test_onboard_app_gsma(edgecloud_client):
    try:
        response = edgecloud_client.onboard_app_gsma(config["APP_ONBOARD_MANIFEST_GSMA"])
        assert isinstance(response, Response)
        assert response.status_code == 200
        assert response.status_code == 201

    except EdgeCloudPlatformError as e:
        pytest.fail(f"App onboarding failed: {e}")
@@ -286,7 +309,7 @@ def test_get_all_deployed_apps_gsma(edgecloud_client):

        validated_instances = []
        for instance_data in instances_data:
            validated_instance = gsma_schemas.ZoneIdentifier(**instance_data)
            validated_instance = gsma_schemas.AppInstance(**instance_data)
            validated_instances.append(validated_instance)

    except EdgeCloudPlatformError as e:
@@ -327,6 +350,12 @@ def test_undeploy_app_gsma(edgecloud_client, app_instance_id_gsma):
        pytest.fail(f"App undeployment failed: {e}")


@pytest.mark.parametrize("edgecloud_client", test_cases, ids=id_func, indirect=True)
def test_timer_wait_10_seconds_2(edgecloud_client):
    time.sleep(10)



@pytest.mark.parametrize("edgecloud_client", test_cases, ids=id_func, indirect=True)
def test_patch_onboarded_app_gsma(edgecloud_client):
    config = CONFIG[edgecloud_client.client_name]
@@ -347,7 +376,7 @@ def test_delete_onboarded_app_gsma(edgecloud_client):
        app_id = config["APP_ONBOARD_MANIFEST_GSMA"]["appId"]
        response = edgecloud_client.delete_onboarded_app_gsma(app_id)
        assert isinstance(response, Response)
        assert response.status_code == 200
        assert response.status_code == 204
    except EdgeCloudPlatformError as e:
        pytest.fail(f"App onboarding deletion failed: {e}")