Commit 2f037fa0 authored by Adrian Pino's avatar Adrian Pino Committed by GitHub
Browse files

Merge pull request #82 from SunriseOpenOperatorPlatform/feature/edgecloud-fix-e2e-test

Fix issue in e2e test. Add timer test before undeploy.
parents ac1b441f c4b12f60
Loading
Loading
Loading
Loading
+22 −10
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ Key features:
- Uses shared test constants and CAMARA-compliant manifests
- Includes i2edge-specific tests where needed
"""
import time

import pytest

from src.common.sdk import Sdk as sdkclient
@@ -91,7 +93,7 @@ def test_get_edge_cloud_zones_details(edgecloud_client, zone_id=ZONE_ID):


@pytest.mark.parametrize("edgecloud_client", test_cases, ids=id_func, indirect=True)
def test_create_artefact_success(edgecloud_client):
def test_create_artefact(edgecloud_client):
    if isinstance(edgecloud_client, I2EdgeClient):
        try:
            edgecloud_client._create_artefact(
@@ -109,27 +111,37 @@ def test_create_artefact_success(edgecloud_client):


@pytest.mark.parametrize("edgecloud_client", test_cases, ids=id_func, indirect=True)
def test_onboard_app_success(edgecloud_client):
def test_onboard_app(edgecloud_client):
    try:
        edgecloud_client.onboard_app(APP_ONBOARD_MANIFEST)
    except EdgeCloudPlatformError as e:
        pytest.fail(f"App onboarding failed unexpectedly: {e}")


@pytest.fixture(scope="module", name="app_instance_id")
def test_deploy_app(edgecloud_client):
@pytest.fixture(scope="module")
def app_instance_id(edgecloud_client):
    try:
        output = edgecloud_client.deploy_app(APP_ID, APP_ZONES)
        deployed_app = {"appInstanceId": output["deploy_name"]}
        assert "appInstanceId" in deployed_app
        assert deployed_app["appInstanceId"] is not None
        return deployed_app["appInstanceId"]
    except EdgeCloudPlatformError as e:
        pytest.fail(f"App deployment failed unexpectedly: {e}")
        yield deployed_app["appInstanceId"]
    finally:
        pass


@pytest.mark.parametrize("edgecloud_client", test_cases, ids=id_func, indirect=True)
def test_deploy_app(app_instance_id):
    assert app_instance_id is not None


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


@pytest.mark.parametrize("edgecloud_client", test_cases, ids=id_func, indirect=True)
def test_undeploy_app_success(edgecloud_client, app_instance_id):
def test_undeploy_app(edgecloud_client, app_instance_id):
    try:
        edgecloud_client.undeploy_app(app_instance_id)
    except EdgeCloudPlatformError as e:
@@ -137,7 +149,7 @@ def test_undeploy_app_success(edgecloud_client, app_instance_id):


@pytest.mark.parametrize("edgecloud_client", test_cases, ids=id_func, indirect=True)
def test_delete_onboarded_app_success(edgecloud_client):
def test_delete_onboarded_app(edgecloud_client):
    try:
        edgecloud_client.delete_onboarded_app(app_id=APP_ONBOARD_MANIFEST["appId"])
    except EdgeCloudPlatformError as e:
@@ -145,7 +157,7 @@ def test_delete_onboarded_app_success(edgecloud_client):


@pytest.mark.parametrize("edgecloud_client", test_cases, ids=id_func, indirect=True)
def test_delete_artefact_success(edgecloud_client):
def test_delete_artefact(edgecloud_client):
    if isinstance(edgecloud_client, I2EdgeClient):
        try:
            edgecloud_client._delete_artefact(artefact_id=ARTEFACT_ID)