Skip to content

CORENET-7129 Add OVN metrics tests as OTP tests#3217

Open
asood-rh wants to merge 7 commits into
openshift:mainfrom
asood-rh:metrics-ote
Open

CORENET-7129 Add OVN metrics tests as OTP tests#3217
asood-rh wants to merge 7 commits into
openshift:mainfrom
asood-rh:metrics-ote

Conversation

@asood-rh

@asood-rh asood-rh commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Stacked on #3200. Adds 8 metrics tests -

  • 3 tests (45841, 47471, 52072) as blocking.
    [sig-networking] OVN metrics [OTP] 45841-Add OVN flow count metric
    [sig-networking] OVN metrics [OTP] 47471-Record update to cache versus port binding
    [sig-networking] OVN metrics [OTP] 52072-Add mechanism to record duration for k8 kinds

  • 5 tests as informing
    [sig-networking] OVN metrics [OTP] 47524-Metrics for ovn-appctl stopwatch/show command
    [sig-networking] OVN metrics [OTP] 45689-Metrics for idling enable/disabled
    [sig-networking] OVN metrics [Serial] [OTP] 60539-Verify metrics ovs_vswitchd_interfaces_total
    [sig-networking] OVN metrics [Serial] [OTP] 60704-Verify metrics ovs_vswitchd_interface_up_wait_seconds_total
    [sig-networking] OVN metrics [Serial] [Slow] [OTP] 60708-Verify metrics ovnkube_resource_retry_failures_total

Summary by CodeRabbit

  • Tests

    • Added extensive OTP-marked OVN-Kubernetes e2e suites (NetworkPolicy, IPBlock, DNS/connectivity, ACL audit logging, stability/perf) and OVN metrics validation; test harness updated to discover/classify OTP tests with adjusted lifecycles and naming.
    • Added a validating admission policy protection test and serial stress/perf sampling.
  • Chores

    • Updated module dependency versions and refreshed transitive dependency graph.
  • Tests

    • Added many networking test fixtures, templates and test data assets; embedded testdata now extracts via a single cached fixture path.
  • Style

    • Added approvers to testdata OWNERS.

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Bootstraps OTP tests and exutil cleanup, refreshes Go module deps, replaces go-bindata with embed.FS, adds many networking fixtures/templates, and introduces OVN metrics and NetworkPolicy OTP test suites.

Changes

OTP Test Integration and Fixtures

Layer / File(s) Summary
Test framework bootstrap and OTP detection
openshift/cmd/ovn-kubernetes-tests-ext/main.go
Imports exutil, loads informing/blocking lists from openshift/test, adds OTP blocking substring detection, wraps test execution with exutil.WithCleanup, detects [OTP] specs, and applies OTP-aware naming and lifecycle classification.
Kubernetes/OpenShift dependency refresh
openshift/go.mod
Bumps direct dependencies and refreshes many indirect modules; adds staging replace directives for k8s.io/cluster-bootstrap and k8s.io/sample-apiserver.
Embed.FS fixture extraction and OWNERS
openshift/pkg/otp/testdata/bindata.go, openshift/pkg/otp/testdata/networking/OWNERS
Replace go-bindata with an embed.FS extraction helper (FixturePath()); add OWNERS approvers entry for networking fixtures.
Networking testdata and templates
openshift/pkg/otp/testdata/networking/...
Add numerous networking fixtures and templates (DaemonSet, RC/Service, StatefulSet, Pod templates, many NetworkPolicy YAMLs and parameterized templates, VAP binding, egressip template, metrics pod, and other supporting manifests).
NetworkPolicy OTP suite
openshift/test/otp/networkpolicy.go
Add large Ginkgo suite validating NetworkPolicy behavior, ipBlock single/dual-stack and except/multi-CIDR cases, OVN ACL/audit integrations, address_set/name edge cases, disruptive recreate scenarios, VAP deletion protection, and a perf g.Serial stress test sampling ovnk-master metrics.
OVN metrics OTP suite
openshift/test/otp/metrics.go
Add Ginkgo tests that query Prometheus and kube-rbac-proxy metrics, validate OVN-related metrics (flow counts, durations, stopwatch/show samples), test idling metrics and ovs_vswitchd metrics, and exercise ovnkube retry-failure metrics.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 Hop hop, the test suite gates the green,
Fixtures tucked in, all tidy and clean.
Metrics hum and policies prance in tune,
OTP rabbit watches clusters swoon.
🥕 Time to run — the garden's fixed by noon.

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'CORENET-7129 Add OVN metrics tests as OTP tests' clearly and concisely describes the main change: adding OVN metrics tests as OTP tests, and is directly supported by the changes adding metrics.go with OTP test cases.

✏️ 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.

@openshift-ci openshift-ci Bot requested review from martinkennelly and tssurya June 2, 2026 20:22
@openshift-ci

openshift-ci Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: asood-rh
Once this PR has been reviewed and has the lgtm label, please assign jcaamano 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

@openshift-ci openshift-ci Bot added the do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. label Jun 2, 2026

@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: 8

🧹 Nitpick comments (4)
openshift/test/otp/metrics.go (1)

42-50: 💤 Low value

Redundant retry wrapper around helper with internal assertions.

The GetOVNMetricsInSpecificContainer helper already performs its own wait.Poll internally (per context snippet 3) and includes o.Expect(metricValue).ShouldNot(o.BeEmpty()). If the inner function fails, the test panics immediately—the outer poll won't retry. The if metricValue != "" check at line 44 is also unreachable when the helper returns successfully (since it guarantees non-empty).

Consider either:

  1. Simplifying to a single retry loop by removing the outer poll and relying on the helper's behavior, or
  2. Creating a variant helper that returns an error instead of asserting, so the outer poll can actually retry.

The current code works (both succeed or inner fails first), but the pattern is misleading.

🤖 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 `@openshift/test/otp/metrics.go` around lines 42 - 50, The outer wait.Poll is
redundant because otputils.GetOVNMetricsInSpecificContainer already does its own
wait.Poll and internally asserts (o.Expect/ShouldNot) so the outer retry never
meaningfully runs; either remove the outer wait.Poll and directly call
otputils.GetOVNMetricsInSpecificContainer(oc, ovncmName, podName, prometheusURL,
metricName) (and drop the o.Expect(metricsOutput)... line), or implement a
non-asserting variant (e.g., GetOVNMetricsInSpecificContainerNoAssert that
returns (string, error)) and replace the helper call inside the outer wait.Poll
with that so the poll can examine the error/value and retry properly. Ensure you
update call sites to use the chosen approach (remove wait.Poll wrapper or swap
to the new non-asserting helper).
openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-dual-multiple-CIDRs-template.yaml (1)

3-4: ⚡ Quick win

Template metadata.name naming is not used by this test flow

metadata:
  name: ipBlockEgressDual_multiple_cidrs_template

This metadata.name contains uppercase letters and underscores, which violates Kubernetes DNS-subdomain naming rules. However, this template is only processed via oc process (ApplyResourceFromTemplateByAdmin) and the processed objects are what get applied; other template fixtures in the same testdata also use uppercase/underscore metadata.name values, so this doesn’t block the intended usage.

Suggested fix
 metadata:
-  name: ipBlockEgressDual_multiple_cidrs_template
+  name: ipblock-egress-dual-multiple-cidrs-template
🤖 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
`@openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-dual-multiple-CIDRs-template.yaml`
around lines 3 - 4, The template's metadata.name
"ipBlockEgressDual_multiple_cidrs_template" violates Kubernetes DNS-subdomain
rules (uppercase and underscores); update the template name used in this file by
replacing the value of metadata.name with a DNS-compliant string (lowercase
letters, digits and hyphens only), e.g.
"ipblock-egress-dual-multiple-cidrs-template", and ensure any test code that
references this template via oc process / ApplyResourceFromTemplateByAdmin uses
the new name; locate the metadata.name entry for the template identifier
ipBlockEgressDual_multiple_cidrs_template and rename it accordingly.
openshift/pkg/otp/testdata/networking/testpod.yaml (1)

22-41: ⚡ Quick win

Apply the same pod hardening here to keep the fixture admission-safe.

The RC pod template currently relies on default security settings, unlike the other new pod fixtures in this PR. Adding runAsNonRoot, seccompProfile: RuntimeDefault, and container-level allowPrivilegeEscalation: false / dropped capabilities will make this fixture much less likely to trip restricted admission.

Proposed fix
                     "spec": {
+                        "securityContext": {
+                            "runAsNonRoot": true,
+                            "seccompProfile": {
+                                "type": "RuntimeDefault"
+                            }
+                        },
                         "containers": [
                             {
                                 "image": "quay.io/openshifttest/hello-sdn@sha256:c89445416459e7adea9a5a416b3365ed3d74f2491beb904d61dc8d1eb89a72a4",
                                 "name": "test-pod",
-                                "imagePullPolicy": "IfNotPresent"
+                                "imagePullPolicy": "IfNotPresent",
+                                "securityContext": {
+                                    "allowPrivilegeEscalation": false,
+                                    "capabilities": {
+                                        "drop": ["ALL"]
+                                    }
+                                }
                             }
                         ],
🤖 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 `@openshift/pkg/otp/testdata/networking/testpod.yaml` around lines 22 - 41, The
pod template under "spec" for the container named "test-pod" needs the same
hardening as other fixtures: add a pod-level securityContext with runAsNonRoot:
true and seccompProfile.type: RuntimeDefault, and add a container-level
securityContext on the "test-pod" container setting allowPrivilegeEscalation:
false and dropping capabilities (e.g., drop: ["ALL"]); update the "containers"
entry for the "test-pod" to include this securityContext so the RC pod template
is admission-safe.
openshift/pkg/otp/testdata/networking/statefulset-hello.yaml (1)

18-29: ⚡ Quick win

Harden this pod template the same way as the other new fixtures.

This StatefulSet is the outlier in this batch: it omits runAsNonRoot, seccompProfile: RuntimeDefault, and container-level allowPrivilegeEscalation: false / dropped capabilities. That can make the fixture fail or get mutated under restricted admission, even though the equivalent pod templates in this PR are already hardened.

Proposed fix
     spec:
+      securityContext:
+        runAsNonRoot: true
+        seccompProfile:
+          type: RuntimeDefault
       containers:
       - image: quay.io/openshifttest/hello-sdn@sha256:c89445416459e7adea9a5a416b3365ed3d74f2491beb904d61dc8d1eb89a72a4 
         name: hello
+        securityContext:
+          allowPrivilegeEscalation: false
+          capabilities:
+            drop: ["ALL"]
         ports:
         - containerPort: 8080
           name: web
🤖 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 `@openshift/pkg/otp/testdata/networking/statefulset-hello.yaml` around lines 18
- 29, The StatefulSet pod template is missing the same hardening as other
fixtures; update the spec.template.spec and the container named "hello" to
include securityContext.runAsNonRoot: true on the pod spec, pod-level
seccompProfile: { type: RuntimeDefault } under securityContext, and for the
container "hello" add securityContext.allowPrivilegeEscalation: false and
securityContext.capabilities: { drop: ["ALL"] } so the pod matches the other
hardened fixtures and won't be mutated or rejected by restricted admission.
🤖 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 `@openshift/cmd/ovn-kubernetes-tests-ext/main.go`:
- Around line 42-62: The current blocker classifier uses title substrings
(otpBlockingTests + isOTPBlocking) which is brittle; change otpBlockingTests to
contain the stable 5-digit OTP case IDs (or the exact metadata token used in
specs) instead of full titles and update isOTPBlocking to search for those IDs
(e.g., strings.Contains(name, otpID)) or parse test metadata for an explicit
otp_id field; ensure you update any test registration or comparison logic that
builds/consumes otpBlockingTests and keep the variable names otpBlockingTests
and isOTPBlocking so the change is easy to locate.

In `@openshift/pkg/otp/testdata/bindata.go`:
- Around line 1745-1749: The extracted fixture files are being written with mode
0 because every bindataFileInfo uses os.FileMode(0); update the write so it
falls back to sane permissions when info.Mode() == 0: in the restore path where
ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) is called (the code
that uses bindataFileInfo), compute a writeMode := info.Mode(); if writeMode ==
0 { writeMode = 0644 } and use writeMode for WriteFile (keep the existing
MkdirAll with 0755 for directories).

In `@openshift/pkg/otp/testdata/networking/hello-pod-daemonset.yaml`:
- Around line 14-15: Replace the deprecated node label key in the DaemonSet YAML
by changing the nodeSelector entry from "beta.kubernetes.io/os" to the stable
"kubernetes.io/os"; update the same key in all other occurrences mentioned
(e.g., entries in openshift/pkg/otp/testdata/bindata.go and
helm/ovn-kubernetes/charts/ovn-ipsec/templates/daemonset.yaml) so
fixtures/templates remain consistent and DaemonSets schedule correctly.

In `@openshift/pkg/otp/testdata/networking/networkpolicy/ingress_49696.yaml`:
- Around line 3-4: The manifest's metadata.name "allow-all-ingress" is
misleading and may collide with real allow-all fixtures; update the
metadata.name in ingress_49696.yaml to a unique, intent-matching value (for
example include the selector/intent like "allow-operations-test-pods-ingress" or
"allow-team-operations-ingress") so it accurately reflects that it only allows
traffic from team=operations/name=test-pods; ensure any tests or references that
expect the old name are updated to the new name.

In
`@openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-except-dual-CIDRs-template.yaml`:
- Around line 3-4: The manifest's metadata.name
"ipBlock_egress_dual_cidrs_template" is not DNS-1123 compliant (contains
uppercase/underscores); update the Template's metadata.name to a lowercase,
hyphen-separated, unique value (e.g., convert underscores to '-' and lowercase)
ensuring it does not collide with other fixtures; locate the name in the
template where metadata.name is set and replace it (refer to the symbol/value
ipBlock_egress_dual_cidrs_template and the surrounding Template YAML) so it
follows Kubernetes DNS-1123 label rules.

In
`@openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-except-single-CIDR-template.yaml`:
- Around line 3-4: The Template metadata.name
"ipBlockEgressSingle_cidr_template" is not DNS-compliant; update the value used
in the file (metadata.name) to a lowercase, RFC1123-compatible label using only
lowercase alphanumerics, '-' or '.', for example
"ipblock-egress-single-cidr-template", and ensure any references to that name in
templates/tests are updated to match.

In `@openshift/pkg/otp/testdata/networking/service-generic-template.yaml`:
- Around line 17-34: The Service template currently hardcodes the port value
(port: 27017) while declaring a template parameter PORT; update the ports
mapping so the port field uses the PORT parameter (e.g., replace the literal
27017 with the template variable for PORT) or if you intend not to vary the
port, remove the PORT parameter from the parameters list; target the ports ->
port entry and the parameters list (PORT) in service-generic-template.yaml to
make the template behavior consistent.

In `@openshift/test/otp/networkpolicy.go`:
- Around line 1682-1707: The test contains three identical defer cleanup blocks
calling oc.AsAdmin().WithoutNamespace().Run("delete").Args("networkpolicy",
policyName, "-n", ns).Execute(), which will attempt to delete the same
NetworkPolicy three times; remove the duplicate defers that wrap the
createAclCmd and setAclPropertiesCmd sections and keep only the initial defer
(the one before createAclCmd) so cleanup runs exactly once.

---

Nitpick comments:
In
`@openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-dual-multiple-CIDRs-template.yaml`:
- Around line 3-4: The template's metadata.name
"ipBlockEgressDual_multiple_cidrs_template" violates Kubernetes DNS-subdomain
rules (uppercase and underscores); update the template name used in this file by
replacing the value of metadata.name with a DNS-compliant string (lowercase
letters, digits and hyphens only), e.g.
"ipblock-egress-dual-multiple-cidrs-template", and ensure any test code that
references this template via oc process / ApplyResourceFromTemplateByAdmin uses
the new name; locate the metadata.name entry for the template identifier
ipBlockEgressDual_multiple_cidrs_template and rename it accordingly.

In `@openshift/pkg/otp/testdata/networking/statefulset-hello.yaml`:
- Around line 18-29: The StatefulSet pod template is missing the same hardening
as other fixtures; update the spec.template.spec and the container named "hello"
to include securityContext.runAsNonRoot: true on the pod spec, pod-level
seccompProfile: { type: RuntimeDefault } under securityContext, and for the
container "hello" add securityContext.allowPrivilegeEscalation: false and
securityContext.capabilities: { drop: ["ALL"] } so the pod matches the other
hardened fixtures and won't be mutated or rejected by restricted admission.

