Skip to content

OSAC-1330: Update E2E tests for typed resource references - #296

Merged
CrystalChun merged 1 commit into
osac-project:mainfrom
htayrie-rh:feat/OSAC-1330-typed-resource-refs
Aug 5, 2026
Merged

CrystalChun merged 1 commit into
osac-project:mainfrom
htayrie-rh:feat/OSAC-1330-typed-resource-refs

Conversation

@htayrie-rh

@htayrie-rh htayrie-rh commented Aug 2, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Updates all gRPC client calls and test fixtures to use typed reference objects ({"id": value} / {"name": value}) instead of raw strings
  • Updates default template and network class names from underscore format to hyphenated (e.g., osac.templates.ocp_virt_vm → ocp-virt-vm)
  • Updates test assertions to access nested reference fields (e.g., obj["template"] → obj["template"]["name"])

Test plan

  • CI checks (pre-commit, linting)
  • E2E tests pass against a fulfillment-service with typed references deployed

Related

Assisted-by: Claude Code noreply@anthropic.com

Summary by CodeRabbit

  • Compatibility

    • Updated default template and network class identifiers to use the current naming format.
    • Updated resource references to match the latest nested API representation for templates, networks, pools, and related resources.
  • Documentation

    • Revised documented default configuration values to reflect current identifiers.
  • Tests

    • Updated lifecycle, provisioning, authentication, storage, and cleanup coverage to validate current API responses and request formats.

@openshift-ci-robot

openshift-ci-robot commented Aug 2, 2026 •

Copy link
Copy Markdown

@htayrie-rh: This pull request references OSAC-1330 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 feature to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Updates all gRPC client calls and test fixtures to use typed reference objects ({"id": value} / {"name": value}) instead of raw strings
  • Updates default template and network class names from underscore format to hyphenated (e.g., osac.templates.ocp_virt_vm → ocp-virt-vm)
  • Updates test assertions to access nested reference fields (e.g., obj["template"] → obj["template"]["name"])

Test plan

  • CI checks (pre-commit, linting)
  • E2E tests pass against a fulfillment-service with typed references deployed

Related

Assisted-by: Claude Code noreply@anthropic.com

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.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ba01a7a-82ca-4804-b334-e97f6a926b1b

📥 Commits

Reviewing files that changed from the base of the PR and between 173dc24 and 783daf1.

📒 Files selected for processing (13)
  • .github/workflows/e2e-bmaas-full-install.yml
  • AGENTS.md
  • CLAUDE.md
  • tests/bmaas/conftest.py
  • tests/caas/conftest.py
  • tests/catalog/conftest.py
  • tests/catalog/test_catalog_item_lifecycle.py
  • tests/catalog/test_compute_instance_catalog_item_lifecycle.py
  • tests/core/grpc_client.py
  • tests/storage/conftest.py
  • tests/vmaas/conftest.py
  • tests/vmaas/external_ip/conftest.py
  • tests/vmaas/test_jwt_auth_smoke.py
🚧 Files skipped from review as they are similar to previous changes (12)
  • .github/workflows/e2e-bmaas-full-install.yml
  • AGENTS.md
  • tests/bmaas/conftest.py
  • tests/storage/conftest.py
  • tests/vmaas/external_ip/conftest.py
  • tests/catalog/test_catalog_item_lifecycle.py
  • CLAUDE.md
  • tests/vmaas/test_jwt_auth_smoke.py
  • tests/vmaas/conftest.py
  • tests/catalog/conftest.py
  • tests/caas/conftest.py
  • tests/catalog/test_compute_instance_catalog_item_lifecycle.py

Walkthrough

The pull request updates template and network identifiers, changes resource references to nested API objects, and adjusts lifecycle tests and external-IP cleanup for the new representations.

Changes

Resource reference alignment

