Commit c81a8b73 authored by Konstantinos Togias's avatar Konstantinos Togias
Browse files

test: qualify Helm applications with the shared lifecycle scenario

parent 6e7c6289
Loading
Loading
Loading
Loading
Loading
+13 −0
Changes for .gitlab-ci.yml: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -190,6 +190,19 @@ platform-lab:
        - .cache/platform-lab/wrapper-junit.xml
    expire_in: 1 week

# Same lab and lifecycle, using a chart archive instead of a container manifest.
platform-lab-helm:
  extends: platform-lab
  variables:
    OOP_LAB_PACKAGE_TYPE: HELM
  rules:
    - if: '$CI_COMMIT_BRANCH == "test/platform-application-checkpoints" || $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "test/platform-application-checkpoints"'
      variables:
        OOP_LAB_PROFILE: ci/lab/profile.release-2.0.json
        OOP_LAB_REFRESH_CANDIDATE: "1"
    - if: '$RUN_PLATFORM_HELM_LAB == "1" && $CI_COMMIT_REF_PROTECTED == "true"'
    - when: never

# Explicit live mode leaves all default component tests and deployment jobs alone.
sdk-live-acceptance:
  stage: test
+18 −0
Changes for ansible/tests/r2_e2e/app_manifest.py: 18 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -32,3 +32,21 @@ def container_manifest(image="nginx:1.27-alpine", *, app_id=None, name=None, cpu
            {"interfaceId": "http", "protocol": "TCP", "port": 80,
             "visibilityType": "VISIBILITY_EXTERNAL"}]}],
    }


def application_manifest(profile, **identity):
    """One public manifest shape; Helm points to its chart instead of an image."""
    manifest = container_manifest(profile["application_image"],
                                  **validated_resource_requests(profile), **identity)
    kind = profile.get("package_type", "CONTAINER")
    if kind == "HELM":
        from urllib.parse import urlparse

        url = profile.get("chart_url", "")
        if urlparse(url).scheme not in ("http", "https") or not urlparse(url).hostname:
            raise ValueError("Helm acceptance requires the fixture chart URL")
        manifest["packageType"] = kind
        manifest["appRepo"]["imagePath"] = url
    elif kind != "CONTAINER":
        raise ValueError("Acceptance supports CONTAINER and HELM")
    return manifest
+4 −0
Changes for ansible/tests/r2_e2e/checkpoints.py: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ PHASES = (


def selected_phases(checkpoint):
    if checkpoint == "helm-terminated":
        return tuple(row for row in PHASES if row[0] != "resources")
    names = [key for key, _, _ in PHASES]
    if checkpoint not in names:
        raise ValueError("Unknown platform checkpoint")
@@ -62,3 +64,5 @@ CHECKPOINTS = {
    key: {node.split("::", 1)[1] for node in selected_nodes(key)}
    for key, _, _ in PHASES
}

CHECKPOINTS["helm-terminated"] = {node.split("::", 1)[1] for node in selected_nodes("helm-terminated")}
+5 −5
Changes for ansible/tests/r2_e2e/sdk_scenario.py: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ import time
from urllib.parse import urlparse
from uuid import uuid4

from app_manifest import container_manifest, validated_resource_requests
from app_manifest import application_manifest, validated_resource_requests


def load_profile(path, checkpoint):
@@ -48,6 +48,9 @@ def load_profile(path, checkpoint):
        validate_profile(profile)
        return profile
    validated_resource_requests(profile)
    if (checkpoint == "helm-terminated") != (profile.get("package_type", "CONTAINER") == "HELM"):
        raise ValueError("Helm packaging requires the helm-terminated checkpoint")
    application_manifest(profile)
    if checkpoint == "ti":
        ti = profile["ti"]
        if ti["application_wide_supported"] is not True:
@@ -295,10 +298,7 @@ class Scenario:
        assert len(active) == 1, "The dedicated lab must select one unambiguous active zone"
        self.zone_id = active[0]["edgeCloudZoneId"]
        self.evidence.update(app_id=self.app_id, zone_id=self.zone_id, last_verified_phase="zone_selected")
        manifest = container_manifest(
            self.profile["application_image"], app_id=self.app_id, name=self.name,
            **validated_resource_requests(self.profile)
        )
        manifest = application_manifest(self.profile, app_id=self.app_id, name=self.name)
        self.evidence["requested_resources"] = manifest["requiredResources"]["applicationResources"]["cpuPool"]
        # A unique caller-supplied ID permits bounded cleanup after a lost response.
        self.registered = True
+5 −3
Changes for ansible/tests/r2_e2e/test_apps.py: 5 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
import pytest
import requests

from app_manifest import container_manifest
from app_manifest import application_manifest, container_manifest
from conftest import http

APPS = "/edge-application-management/v0.1alpha1/apps"
@@ -23,14 +23,16 @@ def _delete_app(op, url, token, allow_absent=True):


@pytest.fixture
def registered_app(operators, callers):
def registered_app(operators, callers, request):
    """Keep teardown active even when a later operator's registration fails."""
    assert operators, "onboarding requires at least one operator"
    apps, attempted = {}, []
    original = None
    try:
        for op in operators:
            manifest = container_manifest(getattr(op, "application_image", "nginx:1.27-alpine"))
            profile = getattr(request.config, "sdk_profile", None)
            manifest = (application_manifest(profile) if profile else
                        container_manifest(getattr(op, "application_image", "nginx:1.27-alpine")))
            url = f"{op.oeg_url}{APPS}/{manifest['appId']}"
            attempted.append((op, url))
            r = http("POST", op.oeg_url + APPS, callers[op.host]["provider"], json=manifest)
Loading