In `@openshift/pkg/otp/testdata/networking/testpod.yaml`:
- Around line 22-41: The pod template under "spec" for the container named
"test-pod" needs the same hardening as other fixtures: add a pod-level
securityContext with runAsNonRoot: true and seccompProfile.type: RuntimeDefault,
and add a container-level securityContext on the "test-pod" container setting
allowPrivilegeEscalation: false and dropping capabilities (e.g., drop: ["ALL"]);
update the "containers" entry for the "test-pod" to include this securityContext
so the RC pod template is admission-safe.

In `@openshift/test/otp/metrics.go`:
- Around line 42-50: The outer wait.Poll is redundant because
otputils.GetOVNMetricsInSpecificContainer already does its own wait.Poll and
internally asserts (o.Expect/ShouldNot) so the outer retry never meaningfully
runs; either remove the outer wait.Poll and directly call
otputils.GetOVNMetricsInSpecificContainer(oc, ovncmName, podName, prometheusURL,
metricName) (and drop the o.Expect(metricsOutput)... line), or implement a
non-asserting variant (e.g., GetOVNMetricsInSpecificContainerNoAssert that
returns (string, error)) and replace the helper call inside the outer wait.Poll
with that so the poll can examine the error/value and retry properly. Ensure you
update call sites to use the chosen approach (remove wait.Poll wrapper or swap
to the new non-asserting helper).
🪄 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: Path: .coderabbit.yml

Review profile: CHILL

Plan: Enterprise

Run ID: 2cece5a8-b715-43d9-ae31-2287ae6d318d

📥 Commits

Reviewing files that changed from the base of the PR and between 3ce6353 and 0187a5f.

⛔ Files ignored due to path filters (1)
  • openshift/go.sum is excluded by !**/*.sum
📒 Files selected for processing (42)
  • openshift/cmd/ovn-kubernetes-tests-ext/main.go
  • openshift/go.mod
  • openshift/pkg/otp/testdata/bindata.go
  • openshift/pkg/otp/testdata/networking/OWNERS
  • openshift/pkg/otp/testdata/networking/hello-pod-daemonset.yaml
  • openshift/pkg/otp/testdata/networking/hellosdn.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-egress-red.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-from-all-namespaces.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-from-same-namespace.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-ingress-red.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-same-namespace.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-to-openshift-dns.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-to-same-namespace.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/default-allow-egress.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/default-deny-egress.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/default-deny-ingress.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/egress-allow-all.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/egress-ingress-62524.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/egress_49696.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/generic-networkpolicy-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ingress-allow-all.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ingress_49696.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-dual-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-dual-multiple-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-except-dual-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-except-single-CIDR-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-single-CIDR-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-single-multiple-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-ingress-dual-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-ingress-dual-multiple-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-ingress-single-CIDR-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-ingress-single-multiple-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/netpol-30920-75540.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/vap-npprotection-blockdeletion.yaml
  • openshift/pkg/otp/testdata/networking/ping-for-pod-specific-node-template.yaml
  • openshift/pkg/otp/testdata/networking/ping-for-pod-template.yaml
  • openshift/pkg/otp/testdata/networking/service-generic-template.yaml
  • openshift/pkg/otp/testdata/networking/statefulset-hello.yaml
  • openshift/pkg/otp/testdata/networking/testpod.yaml
  • openshift/pkg/otp/utils.go
  • openshift/test/otp/metrics.go
  • openshift/test/otp/networkpolicy.go

Comment on lines +42 to +62
var otpBlockingTests = []string{
"service domain can be resolved when egress type is enabled",
"Networkpolicy egress rule should work for statefulset pods",
"Check ACL audit logs can be extracted",
"Check networkpolicy ACL audit message is logged with correct policy name",
"OVN address_set referenced in acl should not miss when networkpolicy name includes dot",
"Duplicate transactions should not be executed for network policy for every pod update",
"Creating egress network policies for allowing to same namespace and openshift dns in namespace prevents the pod from reaching its own service",
"Pod IP is missing from OVN DB AddressSet when using allow-namespace-only network policy",
"Add OVN flow count metric",
"Record update to cache versus port binding",
"Add mechanism to record duration for k8 kinds",
}

func isOTPBlocking(name string) bool {
for _, title := range otpBlockingTests {
if strings.Contains(name, title) {
return true
}
}
return false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Use stable OTP IDs for blocker classification.

This classifier keys off title substrings, so a harmless test rename can silently flip a blocking OTP case to informing. Since these specs already carry stable 5-digit OTP case IDs, classify on those IDs (or explicit registration metadata) instead of free-form titles.

🤖 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 `@openshift/cmd/ovn-kubernetes-tests-ext/main.go` around lines 42 - 62, The
current blocker classifier uses title substrings (otpBlockingTests +
isOTPBlocking) which is brittle; change otpBlockingTests to contain the stable
5-digit OTP case IDs (or the exact metadata token used in specs) instead of full
titles and update isOTPBlocking to search for those IDs (e.g.,
strings.Contains(name, otpID)) or parse test metadata for an explicit otp_id
field; ensure you update any test registration or comparison logic that
builds/consumes otpBlockingTests and keep the variable names otpBlockingTests
and isOTPBlocking so the change is easy to locate.

Comment thread openshift/pkg/otp/testdata/bindata.go Outdated
Comment on lines +14 to +15
nodeSelector:
beta.kubernetes.io/os: linux

Copy link
Copy Markdown

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
set -euo pipefail

FILE="openshift/pkg/otp/testdata/networking/hello-pod-daemonset.yaml"

echo "== File: $FILE =="
if [ -f "$FILE" ]; then
  nl -ba "$FILE" | sed -n '1,60p'
else
  echo "Missing: $FILE"
fi

echo
echo "== Occurrences of beta.kubernetes.io/os =="
rg -n "beta\.kubernetes\.io/os" -S . || true

Repository: openshift/ovn-kubernetes

Length of output: 204


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="openshift/pkg/otp/testdata/networking/hello-pod-daemonset.yaml"

echo "== Check file exists =="
if [ -f "$FILE" ]; then echo "FOUND: $FILE"; else echo "MISSING: $FILE"; exit 1; fi

echo
echo "== File: $FILE (lines 1-60) =="
# Use awk to add line numbers (since nl isn't available)
awk 'NR>=1 && NR<=60 {printf "%4d\t%s\n", NR, $0}' "$FILE"

echo
echo "== Occurrences of beta.kubernetes.io/os in repo =="
rg -n "beta\.kubernetes\.io/os" -S . || true

Repository: openshift/ovn-kubernetes

Length of output: 1440


🌐 Web query:

"beta.kubernetes.io/os" deprecated "kubernetes.io/os" standard node label documentation

💡 Result:

The node label beta.kubernetes.io/os has been officially deprecated in favor of the standard label kubernetes.io/os [1][2]. Key points regarding this migration: - Deprecation Status: The beta.kubernetes.io/os label was deprecated starting in Kubernetes v1.14 [3][4][5]. - Removal: As of May 2026, the Kubernetes project has moved to remove these beta labels entirely [6]. Recent updates have stopped the kubelet from applying beta.kubernetes.io/os and beta.kubernetes.io/arch to nodes and removed their reconciliation from the node lifecycle controller [6]. - Migration Path: Users should update any node selectors, pod affinity rules, or Persistent Volume (PV) node affinity configurations to use the GA (General Availability) equivalents: kubernetes.io/os and kubernetes.io/arch [6]. - Impact: While existing nodes with the old labels may not immediately break, any new nodes or systems relying on these labels will fail to function as expected if they use the deprecated beta keys [6]. The system has been issuing warnings (Warning: 299) via kubectl during application/deployment to alert users to this required migration since v1.25 [6].

Citations:


Replace deprecated beta.kubernetes.io/os with kubernetes.io/os in nodeSelector

beta.kubernetes.io/os is deprecated; use kubernetes.io/os to avoid DaemonSets not scheduling on clusters that only expose the stable node label. https://kubernetes.io/docs/reference/labels-annotations-taints/

Also update the other repo occurrences of beta.kubernetes.io/os to keep fixtures/templates consistent (e.g., openshift/pkg/otp/testdata/bindata.go, helm/ovn-kubernetes/charts/ovn-ipsec/templates/daemonset.yaml).

Proposed fix
       nodeSelector:
-        beta.kubernetes.io/os: linux
+        kubernetes.io/os: linux
📝 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
nodeSelector:
beta.kubernetes.io/os: linux
nodeSelector:
kubernetes.io/os: linux
🤖 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 `@openshift/pkg/otp/testdata/networking/hello-pod-daemonset.yaml` around lines
14 - 15, Replace the deprecated node label key in the DaemonSet YAML by changing
the nodeSelector entry from "beta.kubernetes.io/os" to the stable
"kubernetes.io/os"; update the same key in all other occurrences mentioned
(e.g., entries in openshift/pkg/otp/testdata/bindata.go and
helm/ovn-kubernetes/charts/ovn-ipsec/templates/daemonset.yaml) so
fixtures/templates remain consistent and DaemonSets schedule correctly.

Comment on lines +3 to +4
metadata:
name: allow-all-ingress

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Give this policy a unique, intent-matching name.

Line 4 reuses allow-all-ingress, but this manifest only allows traffic from team=operations/name=test-pods. Reusing the real allow-all policy name makes the fixture misleading and risks collisions if both fixtures are applied in the same namespace.

🤖 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 `@openshift/pkg/otp/testdata/networking/networkpolicy/ingress_49696.yaml`
around lines 3 - 4, The manifest's metadata.name "allow-all-ingress" is
misleading and may collide with real allow-all fixtures; update the
metadata.name in ingress_49696.yaml to a unique, intent-matching value (for
example include the selector/intent like "allow-operations-test-pods-ingress" or
"allow-team-operations-ingress") so it accurately reflects that it only allows
traffic from team=operations/name=test-pods; ensure any tests or references that
expect the old name are updated to the new name.

Comment on lines +3 to +4
metadata:
name: ipBlock_egress_dual_cidrs_template

Copy link
Copy Markdown

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

Rename the Template metadata.name to a DNS-1123-compliant, unique value

metadata.name is ipBlock_egress_dual_cidrs_template, which contains uppercase letters and underscores; Kubernetes metadata.name must be a DNS-1123 label (lowercase alphanumerics and - only). Ensure the renamed value is unique across the related fixtures.

Suggested fix
 metadata:
-  name: ipBlock_egress_dual_cidrs_template
+  name: ipblock-egress-except-dual-cidrs-template
📝 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
metadata:
name: ipBlock_egress_dual_cidrs_template
metadata:
name: ipblock-egress-except-dual-cidrs-template
🤖 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
`@openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-except-dual-CIDRs-template.yaml`
around lines 3 - 4, The manifest's metadata.name
"ipBlock_egress_dual_cidrs_template" is not DNS-1123 compliant (contains
uppercase/underscores); update the Template's metadata.name to a lowercase,
hyphen-separated, unique value (e.g., convert underscores to '-' and lowercase)
ensuring it does not collide with other fixtures; locate the name in the
template where metadata.name is set and replace it (refer to the symbol/value
ipBlock_egress_dual_cidrs_template and the surrounding Template YAML) so it
follows Kubernetes DNS-1123 label rules.

Comment on lines +3 to +4
metadata:
name: ipBlockEgressSingle_cidr_template

Copy link
Copy Markdown

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
set -euo pipefail

FILE="openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-except-single-CIDR-template.yaml"
echo "=== File content (lines with metadata.name) ==="
if [ -f "$FILE" ]; then
  nl -ba "$FILE" | sed -n '1,120p'
else
  echo "Missing file: $FILE" >&2
  exit 1
fi

echo
echo "=== Find similar *_template.yaml files for naming patterns ==="
# list template testdata files in same directory tree
DIR="openshift/pkg/otp/testdata/networking/networkpolicy/ipblock"
fd -t f "*-template.yaml" "$DIR" | head -n 50 | sed 's|^|FOUND: |'

echo
echo "=== Extract metadata.name values from nearby template YAMLs ==="
fd -t f "*-template.yaml" "$DIR" | xargs -r -I{} sh -c "echo '--- {}'; rg -n \"^\\s*name:\\s*\" {} | head -n 5" | head -n 200

Repository: openshift/ovn-kubernetes

Length of output: 177


🌐 Web query:

Kubernetes validation rules for metadata.name RFC 1123 DNS subdomain lowercase digits hyphen underscore invalid

💡 Result:

In Kubernetes, the metadata.name field for most resource types must conform to the RFC 1123 DNS subdomain standard [1][2]. This validation is enforced by the Kubernetes API server [2][3]. The validation rules for metadata.name are as follows: - Character set: Must consist only of lowercase alphanumeric characters (a-z and 0-9), hyphens (-), and periods (.) [1][3]. - Underscores (_): Underscores are explicitly invalid in metadata.name for resources that follow the RFC 1123 DNS subdomain standard [2][3]. The API server will reject any name containing an underscore with a validation error [2][3]. - Start and end: The name must start and end with an alphanumeric character [1][2]. - Length: The total length must be no more than 253 characters [1][2]. Each individual label (the segments separated by periods) must be no more than 63 characters long [4][5]. It is important to distinguish between metadata.name and Kubernetes labels (metadata.labels). While metadata.name is strictly constrained by DNS subdomain rules, Kubernetes label values and keys have different, more permissive requirements that do allow for underscores [6][7]. For resources like Services that are used in DNS resolution, these naming constraints are strictly enforced to ensure compatibility with DNS standards, where underscores are typically not permitted in hostnames [2].

Citations:


🌐 Web query:

OpenShift Template metadata.name naming validation allowed characters

💡 Result:

In an OpenShift Template (kind Template, API group template.openshift.io), the Template’s metadata.name is the Kubernetes object name for the Template, and it is validated using the Kubernetes object-name rules for “DNS label” style names. Allowed characters (practical rules) - Lowercase letters a-z, digits 0-9, and hyphen “-”. - It must start with a letter (a-z) and end with a letter or digit (a-z, 0-9). - Length: at most 63 characters. These are the RFC 1035 “DNS label” constraints that Kubernetes documents as the name standard for many resource types and that govern metadata.name validation in practice for Kubernetes objects like Templates.[1] Notes / implications - Uppercase letters, underscores, dots “.”, and other characters are not allowed under the DNS-label rule Kubernetes documents for RFC 1035 label names.[1] - OpenShift Template API docs confirm that Template.metadata.name “must be set” and describe it as “name of the Template”, but they don’t repeat the character-level validation rules; those rules come from Kubernetes’ object-name validation.[2][3][1] Example of a valid Template metadata.name - abc-123 Example of invalid Template metadata.name - MyTemplate (uppercase “M” not allowed)[1] - my_template (underscore not allowed)[1] - -bad (can’t start with “-”)[1] - bad- (can’t end with “-”)[1]

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
DIR="openshift/pkg/otp/testdata/networking/networkpolicy/ipblock"
rg -n "ipBlockEgressSingle_cidr_template|ipBlockEgressSingle" "$DIR" -S || true
rg -n "invalid|must fail|negative|should fail" "$DIR" -S || true

Repository: openshift/ovn-kubernetes

Length of output: 530


Make Template metadata.name DNS-compliant.

metadata.name: ipBlockEgressSingle_cidr_template contains uppercase letters and _, which are rejected by Kubernetes object-name validation for Template resources (DNS label/RFC 1123: lowercase alphanumerics with -/. only). Rename it to a lowercase/dash form.

Suggested fix
 metadata:
-  name: ipBlockEgressSingle_cidr_template
+  name: ipblock-egress-single-cidr-template
📝 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
metadata:
name: ipBlockEgressSingle_cidr_template
metadata:
name: ipblock-egress-single-cidr-template
🤖 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
`@openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-except-single-CIDR-template.yaml`
around lines 3 - 4, The Template metadata.name
"ipBlockEgressSingle_cidr_template" is not DNS-compliant; update the value used
in the file (metadata.name) to a lowercase, RFC1123-compatible label using only
lowercase alphanumerics, '-' or '.', for example
"ipblock-egress-single-cidr-template", and ensure any references to that name in
templates/tests are updated to match.

Comment on lines +17 to +34
ports:
- name: http
port: 27017
protocol: "${PROTOCOL}"
targetPort: 8080
selector:
name: "${SELECTOR}"
type: "${serviceType}"
parameters:
- name: SERVICENAME
- name: NAMESPACE
- name: internalTrafficPolicy
- name: externalTrafficPolicy
- name: ipFamilyPolicy
- name: PROTOCOL
- name: SELECTOR
- name: serviceType
- name: PORT

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Wire PORT into the rendered Service or drop it.

PORT is declared as a template parameter, but Line 19 still hard-codes 27017. Any caller passing PORT gets ignored, which makes this "generic" fixture behave unexpectedly.

Proposed fix
     ports:
     - name: http
-      port: 27017
+      port: ${PORT}
       protocol: "${PROTOCOL}"
       targetPort: 8080
📝 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
ports:
- name: http
port: 27017
protocol: "${PROTOCOL}"
targetPort: 8080
selector:
name: "${SELECTOR}"
type: "${serviceType}"
parameters:
- name: SERVICENAME
- name: NAMESPACE
- name: internalTrafficPolicy
- name: externalTrafficPolicy
- name: ipFamilyPolicy
- name: PROTOCOL
- name: SELECTOR
- name: serviceType
- name: PORT
ports:
- name: http
port: ${PORT}
protocol: "${PROTOCOL}"
targetPort: 8080
selector:
name: "${SELECTOR}"
type: "${serviceType}"
parameters:
- name: SERVICENAME
- name: NAMESPACE
- name: internalTrafficPolicy
- name: externalTrafficPolicy
- name: ipFamilyPolicy
- name: PROTOCOL
- name: SELECTOR
- name: serviceType
- name: PORT
🤖 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 `@openshift/pkg/otp/testdata/networking/service-generic-template.yaml` around
lines 17 - 34, The Service template currently hardcodes the port value (port:
27017) while declaring a template parameter PORT; update the ports mapping so
the port field uses the PORT parameter (e.g., replace the literal 27017 with the
template variable for PORT) or if you intend not to vary the port, remove the
PORT parameter from the parameters list; target the ports -> port entry and the
parameters list (PORT) in service-generic-template.yaml to make the template
behavior consistent.

Comment thread openshift/test/otp/networkpolicy.go Outdated
Comment on lines +1682 to +1707
defer func() {
if os.Getenv("DELETE_NAMESPACE") != "false" {
oc.AsAdmin().WithoutNamespace().Run("delete").Args("networkpolicy", policyName, "-n", ns).Execute()
}
}()
o.Expect(err).NotTo(o.HaveOccurred())
g.By("Create a duplicate ACL")
createAclCmd := fmt.Sprintf("ovn-nbctl --id=@copyacl create acl name=copyacl direction=%s action=%s -- add port_group %s acl @copyacl", aclMap["direction"], aclMap["action"], pgMap["_uuid"])
idOutput, listErr := otputils.RemoteShPodWithBashSpecifyContainer(oc, "openshift-ovn-kubernetes", ovnKNodePod, "ovnkube-controller", createAclCmd)
o.Expect(listErr).NotTo(o.HaveOccurred())
o.Expect(idOutput).NotTo(o.BeEmpty())
e2e.Logf(idOutput)
defer func() {
if os.Getenv("DELETE_NAMESPACE") != "false" {
oc.AsAdmin().WithoutNamespace().Run("delete").Args("networkpolicy", policyName, "-n", ns).Execute()
}
}()
g.By("Set properties of duplicate ACL")
setAclPropertiesCmd := fmt.Sprintf("ovn-nbctl set acl %s match='%s' priority=%s meter=%s", idOutput, aclMap["match"], aclMap["priority"], aclMap["meter"])
_, listErr = otputils.RemoteShPodWithBashSpecifyContainer(oc, "openshift-ovn-kubernetes", ovnKNodePod, "ovnkube-controller", setAclPropertiesCmd)
o.Expect(listErr).NotTo(o.HaveOccurred())
defer func() {
if os.Getenv("DELETE_NAMESPACE") != "false" {
oc.AsAdmin().WithoutNamespace().Run("delete").Args("networkpolicy", policyName, "-n", ns).Execute()
}
}()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Duplicate defer statements will attempt cleanup three times.

Lines 1682-1686, 1694-1698, and 1703-1707 all contain identical defer blocks that delete the same networkpolicy. When the test completes, all three will execute sequentially, with the second and third attempts failing because the resource was already deleted.

Keep only one defer (the first one at lines 1682-1686) and remove the other two.

🐛 Proposed fix
 		defer func() {
 			if os.Getenv("DELETE_NAMESPACE") != "false" {
 				oc.AsAdmin().WithoutNamespace().Run("delete").Args("networkpolicy", policyName, "-n", ns).Execute()
 			}
 		}()
 		o.Expect(err).NotTo(o.HaveOccurred())
 		g.By("Create a duplicate ACL")
 		createAclCmd := fmt.Sprintf("ovn-nbctl --id=`@copyacl` create acl name=copyacl direction=%s action=%s -- add port_group %s acl `@copyacl`", aclMap["direction"], aclMap["action"], pgMap["_uuid"])
 		idOutput, listErr := otputils.RemoteShPodWithBashSpecifyContainer(oc, "openshift-ovn-kubernetes", ovnKNodePod, "ovnkube-controller", createAclCmd)
 		o.Expect(listErr).NotTo(o.HaveOccurred())
 		o.Expect(idOutput).NotTo(o.BeEmpty())
 		e2e.Logf(idOutput)
-		defer func() {
-			if os.Getenv("DELETE_NAMESPACE") != "false" {
-				oc.AsAdmin().WithoutNamespace().Run("delete").Args("networkpolicy", policyName, "-n", ns).Execute()
-			}
-		}()
 		g.By("Set properties of duplicate ACL")
 		setAclPropertiesCmd := fmt.Sprintf("ovn-nbctl set acl %s  match='%s' priority=%s meter=%s", idOutput, aclMap["match"], aclMap["priority"], aclMap["meter"])
 		_, listErr = otputils.RemoteShPodWithBashSpecifyContainer(oc, "openshift-ovn-kubernetes", ovnKNodePod, "ovnkube-controller", setAclPropertiesCmd)
 		o.Expect(listErr).NotTo(o.HaveOccurred())
-		defer func() {
-			if os.Getenv("DELETE_NAMESPACE") != "false" {
-				oc.AsAdmin().WithoutNamespace().Run("delete").Args("networkpolicy", policyName, "-n", ns).Execute()
-			}
-		}()
 		g.By("Set name of duplicate ACL")
📝 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
defer func() {
if os.Getenv("DELETE_NAMESPACE") != "false" {
oc.AsAdmin().WithoutNamespace().Run("delete").Args("networkpolicy", policyName, "-n", ns).Execute()
}
}()
o.Expect(err).NotTo(o.HaveOccurred())
g.By("Create a duplicate ACL")
createAclCmd := fmt.Sprintf("ovn-nbctl --id=@copyacl create acl name=copyacl direction=%s action=%s -- add port_group %s acl @copyacl", aclMap["direction"], aclMap["action"], pgMap["_uuid"])
idOutput, listErr := otputils.RemoteShPodWithBashSpecifyContainer(oc, "openshift-ovn-kubernetes", ovnKNodePod, "ovnkube-controller", createAclCmd)
o.Expect(listErr).NotTo(o.HaveOccurred())
o.Expect(idOutput).NotTo(o.BeEmpty())
e2e.Logf(idOutput)
defer func() {
if os.Getenv("DELETE_NAMESPACE") != "false" {
oc.AsAdmin().WithoutNamespace().Run("delete").Args("networkpolicy", policyName, "-n", ns).Execute()
}
}()
g.By("Set properties of duplicate ACL")
setAclPropertiesCmd := fmt.Sprintf("ovn-nbctl set acl %s match='%s' priority=%s meter=%s", idOutput, aclMap["match"], aclMap["priority"], aclMap["meter"])
_, listErr = otputils.RemoteShPodWithBashSpecifyContainer(oc, "openshift-ovn-kubernetes", ovnKNodePod, "ovnkube-controller", setAclPropertiesCmd)
o.Expect(listErr).NotTo(o.HaveOccurred())
defer func() {
if os.Getenv("DELETE_NAMESPACE") != "false" {
oc.AsAdmin().WithoutNamespace().Run("delete").Args("networkpolicy", policyName, "-n", ns).Execute()
}
}()
defer func() {
if os.Getenv("DELETE_NAMESPACE") != "false" {
oc.AsAdmin().WithoutNamespace().Run("delete").Args("networkpolicy", policyName, "-n", ns).Execute()
}
}()
o.Expect(err).NotTo(o.HaveOccurred())
g.By("Create a duplicate ACL")
createAclCmd := fmt.Sprintf("ovn-nbctl --id=`@copyacl` create acl name=copyacl direction=%s action=%s -- add port_group %s acl `@copyacl`", aclMap["direction"], aclMap["action"], pgMap["_uuid"])
idOutput, listErr := otputils.RemoteShPodWithBashSpecifyContainer(oc, "openshift-ovn-kubernetes", ovnKNodePod, "ovnkube-controller", createAclCmd)
o.Expect(listErr).NotTo(o.HaveOccurred())
o.Expect(idOutput).NotTo(o.BeEmpty())
e2e.Logf(idOutput)
g.By("Set properties of duplicate ACL")
setAclPropertiesCmd := fmt.Sprintf("ovn-nbctl set acl %s match='%s' priority=%s meter=%s", idOutput, aclMap["match"], aclMap["priority"], aclMap["meter"])
_, listErr = otputils.RemoteShPodWithBashSpecifyContainer(oc, "openshift-ovn-kubernetes", ovnKNodePod, "ovnkube-controller", setAclPropertiesCmd)
o.Expect(listErr).NotTo(o.HaveOccurred())
🤖 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 `@openshift/test/otp/networkpolicy.go` around lines 1682 - 1707, The test
contains three identical defer cleanup blocks calling
oc.AsAdmin().WithoutNamespace().Run("delete").Args("networkpolicy", policyName,
"-n", ns).Execute(), which will attempt to delete the same NetworkPolicy three
times; remove the duplicate defers that wrap the createAclCmd and
setAclPropertiesCmd sections and keep only the initial defer (the one before
createAclCmd) so cleanup runs exactly once.

@asood-rh

asood-rh commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

/retitle CORENET-7129 Add OVN metrics tests as blocking OTP tests

@openshift-ci openshift-ci Bot changed the title Add OVN metrics tests as blocking OTP tests CORENET-7129 Add OVN metrics tests as blocking OTP tests Jun 4, 2026
@asood-rh

asood-rh commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@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 (1)
openshift/test/otp/networkpolicy.go (1)

1781-1790: ⚡ Quick win

Avoid shell-wrapped curl calls for dynamic route host.

Use strings.TrimSpace and call exec.Command with arguments directly; this removes shell parsing risk/flakiness and satisfies the static-analysis finding.

♻️ Proposed refactor
-		svcRoute, routeErr := oc.AsAdmin().Run("get").Args("route", serviceName, "-n", ns, "-o=jsonpath={.spec.host}").Output()
+		svcRoute, routeErr := oc.AsAdmin().Run("get").Args("route", serviceName, "-n", ns, "-o=jsonpath={.spec.host}").Output()
 		o.Expect(routeErr).NotTo(o.HaveOccurred())
+		svcRoute = strings.TrimSpace(svcRoute)
 		o.Expect(svcRoute).ShouldNot(o.Equal(""))
@@
-			routeCurlOutput, svcErr = exec.Command("bash", "-c", "curl -sI "+svcRoute).Output()
+			routeCurlOutput, svcErr = exec.Command("curl", "-sI", svcRoute).Output()
@@
-		routeCurlOutput, svcErr = exec.Command("bash", "-c", "curl -sI "+svcRoute).Output()
+		routeCurlOutput, svcErr = exec.Command("curl", "-sI", svcRoute).Output()

Also applies to: 1803-1804

🤖 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 `@openshift/test/otp/networkpolicy.go` around lines 1781 - 1790, The test
currently invokes exec.Command with "bash -c" and a concatenated svcRoute string
which risks shell parsing issues; change the logic in the route access block
that uses svcRoute, svcErr, routeCurlOutput and exec.Command("bash","-c","curl
-sI "+svcRoute) to first trim svcRoute with strings.TrimSpace(svcRoute) and then
call exec.Command with explicit args (e.g., exec.Command("curl", "-sI",
trimmedRoute)) so the host is passed as a single argument and avoid
shell-wrapping; keep the existing error handling around svcErr and
routeCurlOutput unchanged.

Source: Linters/SAST tools

🤖 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 `@openshift/test/otp/networkpolicy.go`:
- Around line 2105-2110: The test currently compares raw byte output of
checkMemory2 vs checkMemory1 inside the anonymous function passed to
wait.PollUntilContextTimeout, which is flaky; instead parse the memory values
from checkMemoryCmd output (use checkMemory2 and checkMemory1), convert to a
numeric value (e.g., KiB/MiB as integers), compute the absolute difference (add
a small helper like abs(int) if needed), and return success if the difference is
within a tolerance window (e.g., a few percent or fixed KB); update the
anonymous function logic to log differences and only fail on parse errors or
when the difference exceeds the tolerance.

---

Nitpick comments:
In `@openshift/test/otp/networkpolicy.go`:
- Around line 1781-1790: The test currently invokes exec.Command with "bash -c"
and a concatenated svcRoute string which risks shell parsing issues; change the
logic in the route access block that uses svcRoute, svcErr, routeCurlOutput and
exec.Command("bash","-c","curl -sI "+svcRoute) to first trim svcRoute with
strings.TrimSpace(svcRoute) and then call exec.Command with explicit args (e.g.,
exec.Command("curl", "-sI", trimmedRoute)) so the host is passed as a single
argument and avoid shell-wrapping; keep the existing error handling around
svcErr and routeCurlOutput 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: Path: .coderabbit.yml

Review profile: CHILL

Plan: Enterprise

Run ID: 7bb65623-8602-4374-9f2a-720a00ba90bb

📥 Commits

Reviewing files that changed from the base of the PR and between ba4420b and d208090.

⛔ Files ignored due to path filters (1)
  • openshift/go.sum is excluded by !**/*.sum
📒 Files selected for processing (42)
  • openshift/cmd/ovn-kubernetes-tests-ext/main.go
  • openshift/go.mod
  • openshift/pkg/otp/testdata/bindata.go
  • openshift/pkg/otp/testdata/networking/OWNERS
  • openshift/pkg/otp/testdata/networking/hello-pod-daemonset.yaml
  • openshift/pkg/otp/testdata/networking/hellosdn.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-egress-red.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-from-all-namespaces.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-from-same-namespace.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-ingress-red.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-same-namespace.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-to-openshift-dns.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-to-same-namespace.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/default-allow-egress.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/default-deny-egress.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/default-deny-ingress.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/egress-allow-all.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/egress-ingress-62524.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/egress_49696.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/generic-networkpolicy-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ingress-allow-all.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ingress_49696.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-dual-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-dual-multiple-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-except-dual-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-except-single-CIDR-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-single-CIDR-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-single-multiple-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-ingress-dual-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-ingress-dual-multiple-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-ingress-single-CIDR-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-ingress-single-multiple-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/netpol-30920-75540.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/vap-npprotection-blockdeletion.yaml
  • openshift/pkg/otp/testdata/networking/ping-for-pod-specific-node-template.yaml
  • openshift/pkg/otp/testdata/networking/ping-for-pod-template.yaml
  • openshift/pkg/otp/testdata/networking/service-generic-template.yaml
  • openshift/pkg/otp/testdata/networking/statefulset-hello.yaml
  • openshift/pkg/otp/testdata/networking/testpod.yaml
  • openshift/pkg/otp/utils/utils.go
  • openshift/test/otp/metrics.go
  • openshift/test/otp/networkpolicy.go
