Skip to content

OSAC-1123: add CaaS cluster storage E2E test - #138

Merged
openshift-merge-bot[bot] merged 4 commits into
osac-project:mainfrom
akshaynadkarni:feat/OSAC-1123-caas-storage-e2e-v2
Jul 14, 2026
Merged

openshift-merge-bot[bot] merged 4 commits into
osac-project:mainfrom
akshaynadkarni:feat/OSAC-1123-caas-storage-e2e-v2

Conversation

@akshaynadkarni

@akshaynadkarni akshaynadkarni commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

OSAC-1123: Adds an E2E test for the CaaS cluster storage provisioning lifecycle
and increases the shared wait_for_cluster_ready timeout from 30 to 60 minutes.

Why

The VMaaS storage E2E test (#107) covers Stages 1-2 (storage backend and
StorageClass provisioning on the hub). This adds coverage for Stage 3: provisioning
storage on a CaaS cluster via ClusterOrder. The test validates the full lifecycle:
tenant creation, VMaaS storage readiness, ClusterOrder provisioning with tenant
annotation, CaaS storage assertions (finalizer, ClusterStorageReady condition,
Tenant.status.clusterStorage entry), and teardown cleanup.

The timeout increase addresses cluster provisioning on resource-constrained lab
hardware where the network operator can take 30+ minutes to become available after
the worker node joins. All four tests that use wait_for_cluster_ready share the
same provisioning path and benefit from the higher ceiling.

Also fixes an inverted skip-logic bug in the storage conftest that was skipping
storage tests when the controller IS configured.

Testing

  • Ruff lint and format: passed
  • Pre-commit hooks: passed
  • VMaaS storage E2E (test_tenant_storage_lifecycle): passed on edge22 in 168.91s
  • CaaS storage E2E on SE-Lab SNO: tenant onboarding, storage backend, and cluster
    storage AAP jobs all succeeded; cluster reached Ready in ~15 minutes after
    MetalLB network fix; CaaS storage assertions blocked by
    osac-aap#377

Related PRs

Ticket

OSAC-1123


Signed-off-by: akshaynadkarni 25892229+akshaynadkarni@users.noreply.github.com
Assisted-by: Cursor/Claude

Summary by CodeRabbit

  • New Features

    • Added end-to-end validation for CaaS cluster storage provisioning and cleanup.
    • Added checks for cluster readiness, storage finalizers, and tenant storage status.
  • Bug Fixes

    • Improved polling reliability for cluster readiness and storage lifecycle transitions.
    • Enhanced test cleanup and handling of resource deletion scenarios.
  • Tests

    • Added conditional test skipping when required storage configuration or credentials are unavailable.
    • Added reusable test fixtures for cluster templates and access credentials.

@openshift-ci-robot

openshift-ci-robot commented Jun 30, 2026

Copy link
Copy Markdown

@akshaynadkarni: This pull request references OSAC-1123 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

OSAC-1123: Adds an E2E test for the CaaS storage path (Stage 3) of the Storage Controller,
validating the full ClusterOrder storage provisioning and teardown lifecycle.

Why

The VMaaS storage E2E test (PR #107) covers Stages 1-2 (storage backend + StorageClass
provisioning). This PR adds coverage for Stage 3: CaaS cluster storage provisioning via
ClusterOrder. It also fixes an inverted skip-logic bug in the storage conftest that was
skipping storage tests when the controller IS configured.

Testing

  • Ruff lint and format: all checks passed
  • Pre-commit hooks: all passed
  • VMaaS storage E2E (test_tenant_storage_lifecycle): passed on edge22 in 168.91s
  • CaaS test: pending edge22 validation (requires ClusterOrder/HyperShift infrastructure)

Changes

  • tests/storage/test_caas_cluster_storage.py: New test covering Tenant creation,
    VMaaS storage readiness, ClusterOrder provisioning with tenant annotation, CaaS storage
    provisioning (finalizer, ClusterStorageReady condition, Tenant clusterStorage status),
    and teardown cleanup
  • tests/core/k8s_client.py: ClusterOrder condition/finalizer queries, Tenant clusterStorage query
  • tests/core/helpers.py: CaaS wait helpers for ClusterOrder conditions, Tenant clusterStorage entries
  • tests/storage/conftest.py: Fix inverted skip logic + add CaaS skip gate (OSAC_PULL_SECRET_PATH)

