WINC-1966: OTE Migration Batch 1 - Node Basics & Validation#4279
WINC-1966: OTE Migration Batch 1 - Node Basics & Validation#4279rrasouli wants to merge 1 commit into
Conversation
|
@rrasouli: This pull request references WINC-1966 which is a valid jira issue. DetailsIn response to this:
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. |
|
Skipping CI for Draft Pull Request. |
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR reworks the OTE (openshift-tests-extension) tooling for the Windows Machine Config Operator. It adds a Makefile for building the test-extension binary, upgrades go.mod (Go 1.25, new Ginkgo/Gomega/OpenShift/Kubernetes dependencies, and replace directives). The main entrypoint is rewritten to dynamically build and filter test specs from the OpenShift Ginkgo suite rather than manually registering WINC suites. New files ote/test/e2e/utils.go and ote/test/e2e/winc.go add helper functions and a migrated Ginkgo test suite covering kubelet versions, node labels, payload verification, user-data secrets, HostNetwork SSH checks, Go-version checks, and telemetry metric validation. The previous ote/test/extended/cli/cli.go and ote/test/extended/cluster.go files are deleted. Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 7 warnings)
✅ Passed checks (12 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rrasouli The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
5d643d3 to
9c3994d
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 10
🤖 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 `@ote/go.mod`:
- Line 243: The dependency set still pulls in google.golang.org/grpc v1.75.1,
which needs to be bumped to a patched release. Update the grpc module version in
go.mod (and any related indirect/replace entries if present) to v1.79.3 or
newer, then ensure the module graph resolves to the patched grpc version through
the existing dependency chain.
In `@ote/test/e2e/utils.go`:
- Around line 62-67: The truncatedVersion helper can panic when given a version
string with fewer than two dot-separated parts. Update truncatedVersion to guard
the slice operation before using strings.Split and str[:2], and return a safe
fallback for empty or short inputs so callers like the winc.go version parsing
path do not crash the test. Use the truncatedVersion function and its
removeOuterQuotes/string splitting logic as the fix point.
- Around line 69-89: getMetricsFromCluster currently miscounts empty Windows
node results and ignores parsing failures. In the getMetricsFromCluster helper,
replace the string splitting used for node and CPU lists with logic that treats
empty output as zero (for example, use strings.Fields) so an empty node list
returns 0 instead of 1, and update the capacity_cpu_cores branch to handle the
strconv.Atoi error explicitly instead of discarding it. Keep the behavior
localized to getMetricsFromCluster and preserve the existing metric dispatch
logic.
- Around line 27-33: The version-annotation lookup in
checkVersionAnnotationReady is passing shell-style single quotes through Args(),
which makes oc treat them as part of the JSONPath template and breaks the read.
Remove the surrounding quotes from the jsonpath argument so oc receives the raw
template, and keep the rest of the node lookup logic in
checkVersionAnnotationReady unchanged. This should restore the annotation check
used by the e2e flow in winc.go.
In `@ote/test/e2e/winc.go`:
- Line 117: The `base64.StdEncoding.DecodeString` calls in `winc.go` are
discarding decode errors, which can leave `decodedUserData` empty or partial and
hide the real failure. Update all affected call sites in the test flow to
capture and check the returned error, and fail the test immediately with a
message that includes the decode error before using `decodedUserData`. Keep the
fix consistent across the decode logic in the helper/test functions that
currently ignore the error.
- Around line 22-24: The infrastructure platform lookup in BeforeEach is
ignoring the command error, which can leave iaasPlatform empty and hide
failures; update the
oc.AsAdmin().WithoutNamespace().Run("get").Args(...).Output() call to handle the
returned error explicitly, and fail the test or otherwise stop setup when the
query does not succeed. Keep the iaasPlatform assignment in the same setup
block, but only after confirming the output was retrieved successfully.
- Around line 197-199: The winc E2E test ignores the error from exec.Command,
which can leave goVersion empty and cause truncatedVersion to panic. Update the
command execution block in the winc test to capture and check the error before
calling truncatedVersion, and fail the test with a clear message if the command
cannot run or returns no output. Use the existing exec.Command,
truncatedVersion, and tVersion flow to locate the fix.
- Around line 230-234: The metric extraction in winc.go is happening before the
SimpleQuery error check and is being called twice, which can mask the real
failure and duplicate work. In the query handling flow around
extractMetricValue(queryResult), move the err assertion ahead of any use of
queryResult so failures are surfaced first, then call extractMetricValue only
once after confirming the query succeeded. Remove the redundant second
invocation and keep the existing expectation message aligned with the
metricQuery/metricValue context.
- Around line 184-185: The Windows internal IP handling in the e2e test can
panic on an empty result and builds an IPv4-only SSH target string. In the test
setup around getWindowsInternalIPs(oc), first check that the returned slice is
non-empty and fail the test cleanly if no Windows IPs are available, then
construct curlDest using net.JoinHostPort with winInternalIP and "22" so IPv6
addresses are formatted correctly.
- Around line 221-225: The metric filter string in the telemetry exposure check
is using a raw string in the fmt.Sprintf call, so the backslashes are preserved
and the assertion matches the wrong text. Update the construction of
expectedExposedMetric in winc.go to use a double-quoted string in the same test
block so it produces {__name__="..."} exactly, and keep the rest of the
telemetry-config assertion unchanged.
🪄 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 YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: bb64c2dc-3348-49aa-bc96-425996923327
⛔ Files ignored due to path filters (1)
ote/go.sumis excluded by!**/*.sum
📒 Files selected for processing (8)
ote/Makefileote/cmd/main.goote/cmd/wmco-tests-ext/main.goote/go.modote/test/e2e/utils.goote/test/e2e/winc.goote/test/extended/cli/cli.goote/test/extended/cluster.go
💤 Files with no reviewable changes (3)
- ote/cmd/wmco-tests-ext/main.go
- ote/test/extended/cluster.go
- ote/test/extended/cli/cli.go
84ad3d2 to
6221af1
Compare
rrasouli
left a comment
There was a problem hiding this comment.
All CodeRabbit review comments have been addressed:
- utils.go:33 (jsonpath quotes): Removed shell-style single quotes from the jsonpath argument in checkVersionAnnotationReady. Args() passes the value directly to oc, so quotes are not needed.
- utils.go:69 (truncatedVersion panic): Added bounds check -- returns input string unchanged if fewer than 2 dot-separated segments.
- utils.go:95 (getMetricsFromCluster): Replaced strings.Split with strings.Fields (returns empty slice for empty string) and added strconv.Atoi error check with o.Expect.
- winc.go:26 (BeforeEach error): Infrastructure platform query error is now checked with o.Expect(err).NotTo(o.HaveOccurred()).
- winc.go:235 (extractMetricValue): Moved error check before extractMetricValue call and removed duplicate invocation.
- go.mod:243 (grpc CVE): Out of scope -- indirect dependency inherited from openshift/origin (OTP). Cannot be independently bumped without upstream changes.
|
@CodeRabbit review |
✅ Action performedReview finished.
|
4748904 to
58ea95a
Compare
Replace manual-registration skeleton with Ginkgo-based OTE approach that uses BuildExtensionTestSpecsFromOpenShiftGinkgoSuite() for automatic test discovery. Migrate 5 Smokerun tests from OTP: OCP-33612, OCP-32615, OCP-32554, OCP-37362, OCP-38188.
58ea95a to
32df42a
Compare
|
@rrasouli: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
Migrate 4 monitoring/observability tests from OTP to OTE framework: - OCP-33768: Prometheus alert rules validation - OCP-60814: Containerd version verification against upstream - OCP-77777: ServiceMonitor, HTTPS metrics, HTTP rejection - OCP-79251: Provider ID matching between nodes and machines Removed OCP-33779 (node logs) - redundant with WMCO e2e testNodeLogs coverage in test/e2e/logs_test.go. Tracked in WINC-1978 for OTP disable. Key changes: - Add generic execInPod() helper replacing SSH/bastion (WINC-1931) - Extract wmcoDeployment variable for reuse - Simplify truncatedVersion() with regex, remove removeOuterQuotes() - Add helpers: getContainerdVersion, getValueFromText, isNone, extractInstanceID, waitUntilWMCOStatusChanged, isBYOH - Add one-line comments to all utils.go functions Stacked on: WINC-1966 Batch 1 (openshift#4279)
Migrate 4 monitoring/observability tests from OTP to OTE framework: - OCP-33768: Prometheus alert rules validation - OCP-60814: Containerd version verification against upstream - OCP-77777: ServiceMonitor, HTTPS metrics, HTTP rejection - OCP-79251: Provider ID matching between nodes and machines Removed OCP-33779 (node logs) - redundant with WMCO e2e testNodeLogs coverage in test/e2e/logs_test.go. Tracked in WINC-1978 for OTP disable. Key changes: - Add generic execInPod() helper replacing SSH/bastion (WINC-1931) - Extract wmcoDeployment variable for reuse - Simplify truncatedVersion() with regex, remove removeOuterQuotes() - Add helpers: getContainerdVersion, getValueFromText, isNone, extractInstanceID, waitUntilWMCOStatusChanged, isBYOH - Add one-line comments to all utils.go functions Stacked on: WINC-1966 Batch 1 (openshift#4279)
Summary
Migrate 5 foundational Smokerun tests from openshift-tests-private (OTP) to WMCO's ote/ directory using the Ginkgo-based OTE framework. This replaces the manual-registration skeleton from PR #3874.
Jira: https://issues.redhat.com/browse/WINC-1966
Epic: https://issues.redhat.com/browse/WINC-1536
Why replace manual registration with Ginkgo?
The previous skeleton (PR #3874) used manual
ExtensionTestSpecregistration -- each test was a bare Go function registered one-by-one in main.go, with a custom CLI wrapper duplicating compat_otp. Adding tests required editing both the test file and main.go.The Ginkgo approach uses
BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()for automatic discovery. Tests are standardg.Describe/g.Itblocks (same structure as OTP), so code can be migrated with minimal changes. Adding a new test only requires a newg.Itblock -- no registration code to maintain. This is the approach recommended by OTE framework maintainers.Key design decisions
testExpectedServicesRunningintest/e2e/validation_test.go. The SSH/bastion functions from OTP were never migrated --utils.gowas written from scratch with only the functions needed by the 5 tests. The remaining OCP-33612 checks (kubelet version, worker labels, version annotations, payload folders) all useoccommands and work on any cluster.Files to review
New files (2 files with original logic):
ote/cmd/wmco-tests-ext/main.go-- OTE entry point: Ginkgo auto-discovery, suite registration, LifecycleInforming for all testsote/test/e2e/winc.go-- the 5 migrated tests as g.It blocksAdapted from OTP (review recommended):
ote/test/e2e/utils.go-- shared helper functions adapted from OTP: trimmed to only functions used by the 5 tests, SSH/bastion functions removed, added bounds checks, switched strings.Split to strings.Fields for empty-string safety, added strconv.Atoi error handlingDeleted (replaced by above):
ote/cmd/wmco-tests-ext/main.go-- manual registration entry pointote/test/extended/cli/cli.go-- custom CLI wrapper (unnecessary with compat_otp)ote/test/extended/cluster.go-- bare Go function for OCP-37362 (now a g.It block)Auto-generated (skip during review):
ote/go.mod,ote/go.sum-- dependency resolutionTests migrated
All are Smokerun tests. All set to LifecycleInforming (non-blocking) until validated in CI.
Testing evidence (clusterBot - AWS)
All 5 tests passed on clusterBot cluster:
How to test on clusterBot
Verification
make build-tests-ext-- builds successfullyinfoshows 5 suites: conformance/parallel, conformance/serial, disruptive, non-disruptive, allSummary by CodeRabbit