✅ Files skipped from review due to trivial changes (8)
  • openshift/pkg/otp/testdata/networking/networkpolicy/default-allow-egress.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-to-same-namespace.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-single-CIDR-template.yaml
  • openshift/pkg/otp/testdata/networking/OWNERS
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-ingress-single-multiple-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/netpol-30920-75540.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-ingress-red.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-single-multiple-CIDRs-template.yaml
🚧 Files skipped from review as they are similar to previous changes (25)
  • openshift/pkg/otp/testdata/networking/networkpolicy/ingress-allow-all.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-dual-multiple-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-egress-red.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/generic-networkpolicy-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-ingress-dual-multiple-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-to-openshift-dns.yaml
  • openshift/pkg/otp/testdata/networking/ping-for-pod-specific-node-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-except-single-CIDR-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/egress_49696.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-from-all-namespaces.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/default-deny-ingress.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-ingress-dual-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/vap-npprotection-blockdeletion.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ingress_49696.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/default-deny-egress.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/allow-same-namespace.yaml
  • openshift/pkg/otp/testdata/networking/service-generic-template.yaml
  • openshift/test/otp/metrics.go
  • openshift/pkg/otp/testdata/networking/ping-for-pod-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-except-dual-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-ingress-single-CIDR-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/ipblock/ipBlock-egress-dual-CIDRs-template.yaml
  • openshift/pkg/otp/testdata/networking/networkpolicy/egress-ingress-62524.yaml
  • openshift/cmd/ovn-kubernetes-tests-ext/main.go
  • openshift/go.mod

Comment thread openshift/test/otp/networkpolicy.go Outdated
Comment on lines +2105 to +2110
checkErr = wait.PollUntilContextTimeout(context.Background(), 10*time.Second, 300*time.Second, false, func(cxt context.Context) (bool, error) {
checkMemory2, err := exec.Command("bash", "-c", checkMemoryCmd).CombinedOutput()
o.Expect(err).NotTo(o.HaveOccurred())
if string(checkMemory2) == string(checkMemory1) {
e2e.Logf("Memory usage is the same as previous.")
return true, nil

Copy link
Copy Markdown

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

Exact memory-string equality makes this stress test flaky.

oc adm top pod values naturally fluctuate; requiring byte-for-byte equality can fail healthy runs. Compare parsed memory against a tolerance window instead.

🧪 Suggested stabilization
-			if string(checkMemory2) == string(checkMemory1) {
+			base := strings.TrimSpace(string(checkMemory1))
+			curr := strings.TrimSpace(string(checkMemory2))
+			parseMi := func(s string) (int, error) {
+				fields := strings.Fields(s)
+				if len(fields) < 2 {
+					return 0, fmt.Errorf("unexpected top output: %q", s)
+				}
+				mem := strings.TrimSuffix(fields[1], "Mi")
+				return strconv.Atoi(mem)
+			}
+			baseMi, err1 := parseMi(base)
+			currMi, err2 := parseMi(curr)
+			if err1 == nil && err2 == nil && abs(currMi-baseMi) <= 20 {
 				e2e.Logf("Memory usage is the same as previous.")
 				return true, nil
 			}
func abs(v int) int {
	if v < 0 {
		return -v
	}
	return v
}
🧰 Tools
🪛 OpenGrep (1.22.0)

[ERROR] 2106-2106: Dynamic command passed to exec.Command with a shell invocation. Pass arguments directly to exec.Command without a shell wrapper.

(coderabbit.command-injection.go-exec-command)

🤖 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 `@openshift/test/otp/networkpolicy.go` around lines 2105 - 2110, The test
currently compares raw byte output of checkMemory2 vs checkMemory1 inside the
anonymous function passed to wait.PollUntilContextTimeout, which is flaky;
instead parse the memory values from checkMemoryCmd output (use checkMemory2 and
checkMemory1), convert to a numeric value (e.g., KiB/MiB as integers), compute
the absolute difference (add a small helper like abs(int) if needed), and return
success if the difference is within a tolerance window (e.g., a few percent or
fixed KB); update the anonymous function logic to log differences and only fail
on parse errors or when the difference exceeds the tolerance.

@asood-rh

asood-rh commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Tests are passing e2e-aws-ovn job

started: 0/151/510 "[sig-networking] OVN metrics [OTP] 45841-Add OVN flow count metric"
passed: (20.2s) 2026-06-08T23:33:06 "[sig-networking] OVN metrics [OTP] 45841-Add OVN flow count metric"

started: 0/257/510 "[sig-networking] OVN metrics [OTP] 47471-Record update to cache versus port binding"
passed: (1m7s) 2026-06-08T23:34:55 "[sig-networking] OVN metrics [OTP] 47471-Record update to cache versus port binding"

started: 2/436/510 "[sig-networking] OVN metrics [OTP] 52072-Add mechanism to record duration for k8 kinds"
passed: (17s) 2026-06-08T23:36:16 "[sig-networking] OVN metrics [OTP] 52072-Add mechanism to record duration for k8 kinds"

@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: 4

🧹 Nitpick comments (1)
openshift/test/otp/metrics.go (1)

382-382: ⚡ Quick win

Handle error in deferred cleanup to avoid silent failures.

The deferred label removal at line 382 discards the result. If the cleanup fails, the namespace label will persist without any indication in the test output.

♻️ Proposed fix
 		oc.SetupProject()
-		defer oc.AsAdmin().WithoutNamespace().Run("label").Args("ns", oc.Namespace(), "name-").Output()
+		defer func() {
+			if _, err := oc.AsAdmin().WithoutNamespace().Run("label").Args("ns", oc.Namespace(), "name-").Output(); err != nil {
+				e2e.Logf("Warning: failed to remove namespace label: %v", err)
+			}
+		}()
 		_, labelErr := oc.AsAdmin().WithoutNamespace().Run("label").Args("ns", oc.Namespace(), "name=test").Output()
🤖 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 `@openshift/test/otp/metrics.go` at line 382, The deferred cleanup currently
discards output from oc.AsAdmin().WithoutNamespace().Run("label").Args("ns",
oc.Namespace(), "name-").Output(), so capture its (out, err) in a defer func and
handle errors instead of ignoring them; e.g., wrap the call in defer func() {
out, err := oc.AsAdmin().WithoutNamespace().Run("label").Args("ns",
oc.Namespace(), "name-").Output(); if err != nil { t.Logf("failed to remove
namespace label: %v, output: %s", err, out) } }() (use the test context variable
like t to log the failure).
🤖 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 `@openshift/test/otp/metrics.go`:
- Line 274: The strconv.Atoi calls currently ignore errors (e.g.,
metricValue1Int, _ := strconv.Atoi(metricValue1)); update each to capture and
handle the error: use metricValue1Int, err := strconv.Atoi(metricValue1) and if
err != nil { t.Fatalf("failed to parse metricValue1=%q: %v", metricValue1, err)
} (or the test's equivalent error-fatal helper) and apply the same pattern for
the other occurrences (e.g., metricValue2/metricValueN at the other Atoi sites)
so parsing failures fail the test instead of silently using 0.
- Line 178: The current exec.Command usage building a shell pipeline with the
untrusted variable output (seen as metricOutput := exec.Command("bash", "-c",
"cat "+output+" | grep ...")) is vulnerable to command injection; replace both
occurrences with pure-Go file parsing: open the file named by output, scan lines
(bufio.Scanner), filter lines that contain the metric string
"openshift_unidle_events_total", count to the third match (to replicate awk
'NR==3') and split that line on whitespace to extract the second field, then use
that value instead of metricOutput; update the code paths that use
metricOutput/exec.Command (and any callers like GetOVNMetrics) to accept the
parsed string or value.
- Line 410: The call to strconv.Atoi that assigns metricValue1Int from
metricValue1 currently ignores the error; update the code around
metricValue1Int, strconv.Atoi, and metricValue1 to capture the returned error
(e.g., val, err := strconv.Atoi(metricValue1)) and handle it—if this is in a
test function, call t.Fatalf or t.Fatalf-like helper with a clear message
including metricValue1 and err, otherwise return the error or propagate it
appropriately—so invalid integer strings are detected instead of silently
becoming 0.
- Line 229: The current check uses string substring logic
(!strings.Contains(metricValue, metricNumber)) which fails for numeric
comparisons (e.g., "5" vs "15"); update the comparison in the metrics logic to
parse both metricValue and metricNumber as integers (using strconv.Atoi or
strconv.ParseInt), handle parse errors (log/return on error), and then compare
the numeric values for inequality to decide whether
openshift_unidle_events_total changed instead of using strings.Contains. Target
the variables metricValue and metricNumber (and the surrounding metric
evaluation/polling block) when making this change.

---

Nitpick comments:
In `@openshift/test/otp/metrics.go`:
- Line 382: The deferred cleanup currently discards output from
oc.AsAdmin().WithoutNamespace().Run("label").Args("ns", oc.Namespace(),
"name-").Output(), so capture its (out, err) in a defer func and handle errors
instead of ignoring them; e.g., wrap the call in defer func() { out, err :=
oc.AsAdmin().WithoutNamespace().Run("label").Args("ns", oc.Namespace(),
"name-").Output(); if err != nil { t.Logf("failed to remove namespace label: %v,
output: %s", err, out) } }() (use the test context variable like t to log the
failure).
🪄 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: Path: .coderabbit.yml

Review profile: CHILL

Plan: Enterprise

Run ID: 8c19a4c3-6ad3-4982-ab39-44eb4fb2207f

📥 Commits

Reviewing files that changed from the base of the PR and between d208090 and c85f9da.

📒 Files selected for processing (4)
  • openshift/pkg/otp/testdata/networking/egressip-config1-template.yaml
  • openshift/pkg/otp/testdata/networking/metrics/metrics-pod.yaml
  • openshift/pkg/otp/utils/utils.go
  • openshift/test/otp/metrics.go

Comment thread openshift/test/otp/metrics.go Outdated
Comment thread openshift/test/otp/metrics.go Outdated
Comment thread openshift/test/otp/metrics.go Outdated
Comment thread openshift/test/otp/metrics.go Outdated
@asood-rh asood-rh changed the title CORENET-7129 Add OVN metrics tests as blocking OTP tests CORENET-7129 Add OVN metrics tests as OTP tests Jun 12, 2026
Comment thread openshift/test/otp/networkpolicy.go Outdated
@@ -0,0 +1,2117 @@
package otp

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@asood-rh Thanks. Seems like networkpolicy.go commit came here by mistake? I guess you just meant metrics.go only

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@anuragthehatter In order to use the utils library I created branch off your branch. I do have few changes to ensure metrics tests executed successfully. Will need to deal with merges unless you want to pick up changes in utils.go. I can rebase my branch with yours.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@asood-rh np at all, as long as you are aware of

}
})

g.It("[OTP] 45841-Add OVN flow count metric", func() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@asood-rh Thanks, Please add [JIRA:Networking] tag as well to all cases as per OTE guide requirement.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

o.Expect(metricsOutput).NotTo(o.HaveOccurred(), "Fail to get updated metric openshift_unidle_events_total")
})

g.It("[Serial] [OTP] 60539-Verify metrics ovs_vswitchd_interfaces_total", func() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[serial] wont work here. If we want to make all cases serial, I would just add [Suite:openshift/conformance/serial] tag in g.Describe.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Or if we want to make specific cases serial, I would siffix them with g.serial suffix tag like you have done in one of them

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ah i might be wrong [serial] should also work. Unless dev has any recommendation to be consistent with g.serial or openshift/conformance/seria logic.

asood-rh added 6 commits June 16, 2026 22:06
Migrate three OVN metrics tests from openshift-tests-private:
  - 45841: ovn_controller_integration_bridge_openflow_total (flow count)
  - 47471: pod-to-port-binding duration metrics (4 metrics)
  - 52072: network programming duration histogram metrics (2 metrics)

All three registered as blocking via otpBlockingTests.

Depends-On: openshift#3200" for utils.go

Signed-off-by: Arti Sood <asood@redhat.com>
Signed-off-by: Arti Sood <asood@redhat.com>
  Add tests 45689, 47524, 60539, 60704, 60708 from openshift-tests-private.
  Fix GetControllerManagerLeaderIP for new lease holderIdentity format.
  Fix oc idle to run as admin. Remove spurious quotes from GetSpecificPodLogs

Signed-off-by: Arti Sood <asood@redhat.com>
  1. utils.go — Added ExtractMetricValue() helper (pure Go replacement for shell pipeline)
  2. metrics.go — Replaced two exec.Command("bash", "-c", ...) calls with otputils.ExtractMetricValue(); removed "os/exec" import
  3. metrics.go — Replaced !strings.Contains(metricValue, metricNumber) with integer comparison (currentValue > baselineValue) in test 45689
  4. metrics.go — Added error handling on baseline strconv.Atoi calls in tests 60539 and 60708

Signed-off-by: Arti Sood <asood@redhat.com>
  - Blank import openshift/test/otp to register OTP Ginkgo specs
  - Add exutil.WithCleanup() to initialize origin's test lifecycle
  - Add OTP lifecycle logic: informing by default, blocking if matched
    by otpBlockingTests

Signed-off-by: Arti Sood <asood@redhat.com>
@openshift-ci openshift-ci Bot removed the do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. label Jun 17, 2026
@anuragthehatter

Copy link
Copy Markdown

Thanks Arti.
lgtm to me, lets wait for results

@asood-rh

Copy link
Copy Markdown
Contributor Author

Thanks Arti. lgtm to me, lets wait for results
Could we assign dev to it as well?
I believe we will have to deal with CI failures as they may not be related to tests.

@openshift-ci

openshift-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

@asood-rh: 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/4.22-upgrade-from-stable-4.21-e2e-aws-ovn-upgrade 0187a5f link true /test 4.22-upgrade-from-stable-4.21-e2e-aws-ovn-upgrade
ci/prow/4.22-upgrade-from-stable-4.21-e2e-gcp-ovn-rt-upgrade 0187a5f link true /test 4.22-upgrade-from-stable-4.21-e2e-gcp-ovn-rt-upgrade
ci/prow/5.0-upgrade-from-stable-4.22-e2e-aws-ovn-upgrade 1ee7c84 link true /test 5.0-upgrade-from-stable-4.22-e2e-aws-ovn-upgrade
ci/prow/e2e-gcp-ovn 1ee7c84 link true /test e2e-gcp-ovn
ci/prow/e2e-aws-ovn-upgrade-local-gateway 1ee7c84 link true /test e2e-aws-ovn-upgrade-local-gateway
ci/prow/e2e-aws-ovn-rhcos10-techpreview 1ee7c84 link false /test e2e-aws-ovn-rhcos10-techpreview
ci/prow/security 1ee7c84 link false /test security
ci/prow/e2e-metal-ipi-ovn-dualstack-bgp 1ee7c84 link true /test e2e-metal-ipi-ovn-dualstack-bgp
ci/prow/e2e-metal-ipi-ovn-dualstack 1ee7c84 link true /test e2e-metal-ipi-ovn-dualstack
ci/prow/e2e-metal-ipi-ovn-ipv6 1ee7c84 link true /test e2e-metal-ipi-ovn-ipv6
ci/prow/e2e-aws-ovn-local-to-shared-gateway-mode-migration 1ee7c84 link true /test e2e-aws-ovn-local-to-shared-gateway-mode-migration
ci/prow/e2e-metal-ipi-ovn-dualstack-bgp-local-gw 1ee7c84 link true /test e2e-metal-ipi-ovn-dualstack-bgp-local-gw
ci/prow/e2e-gcp-ovn-techpreview 1ee7c84 link true /test e2e-gcp-ovn-techpreview
ci/prow/5.0-upgrade-from-stable-4.22-e2e-gcp-ovn-rt-upgrade 1ee7c84 link true /test 5.0-upgrade-from-stable-4.22-e2e-gcp-ovn-rt-upgrade
ci/prow/unit 1ee7c84 link true /test unit
ci/prow/e2e-aws-ovn-hypershift 1ee7c84 link true /test e2e-aws-ovn-hypershift
ci/prow/e2e-aws-ovn-local-gateway 1ee7c84 link true /test e2e-aws-ovn-local-gateway
ci/prow/e2e-aws-ovn-upgrade 1ee7c84 link true /test e2e-aws-ovn-upgrade
ci/prow/e2e-aws-ovn 1ee7c84 link true /test e2e-aws-ovn
ci/prow/e2e-aws-ovn-edge-zones 1ee7c84 link true /test e2e-aws-ovn-edge-zones
ci/prow/e2e-aws-ovn-shared-to-local-gateway-mode-migration 1ee7c84 link true /test e2e-aws-ovn-shared-to-local-gateway-mode-migration
ci/prow/e2e-azure-ovn-upgrade 1ee7c84 link true /test e2e-azure-ovn-upgrade

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants