Skip to content

ROSAENG-1331: Add VpcEndpointTemplate MC e2e tests - #463

Open
dustman9000 wants to merge 1 commit into
openshift:mainfrom
dustman9000:avo-mc-e2e
Open

ROSAENG-1331: Add VpcEndpointTemplate MC e2e tests#463
dustman9000 wants to merge 1 commit into
openshift:mainfrom
dustman9000:avo-mc-e2e

Conversation

@dustman9000

@dustman9000 dustman9000 commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

  • Add e2e tests for the VpcEndpointTemplate controller on real Management Clusters
  • Tests create a fake HCP, verify AVO creates a VpcEndpoint from the private-hcp template with correct labels, then verify cleanup when the HCP is deleted
  • Auto-skips on non-MC clusters where the VpcEndpointTemplate CR doesn't exist

This enables the rosa-hcp-mc-e2e Prow job in openshift/release#82850 to actually test AVO's MC-specific controller behavior rather than just CEL validation.

Jira: https://redhat.atlassian.net/browse/ROSAENG-1331

Test plan

Summary by CodeRabbit

  • Tests
    • Added end-to-end coverage for VPC endpoint template lifecycle management.
    • Verifies endpoint creation with expected labels when a hosted control plane is created.
    • Verifies endpoint cleanup when the hosted control plane is deleted.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 4, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 4, 2026

Copy link
Copy Markdown

@dustman9000: This pull request references ROSAENG-1331 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 story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Add e2e tests for the VpcEndpointTemplate controller on real Management Clusters
  • Tests create a fake HCP, verify AVO creates a VpcEndpoint from the private-hcp template with correct labels, then verify cleanup when the HCP is deleted
  • Auto-skips on non-MC clusters where the VpcEndpointTemplate CR doesn't exist

This enables the rosa-hcp-mc-e2e Prow job in openshift/release#82850 to actually test AVO's MC-specific controller behavior rather than just CEL validation.

Jira: https://redhat.atlassian.net/browse/ROSAENG-1331

Test plan

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 requested review from BATMAN-JD and reedcort August 4, 2026 23:46
@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dustman9000

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 45c5c6f5-f286-4a46-908b-077bec0d004e

📥 Commits

Reviewing files that changed from the base of the PR and between 1b26921 and d94498b.

📒 Files selected for processing (1)
  • test/e2e/vpcendpointtemplate_mc_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/e2e/vpcendpointtemplate_mc_test.go

Walkthrough

The PR adds an OSDE2E Ginkgo suite for the VpcEndpointTemplate MC controller. It provisions an AWS HostedControlPlane, verifies VpcEndpoint creation and labels, then verifies cleanup after HostedControlPlane deletion.

Changes

VpcEndpointTemplate MC lifecycle

Layer / File(s) Summary
Test setup and HostedControlPlane construction
test/e2e/vpcendpointtemplate_mc_test.go
The suite registers the HyperShift API scheme, skips when the expected template is absent, and builds AWS HostedControlPlane resources with the required configuration.
VpcEndpoint lifecycle validation
test/e2e/vpcendpointtemplate_mc_test.go
The tests create a HostedControlPlane, verify the templated VpcEndpoint and its labels, then verify VpcEndpoint removal after HostedControlPlane deletion.

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

Suggested labels: lgtm

Suggested reviewers: reedcort, batman-jd

🚥 Pre-merge checks | ✅ 12 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Structure And Quality ⚠️ Warning The tests use suite-level BeforeAll/AfterAll and create resources inside It blocks; several cluster assertions lack failure messages, including HCP lookup/deletion and namespace creation. Use per-test setup/cleanup or register DeferCleanup, wait for cleanup completion, and add diagnostic messages to every cluster-operation assertion.
Microshift Test Compatibility ⚠️ Warning The new untagged tests use HostedControlPlane from hypershift.openshift.io and VpcEndpoint CRs from avo.openshift.io, with no MicroShift label, apigroup tag, or IsMicroShiftCluster guard. MicroShift compatibility notice: add [Skipped:MicroShift] or an appropriate unavailable-API [apigroup:...] tag to the Describe or test names; otherwise verify with the requested MicroShift CI job.
✅ Passed checks (12 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the addition of end-to-end tests for the VpcEndpointTemplate MC controller.
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.
Stable And Deterministic Test Names ✅ Passed All Describe and It titles are literal, descriptive, and static; generated timestamps and resource names appear only in test setup, By steps, and assertions.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The added Ginkgo tests create and delete an HCP and verify VpcEndpoint reconciliation; they do not count nodes, require scheduling across nodes, or test HA behavior.
Topology-Aware Scheduling Compatibility ✅ Passed The PR adds only an e2e test and HCP fixture; it introduces no deployments, workload replicas, affinity, topology spread, node selectors, tolerations, or PDBs.
Ote Binary Stdout Contract ✅ Passed The only output calls in the changed file are GinkgoLogr.Info; no fmt.Print, os.Stdout, log.Print, or klog writes occur in the entrypoint or suite setup.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The added tests use Kubernetes API operations only, contain no IPv4 literals or IP parsing, and use only the cluster-internal kubernetes.default.svc issuer; they do not access public services.
No-Weak-Crypto ✅ Passed The patch adds only an e2e Go test. It imports no crypto packages, uses no weak algorithms, custom crypto, or secret/token comparisons.
Container-Privileges ✅ Passed The PR adds only a Go e2e test. Its diff contains no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, root, or allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed New logs emit generated test names/namespaces, a fixed template type, and VpcEndpoint labels; the HCP pull-secret reference and constructed hostname are not logged.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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

🧹 Nitpick comments (2)
test/e2e/vpcendpointtemplate_mc_test.go (2)

31-31: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add a stable Context node for the lifecycle scenario.

The two It nodes are direct children of Describe. Wrap the VpcEndpoint lifecycle tests in a stable Context, such as Context("when a HostedControlPlane uses the private-hcp template", ...).

As per coding guidelines, **/*_test.go must “use Ginkgo/Gomega with Describe, Context, and It for BDD-style tests.”

🤖 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 `@test/e2e/vpcendpointtemplate_mc_test.go` at line 31, Wrap the lifecycle test
cases inside the top-level Describe block in a stable Context describing the
private-HCP template scenario, such as “when a HostedControlPlane uses the
private-hcp template.” Keep both existing It nodes within that Context and
preserve their test behavior.

Source: Coding guidelines


62-62: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add operation-specific assertion messages.

These assertions do not identify the failed Kubernetes operation. Add messages for Namespace creation, HostedControlPlane retrieval, and HostedControlPlane deletion.

As per coding guidelines, “assertions should include meaningful failure messages.”

Also applies to: 102-104

🤖 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 `@test/e2e/vpcendpointtemplate_mc_test.go` at line 62, Add operation-specific
failure messages to the assertions in the namespace creation and
HostedControlPlane retrieval/deletion flows, including the Expect call around
c.Create(ctx, ns) and the related assertions near the referenced lines. Identify
each Kubernetes operation clearly as Namespace creation, HostedControlPlane
retrieval, or HostedControlPlane deletion while preserving the existing
assertion conditions.

Source: Coding guidelines

🤖 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 `@test/e2e/vpcendpointtemplate_mc_test.go`:
- Around line 63-72: The cleanup registered around the HostedControlPlane and
namespace in the first It must not run before the second ordered spec verifies
VpcEndpoint deletion. Move both cleanup operations to AfterAll (or combine the
checks into one It) and assert or otherwise handle errors returned by c.Delete
instead of discarding them.

---

Nitpick comments:
In `@test/e2e/vpcendpointtemplate_mc_test.go`:
- Line 31: Wrap the lifecycle test cases inside the top-level Describe block in
a stable Context describing the private-HCP template scenario, such as “when a
HostedControlPlane uses the private-hcp template.” Keep both existing It nodes
within that Context and preserve their test behavior.
- Line 62: Add operation-specific failure messages to the assertions in the
namespace creation and HostedControlPlane retrieval/deletion flows, including
the Expect call around c.Create(ctx, ns) and the related assertions near the
referenced lines. Identify each Kubernetes operation clearly as Namespace
creation, HostedControlPlane retrieval, or HostedControlPlane deletion while
preserving the existing assertion conditions.
🪄 Autofix

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 YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: e106477b-ec09-4327-8a26-07987c82c5bb

📥 Commits

Reviewing files that changed from the base of the PR and between 1b26921 and e363f26.

📒 Files selected for processing (1)
  • test/e2e/vpcendpointtemplate_mc_test.go

Comment thread test/e2e/vpcendpointtemplate_mc_test.go Outdated
@codecov-commenter

codecov-commenter commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 45.04%. Comparing base (1b26921) to head (d94498b).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #463   +/-   ##
=======================================
  Coverage   45.04%   45.04%           
=======================================
  Files          32       32           
  Lines        2360     2360           
=======================================
  Hits         1063     1063           
  Misses       1175     1175           
  Partials      122      122           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Test the VpcEndpointTemplate controller on real Management Clusters.
Creates a fake HCP in a test namespace, verifies AVO creates a
VpcEndpoint from the private-hcp template, then verifies cleanup
when the HCP is deleted. Skips on non-MC clusters where the
VpcEndpointTemplate CR does not exist.
@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.

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@dustman9000: all tests passed!

Full PR test history. Your PR dashboard.

Details

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants