diff --git a/tests/ci/expected-standalone.yaml b/tests/ci/expected-standalone.yaml deleted file mode 100644 index 49d6c67..0000000 --- a/tests/ci/expected-standalone.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -operator: - channel: stable-v1.0 - startingCSV: openstack-operator.v1.0.16 - installPlanApproval: Manual diff --git a/tests/ci/test_standalone.py b/tests/ci/test_standalone.py index dfe5937..51ec41d 100644 --- a/tests/ci/test_standalone.py +++ b/tests/ci/test_standalone.py @@ -21,7 +21,6 @@ PATTERN_API_VERSION = "gitops.hybrid-cloud-patterns.io/v1alpha1" APPLICATION_API_VERSION = "argoproj.io/v1alpha1" -OPERATOR_CORES_API_VERSION = "operators.coreos.com/v1alpha1" OPENSTACK_API_VERSION = "operator.openstack.org/v1beta1" CONTROLPLANE_API_VERSION = "core.openstack.org/v1beta1" DATAPLANE_API_VERSION = "dataplane.openstack.org/v1beta1" @@ -40,7 +39,6 @@ REPOSITORY_ROOT / "values-standalone.yaml", REPOSITORY_ROOT / "overrides" / "values-rhoso-gitops.yaml", ) -EXPECTED_RESOURCES_PATH = Path(__file__).parent / "expected-standalone.yaml" POLL_INTERVAL = float(os.getenv("VP_RHOSO_POLL_INTERVAL", "5")) TEST_TIMEOUT = float(os.getenv("VP_RHOSO_TEST_TIMEOUT", "300")) START_TIME = time.monotonic() @@ -66,11 +64,6 @@ def pattern_configuration() -> dict: } -@pytest.fixture(scope="module") -def expected_resources() -> dict: - return load_yaml(EXPECTED_RESOURCES_PATH) - - @pytest.fixture(scope="module") def rendered_applications() -> dict[str, dict]: command = ["helm", "template", "rhoso-gitops", str(CHART_PATH)] @@ -451,16 +444,14 @@ def check(): ["VP_HUBCONFIG"], indirect=True, ) -def test_operator_subscription( - openshift_dyn_client, - pattern_configuration, - expected_resources, -): +def test_openstack_operator_subscription(openshift_dyn_client, pattern_configuration): + """Check the openstack-operator Subscription is installed, regardless of + its version (channel, startingCSV and installPlanApproval are not + asserted).""" namespace = discover_application_namespace( openshift_dyn_client, pattern_configuration, ) - expected_operator = expected_resources["operator"] def check(): application = get_resource( @@ -479,62 +470,32 @@ def check(): f"{[subscription['name'] for subscription in subscriptions]}" ) subscription_ref = subscriptions[0] - operator = { - "namespace": subscription_ref["namespace"] or "openstack-operators", - "subscription": subscription_ref["name"], - **expected_operator, - } + operator_namespace = subscription_ref["namespace"] or "openstack-operators" subscription = get_resource( openshift_dyn_client, - OPERATOR_CORES_API_VERSION, + "operators.coreos.com/v1alpha1", "Subscription", - operator["namespace"], - operator["subscription"], + operator_namespace, + subscription_ref["name"], ) - context = f"Subscription {operator['namespace']}/{operator['subscription']}" - spec = getattr(subscription, "spec", None) + context = f"Subscription {operator_namespace}/{subscription_ref['name']}" subscription_status = getattr(subscription, "status", None) - assert_field( - getattr(spec, "channel", None), - operator["channel"], - f"{context} spec.channel", - ) - assert_field( - getattr(spec, "startingCSV", None), - operator["startingCSV"], - f"{context} spec.startingCSV", - ) - assert_field( - getattr(spec, "installPlanApproval", None), - operator["installPlanApproval"], - f"{context} spec.installPlanApproval", - ) - assert_field( - getattr(subscription_status, "installedCSV", None), - operator["startingCSV"], - f"{context} status.installedCSV", - ) - assert getattr(subscription_status, "state", None) in { - "AtLatestKnown", - "UpgradePending", - }, f"{context} status.state is not healthy" - installed_csv = getattr(subscription_status, "installedCSV", None) assert installed_csv, f"{context} has no installed ClusterServiceVersion" csv = get_resource( openshift_dyn_client, - OPERATOR_CORES_API_VERSION, + "operators.coreos.com/v1alpha1", "ClusterServiceVersion", - operator["namespace"], + operator_namespace, installed_csv, ) assert_field( getattr(getattr(csv, "status", None), "phase", None), "Succeeded", - f"ClusterServiceVersion {operator['namespace']}/{installed_csv} phase", + f"ClusterServiceVersion {operator_namespace}/{installed_csv} phase", ) - wait_until(check, "Pinned operator installation") + wait_until(check, "OpenStack operator installation") @pytest.mark.parametrize(