Layer / File(s) Summary
Template and network identifier defaults
.github/workflows/*, AGENTS.md, CLAUDE.md, tests/*/conftest.py, tests/vmaas/test_jwt_auth_smoke.py
Replaces legacy template and network class defaults with current identifiers across workflows, documentation, fixtures, and smoke tests.
Nested resource request references
tests/catalog/conftest.py, tests/core/grpc_client.py
Represents templates, networks, subnets, pools, external IPs, compute instances, and catalog items as nested resource references.
Lifecycle and cleanup validation
tests/catalog/test_*lifecycle.py, tests/vmaas/external_ip/conftest.py
Updates lifecycle assertions and creation requests for nested references. Cleanup extracts nested pool and external IP identifiers before matching resources.

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

Possibly related PRs

Suggested labels: lgtm, approved

Suggested reviewers: ygalblum, eliorerz

🚥 Pre-merge checks | ✅ 10 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.57% 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 directly matches the main changeset: updating E2E tests and gRPC client calls to use typed resource references instead of raw strings.
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 The PR adds only template names, network references, IDs, and test CIDRs; no credential assignments, private-key material, encoded blobs, or credential-bearing URLs appear in added lines.
No-Weak-Crypto ✅ Passed The PR adds no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret-comparison code; changes only typed references and template/network identifiers.
No-Injection-Vectors ✅ Passed No injection vectors detected. All data is safely serialized via json.dumps and passed to subprocess as list arguments. Template/network class strings are hardcoded constants.
Container-Privileges ✅ Passed The PR contains test fixtures, test code, and documentation updates only. No Kubernetes manifests, container specs, or container security configurations with privileged settings exist in this PR.
No-Sensitive-Data-In-Logs ✅ Passed No sensitive data logging introduced. PR only wraps gRPC payloads in typed objects; all logging is non-sensitive infrastructure errors and resource IDs.
Ai-Attribution ✅ Passed AI use is disclosed with an Assisted-by: Claude Code trailer in the HEAD commit and PR description; no AI Co-Authored-By trailer is present.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 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.

@htayrie-rh
htayrie-rh marked this pull request as draft August 2, 2026 09:45

@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/vmaas/test_jwt_auth_smoke.py`:
- Line 77: Add the network_class: str fixture parameter to all three smoke tests
and replace each hardcoded "cudn-net" argument in create_virtual_network calls
with the injected network_class value, preserving the fixture-driven
OSAC_NETWORK_CLASS behavior.
🪄 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: Pro Plus

Run ID: 204d85ca-0214-4b2f-bc1a-04a76ed69173

📥 Commits

Reviewing files that changed from the base of the PR and between f71aabe and 6888f9b.

📒 Files selected for processing (13)
  • .github/workflows/e2e-bmaas-full-install.yml
  • AGENTS.md
  • CLAUDE.md
  • tests/bmaas/conftest.py
  • tests/caas/conftest.py
  • tests/catalog/conftest.py
  • tests/catalog/test_catalog_item_lifecycle.py
  • tests/catalog/test_compute_instance_catalog_item_lifecycle.py
  • tests/core/grpc_client.py
  • tests/storage/conftest.py
  • tests/vmaas/conftest.py
  • tests/vmaas/external_ip/conftest.py
  • tests/vmaas/test_jwt_auth_smoke.py

vn_name: str = f"jwt-smoke-{uuid4().hex[:8]}"
vn_id: str = jwt_grpc_tenant1.create_virtual_network(
name=vn_name, network_class="cudn_net", ipv4_cidr="10.200.0.0/16"
name=vn_name, network_class="cudn-net", ipv4_cidr="10.200.0.0/16"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use the network_class fixture in all three smoke tests.

The network_class fixture in tests/vmaas/conftest.py reads OSAC_NETWORK_CLASS, but these calls pass "cudn-net" directly. A valid deployment with another network class will fail because the override is ignored. Add network_class: str to each test and pass it to create_virtual_network.

Proposed fix
-def test_jwt_virtual_network_lifecycle(jwt_grpc_tenant1: GRPCClient) -> None:
+def test_jwt_virtual_network_lifecycle(
+    jwt_grpc_tenant1: GRPCClient, network_class: str
+) -> None:
...
-        name=vn_name, network_class="cudn-net", ipv4_cidr="10.200.0.0/16"
+        name=vn_name, network_class=network_class, ipv4_cidr="10.200.0.0/16"

-def test_jwt_security_group_lifecycle(jwt_grpc_tenant1: GRPCClient) -> None:
+def test_jwt_security_group_lifecycle(
+    jwt_grpc_tenant1: GRPCClient, network_class: str
+) -> None:
...
-        name=vn_name, network_class="cudn-net", ipv4_cidr="10.202.0.0/16"
+        name=vn_name, network_class=network_class, ipv4_cidr="10.202.0.0/16"

-def test_jwt_tenant_isolation(jwt_grpc_tenant1: GRPCClient, jwt_grpc_tenant2: GRPCClient) -> None:
+def test_jwt_tenant_isolation(
+    jwt_grpc_tenant1: GRPCClient, jwt_grpc_tenant2: GRPCClient, network_class: str
+) -> None:
...
-        name=vn_name, network_class="cudn-net", ipv4_cidr="10.201.0.0/16"
+        name=vn_name, network_class=network_class, ipv4_cidr="10.201.0.0/16"

Based on learnings, configure environment-dependent behavior through documented environment variables so local development and CI behave consistently.

Also applies to: 90-90, 115-115

🤖 Prompt for 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.

In `@tests/vmaas/test_jwt_auth_smoke.py` at line 77, Add the network_class: str
fixture parameter to all three smoke tests and replace each hardcoded "cudn-net"
argument in create_virtual_network calls with the injected network_class value,
preserving the fixture-driven OSAC_NETWORK_CLASS behavior.

Source: Learnings

Update all gRPC client calls and test fixtures to use typed reference
objects (e.g., {"id": value} or {"name": value}) instead of raw strings,
matching the fulfillment-service API changes for type-safe resource
references.

- Update grpc_client.py to pass typed reference dicts for subnet,
  virtual_network, pool, external_ip, compute_instance, catalog_item,
  and template fields
- Update default template/network_class values from underscore to
  hyphenated names (e.g., osac.templates.ocp_virt_vm → ocp-virt-vm)
- Update test assertions to access nested reference fields
- Update AGENTS.md and CLAUDE.md documentation

Depends on osac-project/osac#85

Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Haim Tayrie <htayrie@htayrie-thinkpadt14gen5.raanaii.csb>
@danielerez

Copy link
Copy Markdown
Contributor

Looks good. Depends on: osac-project/osac#85

@htayrie-rh
htayrie-rh marked this pull request as ready for review August 5, 2026 16:14
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@danielerez

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm label Aug 5, 2026
@danielerez

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: danielerez, htayrie-rh
Once this PR has been reviewed and has the lgtm label, please assign jhernand for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@CrystalChun
CrystalChun merged commit 07597d4 into osac-project:main Aug 5, 2026
7 of 11 checks passed
CrystalChun pushed a commit that referenced this pull request Aug 5, 2026
…use metadata.name (#321)

PR #296 updated the test code to use typed references but missed the
workflow input defaults. The vm-template default was still
osac.templates.ocp_virt_vm (template id format) instead of ocp-virt-vm
(metadata.name). Same for cluster-template in CaaS.

The typed reference validation looks up templates by name, so passing the
old id format causes "ComputeInstanceTemplate not found" errors.

Assisted-by: Claude Code <noreply@anthropic.com>

Signed-off-by: Haim Tayrie <htayrie@htayrie-thinkpadt14gen5.raanaii.csb>
Co-authored-by: Haim Tayrie <htayrie@htayrie-thinkpadt14gen5.raanaii.csb>

This branch had an error being deployed

1 failed deployment
e2e-test — 783daf13 Deployed Aug 5, 2026 by htayrie-rh via e2e-vmaas-full-install / e2e #863
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