Ticket

OSAC-1123


Signed-off-by: akshaynadkarni 25892229+akshaynadkarni@users.noreply.github.com
Assisted-by: Cursor/Claude

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented Jun 30, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@akshaynadkarni

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 3b2932d3-e313-4018-8d40-ce3aa4088255

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Adds CaaS cluster storage polling APIs, environment-backed storage test fixtures, collection skips, and an end-to-end lifecycle test covering provisioning, readiness, finalizers, cleanup, and tenant status.

Changes

CaaS cluster storage lifecycle

Layer / File(s) Summary
Storage observation helpers
tests/core/helpers.py, tests/core/k8s_client.py
Adds queries and polling helpers for ClusterOrder conditions, finalizers, and tenant cluster storage entries; extends ClusterOrder readiness retries.
Test infrastructure and cleanup
tests/storage/conftest.py, tests/core/helpers.py
Adds environment-backed fixtures and conditional collection skips, while restructuring existing forced-cleanup command construction.
CaaS storage lifecycle test
tests/storage/test_caas_cluster_storage.py
Creates Tenant, Namespace, and ClusterOrder resources, verifies storage provisioning, and validates cluster storage removal during teardown.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CaaSTest
  participant OsacCLI
  participant KubernetesAPI
  participant Tenant
  CaaSTest->>KubernetesAPI: create Namespace and Tenant
  CaaSTest->>KubernetesAPI: wait for StorageBackendReady
  CaaSTest->>OsacCLI: create ClusterOrder
  CaaSTest->>KubernetesAPI: annotate ClusterOrder with Tenant reference
  KubernetesAPI->>Tenant: update clusterStorage entry
  CaaSTest->>KubernetesAPI: verify finalizer and ClusterStorageReady
  CaaSTest->>OsacCLI: delete ClusterOrder
  CaaSTest->>KubernetesAPI: verify clusterStorage entry removal
Loading
🚥 Pre-merge checks | ✅ 10 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.23% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a CaaS cluster storage end-to-end test.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No-Hardcoded-Secrets ✅ Passed No hardcoded secrets found in changed files; secret-like values come from env/paths, and regex scans found no literals, tokens, or embedded credentials.
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or non-constant-time secret comparisons found in the touched files.
No-Injection-Vectors ✅ Passed No flagged injection vectors found; subprocess calls use argv lists without shell=True, and no eval/exec/yaml.load/os.system/pickle patterns were added.
Container-Privileges ✅ Passed Reviewed the actual diff: only a timeout tweak and new storage fixtures; no privileged, hostPID/Network/IPC, SYS_ADMIN, or allowPrivilegeEscalation fields appear.
No-Sensitive-Data-In-Logs ✅ Passed No new logging/print statements in touched files; secret lookups are used for detection only and aren’t emitted in logs or errors.
Ai-Attribution ✅ Passed AI use is disclosed via 'Assisted-by: Cursor/Claude' in the commit messages and PR description; no AI-related Co-Authored-By trailer found.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@akshaynadkarni

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/storage/test_caas_cluster_storage.py`:
- Around line 97-103: Ensure the teardown always deletes the created cluster
when wait_for_cluster_order_cr fails: in the finally block, decouple
cli.delete_cluster(uuid=cluster_uuid) from the co_name is not None check, while
retaining the cluster_uuid guard and exception suppression. Only perform
_verify_teardown for the ClusterOrder when co_name is available.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: dea9cd26-34fa-4056-a5fe-ad139b13fdc2

📥 Commits

Reviewing files that changed from the base of the PR and between 60abc99 and 774c206.

📒 Files selected for processing (4)
  • tests/core/helpers.py
  • tests/core/k8s_client.py
  • tests/storage/conftest.py
  • tests/storage/test_caas_cluster_storage.py

Comment thread tests/storage/test_caas_cluster_storage.py
Adds an E2E test for the CaaS storage path (Stage 3) of the Storage
Controller. The test validates the full lifecycle: Tenant creation,
VMaaS storage readiness, ClusterOrder provisioning with tenant
annotation, CaaS storage provisioning (finalizer, ClusterStorageReady
condition, Tenant clusterStorage status), and teardown cleanup.

New k8s_client methods query ClusterOrder conditions, finalizers, and
Tenant clusterStorage status. New wait helpers poll for CaaS-specific
state transitions.

The storage conftest skip logic is fixed (was inverted, skipping tests
when the controller IS configured) and extended to skip CaaS tests
when OSAC_PULL_SECRET_PATH is not set, since CaaS requires HyperShift
cluster provisioning infrastructure.

Signed-off-by: akshaynadkarni <25892229+akshaynadkarni@users.noreply.github.com>
Assisted-by: Cursor/Claude
Signed-off-by: akshaynadkarni <25892229+akshaynadkarni@users.noreply.github.com>
The CaaS E2E test timed out at 30 minutes on the SE-Lab SNO cluster
while waiting for the network operator to become available on the
hosted cluster. The worker node installed and rebooted successfully,
but the network operator needed more time on resource-constrained
lab hardware.

This increases the wait_for_cluster_ready timeout from 30 minutes
(120 retries x 15s) to 60 minutes (240 retries x 15s). All four
tests that use this helper share the same cluster provisioning path,
so the higher timeout benefits all of them.

Signed-off-by: akshaynadkarni <25892229+akshaynadkarni@users.noreply.github.com>
Assisted-by: Cursor/Claude
Signed-off-by: akshaynadkarni <25892229+akshaynadkarni@users.noreply.github.com>
Delete the cluster by UUID in the finally block regardless of
whether the ClusterOrder CR name was resolved. Previously, if
wait_for_cluster_order_cr timed out, co_name stayed None and
cli.delete_cluster was skipped, leaking the cluster.

Signed-off-by: akshaynadkarni <25892229+akshaynadkarni@users.noreply.github.com>
Assisted-by: Cursor/Claude
Signed-off-by: akshaynadkarni <25892229+akshaynadkarni@users.noreply.github.com>
@akshaynadkarni
akshaynadkarni force-pushed the feat/OSAC-1123-caas-storage-e2e-v2 branch from 774c206 to 6e3cf28 Compare July 10, 2026 13:16
@akshaynadkarni
akshaynadkarni marked this pull request as ready for review July 10, 2026 16:08
@openshift-ci
openshift-ci Bot requested review from adriengentil and jhernand July 10, 2026 16:08
@akshaynadkarni

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@akshaynadkarni

Copy link
Copy Markdown
Contributor Author

@coderabbitai resolve

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
✅ Action performed

Comments resolved and changes approved.

@wgordon17 wgordon17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise looks good 👍

def test_caas_cluster_storage_lifecycle(
k8s_hub_client: K8sClient,
cli: OsacCLI,
storage_config_namespace: str,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable/fixture

Comment thread tests/core/helpers.py Outdated
Comment on lines +484 to +491
cond_status = k8s.get_cluster_order_condition_status(
name=name, condition_type=condition_type, checked=False
)
if cond_status != expected_status:
raise AssertionError(
f"ClusterOrder {name} entered Failed phase before {condition_type}={expected_status}"
)
return k8s.get_cluster_order_condition_status(name=name, condition_type=condition_type, checked=False)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why run get_cluster_order_condition_status twice, as opposed to running it once before the if phase statement and then returning the cached result

Comment on lines +85 to +89
k8s_hub_client.patch(
resource="clusterorder",
name=co_name,
patch=json.dumps({"metadata": {"annotations": {"osac.openshift.io/tenant": tenant_name}}}),
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- Remove unused storage_config_namespace fixture parameter
- Assert patch return code when annotating ClusterOrder with tenant
- Cache condition status to avoid redundant API call in
  wait_for_cluster_order_condition

Signed-off-by: akshaynadkarni <25892229+akshaynadkarni@users.noreply.github.com>
Assisted-by: Cursor/Claude
Signed-off-by: akshaynadkarni <25892229+akshaynadkarni@users.noreply.github.com>
@akshaynadkarni

Copy link
Copy Markdown
Contributor Author

/retest

@github-actions

Copy link
Copy Markdown

Re-triggered failed runs:

  • E2E VMaaS Full Install (#29283919223)

@akshaynadkarni

Copy link
Copy Markdown
Contributor Author

@wgordon17 I have addressed your comments. PTAL.

@openshift-ci

openshift-ci Bot commented Jul 14, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akshaynadkarni, zszabo-rh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the lgtm label Jul 14, 2026
@openshift-merge-bot
openshift-merge-bot Bot merged commit 13bf91e into osac-project:main Jul 14, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants