Skip to content

CORENET-7206: OTE: add OpenShift Tests Extension framework infrastructure#303

Open
anuragthehatter wants to merge 1 commit into
openshift:mainfrom
anuragthehatter:ote-framework-setup
Open

CORENET-7206: OTE: add OpenShift Tests Extension framework infrastructure#303
anuragthehatter wants to merge 1 commit into
openshift:mainfrom
anuragthehatter:ote-framework-setup

Conversation

@anuragthehatter
Copy link
Copy Markdown

@anuragthehatter anuragthehatter commented May 28, 2026

Summary

  • Add OTE (OpenShift Tests Extension) framework infrastructure for multus-cni
  • No test cases migrated yet — this is the scaffolding commit only
  • Adds test binary entry point (test/cmd/main.go), build Makefile (test/Makefile), and Dockerfile integration
  • All tests will come in as LifecycleInforming

Test plan

  • Verify CI builds the multus-cni-tests-ext binary successfully
  • Verify the binary is included in the payload image at /usr/bin/multus-cni-tests-ext.gz
  • Register the binary in openshift/origin (companion PR)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added end-to-end testing capabilities with OpenShift extension test support.
  • Chores

    • Updated build infrastructure to support compilation and packaging of e2e tests.
    • Added new build targets and dependencies to support test execution.

Set up the OTE framework for multus-cni with no test cases yet.
This adds the test binary entry point, build infrastructure,
and Dockerfile integration for the multus-cni-tests-ext binary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Walkthrough

This PR introduces an OpenShift e2e test extension for multus-cni by adding Go dependencies, building a test binary named multus-cni-tests-ext, wiring it with an OpenShift test suite and Cobra CLI, and integrating the compressed artifact into the final container image.

Changes

E2E Test Extension Implementation

Layer / File(s) Summary
Dependencies and root build orchestration
go.mod, Makefile
Added github.com/openshift-eng/openshift-tests-extension and github.com/spf13/cobra as direct requirements; extended indirect dependencies and replaced github.com/onsi/ginkgo/v2 with OpenShift's fork. Root Makefile delegates build-e2e-tests to test directory.
E2E test binary build system
test/Makefile
Defines build metadata injection (Git commit, build date), Go linker flags, and provides build, build-linux, and clean targets for the multus-cni-tests-ext binary.
E2E test CLI entrypoint
test/cmd/main.go
Implements the CLI main function: initializes OpenShift extension registry, configures openshift/multus-cni suite with qualifier filters, sets specs to LifecycleInforming, registers the extension, wires Cobra commands, and runs the CLI.
Container image build and artifact integration
Dockerfile.openshift
Enables GO111MODULE=on in rhel9 builder, runs make build-e2e-tests, compresses the binary to multus-cni-tests-ext.gz, and copies the compressed artifact into the final runtime image at /usr/bin/.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 PR adds only infrastructure (main.go, Makefile, Dockerfile) without defining any Ginkgo test names. No test titles with dynamic values, timestamps, UUIDs, or pod/namespace names present.
Test Structure And Quality ✅ Passed This PR contains only infrastructure (build config, CLI entry point). No Ginkgo test specs are present; PR explicitly states no test cases are included in this change.
Microshift Test Compatibility ✅ Passed PR is infrastructure-only: test/cmd/main.go scaffolds the framework without defining any new Ginkgo tests (no It(), Describe(), Context(), etc. patterns found).
Single Node Openshift (Sno) Test Compatibility ✅ Passed No actual Ginkgo test cases are added in this PR—only OTE framework infrastructure. The test/cmd/main.go contains only setup code with no It(), Describe(), Context(), or When() declarations.
Topology-Aware Scheduling Compatibility ✅ Passed PR contains only build infrastructure (Dockerfile, Makefiles, test harness) with no deployment manifests, operator code, or scheduling constraints that would be affected by topology variations.
Ote Binary Stdout Contract ✅ Passed No process-level stdout writes detected in test/cmd/main.go. Panic call writes to stderr (not stdout per Go runtime). No fmt.Print*/Println, os.Stdout writes, or unredirected logging found.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR adds only infrastructure scaffolding with no Ginkgo test specs (It(), Describe(), etc.). No actual tests present means no IPv4 assumptions or external connectivity issues to flag.
No-Weak-Crypto ✅ Passed No weak cryptographic algorithms (MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB), custom crypto implementations, or non-constant-time secret comparisons detected in the PR changes.
Container-Privileges ✅ Passed PR does not introduce any privileged container configurations (privileged: true, hostPID, hostNetwork, hostIPC, SYS_ADMIN, allowPrivilegeEscalation, or root escalation) in any modified or new files.
No-Sensitive-Data-In-Logs ✅ Passed No sensitive data (passwords, tokens, API keys, PII, session IDs, internal hostnames, customer data) found in logging statements across modified files.
Title check ✅ Passed The pull request title accurately summarizes the main purpose of the changeset: adding OpenShift Tests Extension framework infrastructure to the multus-cni project.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@anuragthehatter anuragthehatter changed the title OTE: add OpenShift Tests Extension framework infrastructure [multus-cni] OTE: add OpenShift Tests Extension framework infrastructure May 28, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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 `@test/cmd/main.go`:
- Around line 31-33: The main() function currently uses
panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v",
err.Error())) on a recoverable setup error; replace this panic with a controlled
exit: write a clear error message including err (use err or err.Error()) to
stderr via fmt.Fprintln(os.Stderr, ...) and call os.Exit(nonZeroCode) to
terminate deterministically. Update imports to include "os" if missing and
remove the panic call in test/cmd/main.go so the code path uses the controlled
stderr+os.Exit behavior when the err variable is non-nil.
🪄 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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 6d4d4554-adef-4a1b-b1ba-b8e2f8a3eb43

📥 Commits

Reviewing files that changed from the base of the PR and between b4ec7d8 and 1713ca4.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (5)
  • Dockerfile.openshift
  • Makefile
  • go.mod
  • test/Makefile
  • test/cmd/main.go

Comment thread test/cmd/main.go
Comment on lines +31 to +33
if err != nil {
panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error()))
}
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify process-level entrypoints avoid panic-based exits for recoverable setup errors.
# Expected: no panic(...) in test/cmd/main.go after applying the fix.
rg -nP '^\s*panic\s*\(' --type=go test/cmd/main.go

Repository: openshift/multus-cni

Length of output: 157


🏁 Script executed:

#!/bin/bash
# Inspect surrounding code + imports for test/cmd/main.go
sed -n '1,120p' test/cmd/main.go

Repository: openshift/multus-cni

Length of output: 1270


Replace panic-based init failure with controlled exit path.

test/cmd/main.go panics on recoverable setup failure in main(), which yields an uncontrolled crash/stack trace instead of a deterministic CLI exit. Return a clear stderr message and exit code.

Suggested fix
 	specs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
 	if err != nil {
-		panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error()))
+		fmt.Fprintf(os.Stderr, "couldn't build extension test specs from ginkgo: %v\n", err)
+		os.Exit(1)
 	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if err != nil {
panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error()))
}
if err != nil {
fmt.Fprintf(os.Stderr, "couldn't build extension test specs from ginkgo: %v\n", err)
os.Exit(1)
}
🤖 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/cmd/main.go` around lines 31 - 33, The main() function currently uses
panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v",
err.Error())) on a recoverable setup error; replace this panic with a controlled
exit: write a clear error message including err (use err or err.Error()) to
stderr via fmt.Fprintln(os.Stderr, ...) and call os.Exit(nonZeroCode) to
terminate deterministically. Update imports to include "os" if missing and
remove the panic call in test/cmd/main.go so the code path uses the controlled
stderr+os.Exit behavior when the err variable is non-nil.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 28, 2026

@anuragthehatter: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws 1713ca4 link true /test e2e-aws
ci/prow/verify-deps 1713ca4 link true /test verify-deps
ci/prow/e2e-aws-upgrade 1713ca4 link true /test e2e-aws-upgrade
ci/prow/security 1713ca4 link false /test security
ci/prow/images 1713ca4 link true /test images
ci/prow/okd-scos-images 1713ca4 link true /test okd-scos-images

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.

@anuragthehatter anuragthehatter changed the title [multus-cni] OTE: add OpenShift Tests Extension framework infrastructure CORENET-7206: OTE: add OpenShift Tests Extension framework infrastructure May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant