Skip to content

Stor 2974: Support running e2e tests against a pre-deployed driver - #154

Open
rvagner78 wants to merge 2 commits into
openshift:masterfrom
rvagner78:stor-2974
Open

Stor 2974: Support running e2e tests against a pre-deployed driver#154
rvagner78 wants to merge 2 commits into
openshift:masterfrom
rvagner78:stor-2974

Conversation

@rvagner78

@rvagner78 rvagner78 commented Jul 30, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • New Features

    • Added OpenShift end-to-end test support for the Azure Disk CSI Driver.
    • Added coverage for pre-provisioned volumes, shared disks, PremiumV2 disks, reattachment, and inline volumes.
    • Included the OpenShift test extension in the container image.
  • Improvements

    • Enabled test execution without driver installation when requested.
    • Improved driver restart checks for custom namespaces.
    • Added environment-aware handling for Windows, migration, and regional scenarios.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8f9e7fcd-1a7a-46b1-b3b6-e2ec10b0e36b

📥 Commits

Reviewing files that changed from the base of the PR and between 77d019e and 8027fbf.

⛔ Files ignored due to path filters (1)
  • cmd/openshift-tests-extension/go.sum is excluded by !**/*.sum
📒 Files selected for processing (7)
  • Dockerfile.openshift.rhel7
  • cmd/openshift-tests-extension/go.mod
  • cmd/openshift-tests-extension/main.go
  • test/e2e/dynamic_provisioning.go
  • test/e2e/pre_provisioning.go
  • test/e2e/suite.go
  • test/e2e/suite_test.go
🚧 Files skipped from review as they are similar to previous changes (5)
  • Dockerfile.openshift.rhel7
  • test/e2e/dynamic_provisioning.go
  • cmd/openshift-tests-extension/main.go
  • test/e2e/suite_test.go
  • test/e2e/suite.go

Walkthrough

Adds an OpenShift test-extension CLI and packages it in the RHEL image. The E2E suite adds pre-provisioned volume tests, environment-gated setup and teardown, shared helpers, and configurable driver diagnostic namespaces.

Changes

OpenShift E2E integration

Layer / File(s) Summary
Build and register the OpenShift test extension
cmd/openshift-tests-extension/*, Dockerfile.openshift.rhel7
Defines the extension module and CLI, registers Azure Disk test specifications, builds the compressed binary, and copies it into the final image.
Configure E2E runtime and driver diagnostics
test/e2e/suite.go, test/e2e/suite_test.go, test/e2e/dynamic_provisioning.go, test/utils/check_driver_pods_restart.sh
Adds shared runtime helpers and gates driver setup, cleanup, and restart checks with SKIP_DRIVER_INSTALL. Diagnostic commands use DRIVER_NAMESPACE, which defaults to kube-system.
Add pre-provisioned volume scenarios
test/e2e/pre_provisioning.go
Adds tests for read-only mounts, reclaim policies, shared disks, PremiumV2 disks, dangling attachments, and inline-volume migration.

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

Suggested reviewers: mpatlasov, romanbednar

Sequence Diagram(s)

sequenceDiagram
  participant OpenShiftCLI
  participant AzureDiskExtension
  participant AzureDiskE2ETests
  participant RHELImage
  OpenShiftCLI->>AzureDiskExtension: Register and run extension commands
  AzureDiskExtension->>AzureDiskE2ETests: Select Azure test specifications
  RHELImage->>OpenShiftCLI: Provide compressed test binary
Loading

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (2 errors, 3 warnings)

Check name Status Explanation Resolution
Ote Binary Stdout Contract ❌ Error OTE blank-imports e2e; top-level Ginkgo registration calls klog.Infof before JSON output, with no klog stderr redirect. AfterSuite also forwards shell stdout to os.Stdout. Call klog.LogToStderr(true) or klog.SetOutput(os.Stderr) before imports can log, and route AfterSuite subprocess output to stderr or GinkgoWriter.
No-Sensitive-Data-In-Logs ❌ Error New pre-provisioning tests log raw resp.Volume.VolumeId via ginkgo.By; CreateVolume returns an Azure ARM URI containing subscription, resource-group, and disk identifiers. Redact or hash volume IDs in ginkgo.By and failure messages. Log only a non-sensitive correlation value.
Test Structure And Quality ⚠️ Warning pre_provisioning.go:314-320 creates an Azure disk and sets skipVolumeDeletion=true, while inline setup has no cleanup; suite assertions also omit meaningful failure messages. Delete the inline test disk in AfterEach or register guaranteed cleanup, including failure paths; add context to each ExpectNoError assertion.
Microshift Test Compatibility ⚠️ Warning The OpenShift extension exposes the XFS snapshot test, whose helper requires pod anti-affinity across different nodes; it has no MicroShift guard or label and cannot run on single-node MicroShift. Add [Skipped:MicroShift] or an IsMicroShiftCluster()/g.Skip guard to the XFS snapshot test, or validate it with the required MicroShift CI job.
Ipv6 And Disconnected Network Test Compatibility ⚠️ Warning New pre-provisioned It() cases call Azure CreateVolume/DeleteVolume; suite setup calls Azure ARM, and Windows pods use mcr.microsoft.com. No IPv4 literals were found, but disconnected CI lacks thes... Add [Skipped:Disconnected] when Azure ARM/MCR access is unavailable, or use private endpoints and mirrored images; run the recommended IPv6 CI job.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: enabling E2E tests against a pre-deployed driver.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The PR adds no Ginkgo title lines; renamed suites retain existing titles, and the only formatted titles use fixed Retain/Delete constants, not run-specific values.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR adds no new Ginkgo test declarations: pre_provisioning.go is a 100% rename and dynamic_provisioning.go is a 99% rename; suite.go adds only helpers.
Topology-Aware Scheduling Compatibility ✅ Passed The patch changes a Dockerfile, dependency metadata, and E2E test code only; it adds no deployment manifests, operator/controller code, or topology scheduling constraints.
No-Weak-Crypto ✅ Passed The added patch has no MD5, SHA1, DES, RC4, Blowfish, or ECB matches; changed Go files import no crypto packages and contain no weak APIs, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The patch adds no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, allowPrivilegeEscalation, or securityContext settings; the Dockerfile runtime user is unchanged.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci
openshift-ci Bot requested review from RomanBednar and mpatlasov July 30, 2026 15:17
@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

@rvagner78

Copy link
Copy Markdown
Author

/payload-job-with-prs periodic-ci-openshift-azure-disk-csi-driver-master-e2e-azure-csi openshift/origin#31455

@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown

@rvagner78: trigger 0 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

@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: 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 `@cmd/openshift-tests-extension/go.mod`:
- Around line 111-124: Update the cmd/openshift-tests-extension module graph so
google.golang.org/grpc and golang.org/x/crypto resolve to patched versions
beyond the reported CVEs, then regenerate the corresponding go.mod, go.sum, and
vendor metadata. Preserve dependency consistency across the CSI imports and the
rest of the module graph.

In `@cmd/openshift-tests-extension/main.go`:
- Line 18: Handle both ignored environment-mutation errors: in
cmd/openshift-tests-extension/main.go at line 18, check the error from setting
SKIP_DRIVER_INSTALL and fail the command if it fails; in test/e2e/suite_test.go
at lines 48-51, assert that updating KUBECONFIG succeeds before continuing suite
setup.

In `@test/e2e/pre_provisioning.go`:
- Around line 260-263: Mark the “should succeed when reattaching a disk to a new
node on DanglingAttachError [disk.csi.azure.com]” spec as unsupported on
single-replica topologies. Add the [Skipped:SingleReplicaTopology] label to the
Ginkgo test title or invoke the established single-node skip helper alongside
skipIfUsingInTreeVolumePlugin and skipIfOnAzureStackCloud.
- Around line 147-153: Update both CreateVolume specs in
test/e2e/pre_provisioning.go at lines 147-153 and 242-248 to derive the Azure
location from cluster node topology labels or the existing environment-variable
mechanism instead of hardcoding regions; at the first site, also reconsider the
cost of the 512 GiB Premium disk, and at the second, gate the PremiumV2 scenario
on actual PremiumV2 availability rather than a region literal.
- Around line 170-178: Update the shared-disk setup in makeCreateVolumeReq to
use a Premium_LRS disk size of at least 256Gi while retaining maxshares set to
"2", and ensure diskSize reflects the same sharedDiskSize value.
- Around line 306-314: Update the skip message in the inline-volume spec guarded
by isUsingInTreeVolumePlugin to state that the test is available only for the
in-tree volume plugin. Add a concise comment next to skipVolumeDeletion = true
explaining which external cleanup process reclaims the intentionally retained 10
GiB disk.
- Around line 58-68: Reset volumeID to an empty value in the BeforeEach setup
alongside skipVolumeDeletion, and update the AfterEach cleanup to delete only
when cleanup is enabled and volumeID is non-empty. Correct the DeleteVolume
failure message to describe deletion rather than creation.

In `@test/e2e/suite.go`:
- Around line 76-81: Update execTestCmd and its setup/teardown callers to accept
and propagate Ginkgo’s SpecContext, then replace exec.Command with
exec.CommandContext using that context. Add a bounded timeout and ensure
cancellation terminates the command and any stalled child processes while
preserving existing command output and error assertions.
- Around line 78-79: Update the command stream assignments in the suite-hook
helper so child stdout is directed to os.Stderr instead of os.Stdout, preventing
non-JSON output from corrupting the OTE protocol; keep stderr forwarding to
os.Stderr unchanged.

In `@test/utils/check_driver_pods_restart.sh`:
- Around line 39-42: Update the previous-container log command in the restart
diagnostic path to use the configurable DRIVER_CONTAINER variable, defaulting to
azuredisk when unset, while preserving the existing namespace configuration and
kubectl logs behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 87ae8c97-724c-4b9f-b346-7891251b9fc4

📥 Commits

Reviewing files that changed from the base of the PR and between e87f776 and 366d45f.

⛔ Files ignored due to path filters (1)
  • cmd/openshift-tests-extension/go.sum is excluded by !**/*.sum
📒 Files selected for processing (8)
  • Dockerfile.openshift.rhel7
  • cmd/openshift-tests-extension/go.mod
  • cmd/openshift-tests-extension/main.go
  • test/e2e/dynamic_provisioning.go
  • test/e2e/pre_provisioning.go
  • test/e2e/suite.go
  • test/e2e/suite_test.go
  • test/utils/check_driver_pods_restart.sh

Comment on lines +111 to +124
golang.org/x/crypto v0.49.0 // indirect
golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect
golang.org/x/mod v0.33.0 // indirect
golang.org/x/net v0.52.0 // indirect
golang.org/x/oauth2 v0.34.0 // indirect
golang.org/x/sync v0.20.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/term v0.41.0 // indirect
golang.org/x/text v0.35.0 // indirect
golang.org/x/time v0.14.0 // indirect
golang.org/x/tools v0.42.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260316180232-0b37fe3546d5 // indirect
google.golang.org/grpc v1.79.3 // indirect

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

curl -fsSL \
  -H 'Content-Type: application/json' \
  https://api.osv.dev/v1/querybatch \
  --data '{
    "queries": [
      {"package": {"ecosystem": "Go", "name": "golang.org/x/crypto"}, "version": "0.49.0"},
      {"package": {"ecosystem": "Go", "name": "google.golang.org/grpc"}, "version": "1.79.3"}
    ]
  }' | jq .

Repository: openshift/azure-disk-csi-driver

Length of output: 3408


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo '::group::Relevant go.mod lines'
sed -n '105,130p' cmd/openshift-tests-extension/go.mod || true
echo '::endgroup::'
echo '::group::Dependency path references'
rg -n 'golang\.org/x/crypto|google\.golang\.org/grpc|grpc|ssh|crypto/ssh' -S .

Repository: openshift/azure-disk-csi-driver

Length of output: 50388


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '::group::Go module file lines'
sed -n '105,130p' cmd/openshift-tests-extension/go.mod

echo '::endgroup::'
echo '::group::CVE severity details for first crypto and gRPC vuln'
python3 - <<'PY'
import json, urllib.request
packages = [
    ("golang.org/x/crypto", "0.49.0", "GHSA-5cgq-3rg8-m6cv"),
    ("google.golang.org/grpc", "1.79.3", "GHSA-hrxh-6v49-42gf"),
]
for pkg, ver, vuln_id in packages:
    req = urllib.request.Request("https://api.osv.dev/v1/vulns/" + vuln_id)
    try:
        with urllib.request.urlopen(req, timeout=20) as resp:
            data = json.load(resp)
        print(f"{pkg}@{ver} references {vuln_id}: severity={data.get('severity')} summary={data.get('details','')[:220]}")
    except Exception as e:
        print(f"{pkg}@{ver} references {vuln_id}: ERROR {e}")
PY

echo '::endgroup::'
echo '::group::Search for direct crypto/ssh or grpc imports in non-vendor code'
rg -n '"golang\.org/x/crypto/ssh"|"golang\.org/x/crypto"|google\.golang\.org/grpc|grpc\.' --glob '!vendor/**' --glob '!cmd/openshift-tests-extension/go.mod' --glob '!go.sum' .

Repository: openshift/azure-disk-csi-driver

Length of output: 5142


Upgrade the dependency graph past the reported CVEs.

google.golang.org/grpc v1.79.3 resolves to public advisories and is directly imported by the CSI code path; golang.org/x/crypto v0.49.0 also resolves to public advisories. Update the module graph to patched versions and regenerate module/vendor metadata.

🤖 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 `@cmd/openshift-tests-extension/go.mod` around lines 111 - 124, Update the
cmd/openshift-tests-extension module graph so google.golang.org/grpc and
golang.org/x/crypto resolve to patched versions beyond the reported CVEs, then
regenerate the corresponding go.mod, go.sum, and vendor metadata. Preserve
dependency consistency across the CSI imports and the rest of the module graph.

Sources: Path instructions, Linters/SAST tools

)

func main() {
os.Setenv("SKIP_DRIVER_INSTALL", "true")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Handle both environment-mutation errors.

  • cmd/openshift-tests-extension/main.go#L18-L18: fail the command if setting SKIP_DRIVER_INSTALL fails.
  • test/e2e/suite_test.go#L48-L51: assert the KUBECONFIG environment update succeeds before continuing suite setup.

As per path instructions, “Never ignore error returns.”

📍 Affects 2 files
  • cmd/openshift-tests-extension/main.go#L18-L18 (this comment)
  • test/e2e/suite_test.go#L48-L51
🤖 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 `@cmd/openshift-tests-extension/main.go` at line 18, Handle both ignored
environment-mutation errors: in cmd/openshift-tests-extension/main.go at line
18, check the error from setting SKIP_DRIVER_INSTALL and fail the command if it
fails; in test/e2e/suite_test.go at lines 48-51, assert that updating KUBECONFIG
succeeds before continuing suite setup.

Source: Path instructions

Comment thread test/e2e/suite.go
Comment on lines +76 to +81
cmdSh := exec.Command(cmd.command, cmd.args...)
cmdSh.Dir = projectRoot
cmdSh.Stdout = os.Stdout
cmdSh.Stderr = os.Stderr
err = cmdSh.Run()
gomega.Expect(err).NotTo(gomega.HaveOccurred())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C2 '\bexec\.Command\(' test/e2e
rg -n -C2 '\bexecTestCmd\s*\(' test/e2e

Repository: openshift/azure-disk-csi-driver

Length of output: 3346


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== suite.go excerpt =="
sed -n '1,140p' test/e2e/suite.go

echo
echo "== suite_test.go relevant hooks =="
sed -n '70,125p' test/e2e/suite_test.go
sed -n '140,205p' test/e2e/suite_test.go

Repository: openshift/azure-disk-csi-driver

Length of output: 9648


Make suite teardown/setup commands cancellable and bounded.

execTestCmd() runs make and e2e scripts with exec.Command().Run() inside both setup and teardown paths, so a stalled shell/background process can block suite setup/teardown indefinitely. Thread Ginkgo’s SpecContext through this helper and use exec.CommandContext(context) with a timeout/kill mechanism for these commands.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/suite.go` around lines 76 - 81, Update execTestCmd and its
setup/teardown callers to accept and propagate Ginkgo’s SpecContext, then
replace exec.Command with exec.CommandContext using that context. Add a bounded
timeout and ensure cancellation terminates the command and any stalled child
processes while preserving existing command output and error assertions.

Source: Path instructions

Comment thread test/e2e/suite.go
Comment on lines +39 to +42
kubectl describe pod "$POD_WITH_RESTART" --namespace "${DRIVER_NAMESPACE}"
echo "======================================================================================"
echo "print previous azuredisk container logs since there is a restart"
kubectl logs "$POD_WITH_RESTART" --container azuredisk --previous --namespace kube-system
kubectl logs "$POD_WITH_RESTART" --container azuredisk --previous --namespace "${DRIVER_NAMESPACE}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
fd -t f 'check_driver_pods_restart.sh' --exec sed -n '1,45p'
rg -nP -C2 'name:\s*azuredisk\b' --iglob '*.yaml' | head -40

Repository: openshift/azure-disk-csi-driver

Length of output: 1950


🏁 Script executed:

#!/bin/bash
set -u

echo "== script file and relevant usage =="
fd -t f 'check_driver_pods_restart.sh' -x sh -c 'wc -l "$1"; sed -n "1,90p" "$1"' sh {}
echo
echo "== call sites =="
rg -n -C3 'check_driver_pods_restart|get_env_variable|DRIVER_NAMESPACE|azuredisk' test --glob '*.{go,sh,yaml,yml}' || true
echo
echo "== container names in manifests and helm/template candidates =="
fd -t f . | rg -i '(^|/)(.*yaml$|.*yml$|values.*yaml$|templates/.*yaml$)' 2>/dev/null | head -200
rg -n -C2 'containerName|name:\s*azuredisk|azuredisk' manifest manifests helm charts config --glob '*.yaml' --glob '*.yml' --glob '*.tpl' --glob '*.tmpl' --glob 'values*.yaml' 2>/dev/null || true
echo
echo "== dockerfile/csi driver container references =="
rg -n 'containerName|azuredisk' .dockerfile Dockerfile . --glob 'Dockerfile*' --glob 'Dockerfile' --glob '*Dockerfile*' --glob '*.go' | head -120

Repository: openshift/azure-disk-csi-driver

Length of output: 50388


🏁 Script executed:

#!/bin/bash
set -u

echo "== exact test file bytes and line count =="
wc -l test/utils/check_driver_pods_restart.sh test/e2e/suite_test.go
sed -n '1,90p' test/utils/check_driver_pods_restart.sh
echo
echo "== error handling / suite test call site =="
rg -n -C4 'check_driver_pods_restart|DriverRestart|DRIVER_NAMESPACE|kubectl|exec' test/e2e suite_test.go test --glob '*.go' 2>/dev/null || true
echo
echo "== container names exact templates only (non-snippet) =="
python3 - <<'PY'
import subprocess, re
files = subprocess.check_output(['git','ls-files'], text=True).splitlines()
matches = []
path_re = re.compile(r'(charts|manifests).*\.ya?ml$')
name_re = re.compile(r'^\s*-\s*name\s*:\s*(.+)$', re.M)
for f in files:
    if not path_re.search(f):
        continue
    txt = subprocess.check_output(['sed','-n','1,360p', f], text=True)
    if 'azuredisk' in txt:
        for i, line in enumerate(txt.splitlines(), 1):
            m = re.match(r'\s*-\s*name\s*:\s*(.+)', line)
            if m:
                matches.append((f,i,m.group(1).strip()))
seen = {}
for fm,i, name in sorted(set(matches), key=lambda x:(x[0],x[1])):
    if name != 'azuredisk':
        seen.setdefault(fm,[]).append((i,name))
print("non-azuredisk azuredisk-related manifests:")
for f, items in sorted(seen.items()):
    print(f)
    for i,val in items[:10]:
        print(f"  {i}: {val}")
print("total non-azuredisk matches:", len(seen))
PY
echo
echo "== all hardcoded container names in driver node/controller manifests =="
python3 - <<'PY'
import subprocess
files = subprocess.check_output(['git','ls-files'], text=True).splitlines()
for f in files:
    if not ('charts' in f or 'manifests' in f) and not (f.endswith('.yaml') or f.endswith('.yml')):
        continue
    txt = subprocess.check_output(['sed','-n','1,360p', f], text=True)
    if 'containers:' not in txt:
        continue
    lines = txt.splitlines()
    for idx,line in enumerate(lines):
        if line.strip() == 'containers:':
            start=max(0,idx-3); end=min(len(lines),idx+38)
            block='\n'.join(lines[start:end])
            if any(x in block for x in ['azuredisk','azuredisk-csi','csi-azuredisk']):
                print(f"--- {f} around line {idx+1} ---")
                for n,line in enumerate(lines[start:end], start+1):
                    if n<=end:
                        print(f"{n}: {line}")
PY

Repository: openshift/azure-disk-csi-driver

Length of output: 50388


🌐 Web query:

openshift azure-disk-csi-driver manifest container names name: azuredisk

💡 Result:

In the OpenShift Azure Disk CSI driver, the container within the CSI driver pods (such as the controller and node agent) is commonly referred to as azuredisk [1]. Technical documentation and debugging guides for the driver use this name when interacting with the pods via the command line, for example when retrieving logs or executing commands inside the container [1]: kubectl logs -c azuredisk -n kubectl exec -it -c azuredisk -n -- While the OpenShift component itself may be referred to in build metadata or internal product manifests by names such as ose-azure-disk-csi-driver [2][3], the specific container runtime name defined within the deployed CSI driver manifests for the application logic remains azuredisk [1].

Citations:


Make the log container configurable when the namespace is configurable.

This diagnostic path is already invoked by the e2e suite via execTestCmd, so a non-zero kubectl logs -c azuredisk exit aborts the test. The current charts/templates use azuredisk, but pre-deployed installs can redefine the container name, so using ${DRIVER_CONTAINER:-azuredisk} would prevent this from failing when logs are most needed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/utils/check_driver_pods_restart.sh` around lines 39 - 42, Update the
previous-container log command in the restart diagnostic path to use the
configurable DRIVER_CONTAINER variable, defaulting to azuredisk when unset,
while preserving the existing namespace configuration and kubectl logs behavior.

@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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

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 `@cmd/openshift-tests-extension/go.mod`:
- Around line 111-124: Update the cmd/openshift-tests-extension module graph so
google.golang.org/grpc and golang.org/x/crypto resolve to patched versions
beyond the reported CVEs, then regenerate the corresponding go.mod, go.sum, and
vendor metadata. Preserve dependency consistency across the CSI imports and the
rest of the module graph.

In `@cmd/openshift-tests-extension/main.go`:
- Line 18: Handle both ignored environment-mutation errors: in
cmd/openshift-tests-extension/main.go at line 18, check the error from setting
SKIP_DRIVER_INSTALL and fail the command if it fails; in test/e2e/suite_test.go
at lines 48-51, assert that updating KUBECONFIG succeeds before continuing suite
setup.

In `@test/e2e/pre_provisioning.go`:
- Around line 260-263: Mark the “should succeed when reattaching a disk to a new
node on DanglingAttachError [disk.csi.azure.com]” spec as unsupported on
single-replica topologies. Add the [Skipped:SingleReplicaTopology] label to the
Ginkgo test title or invoke the established single-node skip helper alongside
skipIfUsingInTreeVolumePlugin and skipIfOnAzureStackCloud.
- Around line 147-153: Update both CreateVolume specs in
test/e2e/pre_provisioning.go at lines 147-153 and 242-248 to derive the Azure
location from cluster node topology labels or the existing environment-variable
mechanism instead of hardcoding regions; at the first site, also reconsider the
cost of the 512 GiB Premium disk, and at the second, gate the PremiumV2 scenario
on actual PremiumV2 availability rather than a region literal.
- Around line 170-178: Update the shared-disk setup in makeCreateVolumeReq to
use a Premium_LRS disk size of at least 256Gi while retaining maxshares set to
"2", and ensure diskSize reflects the same sharedDiskSize value.
- Around line 306-314: Update the skip message in the inline-volume spec guarded
by isUsingInTreeVolumePlugin to state that the test is available only for the
in-tree volume plugin. Add a concise comment next to skipVolumeDeletion = true
explaining which external cleanup process reclaims the intentionally retained 10
GiB disk.
- Around line 58-68: Reset volumeID to an empty value in the BeforeEach setup
alongside skipVolumeDeletion, and update the AfterEach cleanup to delete only
when cleanup is enabled and volumeID is non-empty. Correct the DeleteVolume
failure message to describe deletion rather than creation.

In `@test/e2e/suite.go`:
- Around line 76-81: Update execTestCmd and its setup/teardown callers to accept
and propagate Ginkgo’s SpecContext, then replace exec.Command with
exec.CommandContext using that context. Add a bounded timeout and ensure
cancellation terminates the command and any stalled child processes while
preserving existing command output and error assertions.
- Around line 78-79: Update the command stream assignments in the suite-hook
helper so child stdout is directed to os.Stderr instead of os.Stdout, preventing
non-JSON output from corrupting the OTE protocol; keep stderr forwarding to
os.Stderr unchanged.

In `@test/utils/check_driver_pods_restart.sh`:
- Around line 39-42: Update the previous-container log command in the restart
diagnostic path to use the configurable DRIVER_CONTAINER variable, defaulting to
azuredisk when unset, while preserving the existing namespace configuration and
kubectl logs behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 87ae8c97-724c-4b9f-b346-7891251b9fc4

📥 Commits

Reviewing files that changed from the base of the PR and between e87f776 and 366d45f.

⛔ Files ignored due to path filters (1)
  • cmd/openshift-tests-extension/go.sum is excluded by !**/*.sum
📒 Files selected for processing (8)
  • Dockerfile.openshift.rhel7
  • cmd/openshift-tests-extension/go.mod
  • cmd/openshift-tests-extension/main.go
  • test/e2e/dynamic_provisioning.go
  • test/e2e/pre_provisioning.go
  • test/e2e/suite.go
  • test/e2e/suite_test.go
  • test/utils/check_driver_pods_restart.sh
🛑 Comments failed to post (5)
test/e2e/pre_provisioning.go (5)

58-68: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

volumeID is never reset between specs, so AfterEach can delete a stale volume or fail on an empty ID.

skipVolumeDeletion is reset in BeforeEach (Line 55) but volumeID is not. Any spec that skips (e.g. Lines 144-146, 239-241) or fails before CreateVolume leaves the previous spec's volumeID in scope, so AfterEach issues DeleteVolume against an already-deleted ID; for the first such spec the ID is "" and the driver error turns a skipped spec into a failure. The failure message also says "create volume" while deleting.

🐛 Reset the ID at setup and guard the teardown
 	ginkgo.BeforeEach(func(_ ginkgo.SpecContext) {
 		cs = f.ClientSet
 		ns = f.Namespace
 		testDriver = driver.InitAzureDiskDriver()
+		volumeID = ""
 		// reset value to false to default to volume clean up after test unless specified otherwise
 		skipVolumeDeletion = false
 	})
 
 	ginkgo.AfterEach(func(ctx ginkgo.SpecContext) {
-		if !skipVolumeDeletion {
+		if !skipVolumeDeletion && volumeID != "" {
 			req := &csi.DeleteVolumeRequest{
 				VolumeId: volumeID,
 			}
 			_, err := azurediskDriver.DeleteVolume(ctx, req)
 			if err != nil {
-				ginkgo.Fail(fmt.Sprintf("create volume %q error: %v", volumeID, err))
+				ginkgo.Fail(fmt.Sprintf("delete volume %q error: %v", volumeID, err))
 			}
 		}
 	})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/pre_provisioning.go` around lines 58 - 68, Reset volumeID to an
empty value in the BeforeEach setup alongside skipVolumeDeletion, and update the
AfterEach cleanup to delete only when cleanup is enabled and volumeID is
non-empty. Correct the DeleteVolume failure message to describe deletion rather
than creation.

Source: Coding guidelines


147-153: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Azure region is pinned in CreateVolume parameters instead of derived from the cluster. Both specs hardcode a location, so they fail or provision cross-region disks on any cluster outside that region; the shared fix is to resolve the region from node topology labels or an env var.

  • test/e2e/pre_provisioning.go#L147-L153: replace "location": "eastus2" with the cluster's region, and reconsider the 512 GiB Premium disk cost.
  • test/e2e/pre_provisioning.go#L242-L248: replace "location": "eastus" with the cluster's region and gate on PremiumV2 availability rather than a region literal.
📍 Affects 1 file
  • test/e2e/pre_provisioning.go#L147-L153 (this comment)
  • test/e2e/pre_provisioning.go#L242-L248
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/pre_provisioning.go` around lines 147 - 153, Update both
CreateVolume specs in test/e2e/pre_provisioning.go at lines 147-153 and 242-248
to derive the Azure location from cluster node topology labels or the existing
environment-variable mechanism instead of hardcoding regions; at the first site,
also reconsider the cost of the 512 GiB Premium disk, and at the second, gate
the PremiumV2 scenario on actual PremiumV2 availability rather than a region
literal.

170-178: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# How does the driver parse maxShares / enforce shared-disk size limits?
rg -nP -i --type=go -C3 '\bmaxshares\b' -g '!vendor/**'
rg -nP --type=go -C3 'maxShares' pkg/ | head -60

Repository: openshift/azure-disk-csi-driver

Length of output: 220


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Relevant e2e file lines:"
sed -n '135,190p' test/e2e/pre_provisioning.go 2>/dev/null || true
sed -n '190,235p' test/e2e/pre_provisioning.go 2>/dev/null || true

echo
echo "Search all files for maxshares/maxShares/enforce size constraints:"
rg -n -i -C2 'maxshares|maxShares|max_shares|max.*share|DiskSize|1024|iops|provision' . -g '!vendor/**' -g '!node_modules/**' | head -240

echo
echo "Directory listing for e2e and pkg related files:"
git ls-files | rg '(^test/e2e/|pkg/|go.mod|README)' | sed -n '1,200p'

Repository: openshift/azure-disk-csi-driver

Length of output: 35316


Use a valid Premium SSD shared-disk size for this test.

10Gi Premium SSD disks are below Azure’s supported size for shared disks; use at least 256Gi for Premium_LRS with maxShares: "2" so the CreateVolume path matches the intended shared-disk scenario.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/pre_provisioning.go` around lines 170 - 178, Update the shared-disk
setup in makeCreateVolumeReq to use a Premium_LRS disk size of at least 256Gi
while retaining maxshares set to "2", and ensure diskSize reflects the same
sharedDiskSize value.

260-263: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Multi-node-only spec has no Single Node OpenShift guard.

Reattaching a disk "to a new node" requires ≥2 schedulable nodes, so this will fail on SNO/single-replica topologies once the suite ships as an OTE extension. Add a [Skipped:SingleReplicaTopology] label to the title or a single-node skip helper alongside the existing skipIf* calls.

As per coding guidelines: "Flag tests expecting multiple control-plane nodes, multiple worker nodes, ... pod rescheduling to different nodes".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/pre_provisioning.go` around lines 260 - 263, Mark the “should
succeed when reattaching a disk to a new node on DanglingAttachError
[disk.csi.azure.com]” spec as unsupported on single-replica topologies. Add the
[Skipped:SingleReplicaTopology] label to the Ginkgo test title or invoke the
established single-node skip helper alongside skipIfUsingInTreeVolumePlugin and
skipIfOnAzureStackCloud.

Source: Coding guidelines


306-314: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Skip message contradicts its condition, and the disk is intentionally left behind with no owner.

Line 307 skips when the in-tree plugin is not in use, so the spec is in-tree-only — the message says the opposite. Also, skipVolumeDeletion = true (Line 314) disables teardown; add a comment explaining who reclaims the disk, otherwise every run leaks a 10 GiB disk.

🧹 Fix the skip message
 			if !isUsingInTreeVolumePlugin {
-				ginkgo.Skip("test case is only available for csi driver")
+				ginkgo.Skip("test case is only available for in-tree volume plugin")
 			}
📝 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.

		ginkgo.It("should create an inline volume by in-tree driver [kubernetes.io/azure-disk]", func(ctx ginkgo.SpecContext) {
			if !isUsingInTreeVolumePlugin {
				ginkgo.Skip("test case is only available for in-tree volume plugin")
			}
			if !isTestingMigration {
				ginkgo.Skip("test case is only available for migration test")
			}

			skipVolumeDeletion = true
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/pre_provisioning.go` around lines 306 - 314, Update the skip message
in the inline-volume spec guarded by isUsingInTreeVolumePlugin to state that the
test is available only for the in-tree volume plugin. Add a concise comment next
to skipVolumeDeletion = true explaining which external cleanup process reclaims
the intentionally retained 10 GiB disk.

@rvagner78

Copy link
Copy Markdown
Author

/payload-job-with-prs periodic-ci-openshift-release-main-ci-5.0-e2e-azure-ovn openshift/origin#31455

@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown

@rvagner78: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-e2e-azure-ovn

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/d66c44c0-8c2e-11f1-8da9-1bd31b2da99f-0

@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown

@rvagner78: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@rvagner78

Copy link
Copy Markdown
Author

/payload-job-with-prs periodic-ci-openshift-release-main-ci-5.0-e2e-azure-ovn openshift/origin#31455

@openshift-ci

openshift-ci Bot commented Jul 31, 2026

Copy link
Copy Markdown

@rvagner78: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-e2e-azure-ovn

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/6593e400-8cbb-11f1-99c7-9b2fe0c48d0b-0

@rvagner78

Copy link
Copy Markdown
Author

/payload-job-with-prs periodic-ci-openshift-release-main-ci-5.0-e2e-azure-ovn openshift/origin#31455

@openshift-ci

openshift-ci Bot commented Jul 31, 2026

Copy link
Copy Markdown

@rvagner78: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-e2e-azure-ovn

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/8b8e5880-8cbf-11f1-956e-1b4687d7a361-0

@rvagner78

Copy link
Copy Markdown
Author

/payload-job-with-prs periodic-ci-openshift-release-main-ci-5.0-e2e-azure-ovn openshift/origin#31455

@openshift-ci

openshift-ci Bot commented Jul 31, 2026

Copy link
Copy Markdown

@rvagner78: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-e2e-azure-ovn

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/fd2dedb0-8cde-11f1-8d3f-b712a6b01f12-0

@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.

♻️ Duplicate comments (1)
cmd/openshift-tests-extension/main.go (1)

23-23: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Handle both os.Setenv errors.

If either environment update fails, stop before the extension runs with an unintended driver-install or kubeconfig setting. The Line 23 instance repeats a previous finding.

Proposed fix
 func main() {
-	os.Setenv("SKIP_DRIVER_INSTALL", "true")
+	if err := os.Setenv("SKIP_DRIVER_INSTALL", "true"); err != nil {
+		panic(fmt.Sprintf("failed to set SKIP_DRIVER_INSTALL: %v", err))
+	}
@@
 	specs.AddBeforeAll(func() {
 		if os.Getenv("KUBECONFIG") == "" {
-			os.Setenv("KUBECONFIG", filepath.Join(os.Getenv("HOME"), ".kube", "config"))
+			if err := os.Setenv("KUBECONFIG", filepath.Join(os.Getenv("HOME"), ".kube", "config")); err != nil {
+				panic(fmt.Sprintf("failed to set KUBECONFIG: %v", err))
+			}
 		}

As per path instructions, “Never ignore error returns.”

#!/usr/bin/env bash
set -euo pipefail

if rg -n -P '^\s*os\.Setenv\s*\(' cmd/openshift-tests-extension/main.go; then
  echo "Found unchecked direct os.Setenv calls." >&2
  exit 1
fi

Also applies to: 50-53

🤖 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 `@cmd/openshift-tests-extension/main.go` at line 23, Handle the errors returned
by both os.Setenv calls in main, including the SKIP_DRIVER_INSTALL update and
the environment update around the referenced later block. Stop and return the
error before running the extension if either operation fails; do not leave any
direct unchecked os.Setenv calls.

Source: Path instructions

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

Duplicate comments:
In `@cmd/openshift-tests-extension/main.go`:
- Line 23: Handle the errors returned by both os.Setenv calls in main, including
the SKIP_DRIVER_INSTALL update and the environment update around the referenced
later block. Stop and return the error before running the extension if either
operation fails; do not leave any direct unchecked os.Setenv calls.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b90210da-6f14-49a9-85ac-ae38ac24de09

📥 Commits

Reviewing files that changed from the base of the PR and between 366d45f and 77d019e.

⛔ Files ignored due to path filters (1)
  • cmd/openshift-tests-extension/go.sum is excluded by !**/*.sum
📒 Files selected for processing (8)
  • Dockerfile.openshift.rhel7
  • cmd/openshift-tests-extension/go.mod
  • cmd/openshift-tests-extension/main.go
  • test/e2e/dynamic_provisioning.go
  • test/e2e/pre_provisioning.go
  • test/e2e/suite.go
  • test/e2e/suite_test.go
  • test/utils/check_driver_pods_restart.sh
🚧 Files skipped from review as they are similar to previous changes (6)
  • test/utils/check_driver_pods_restart.sh
  • Dockerfile.openshift.rhel7
  • test/e2e/dynamic_provisioning.go
  • test/e2e/suite.go
  • test/e2e/pre_provisioning.go
  • test/e2e/suite_test.go

@rvagner78

Copy link
Copy Markdown
Author

/payload-job-with-prs periodic-ci-openshift-release-main-ci-5.0-e2e-azure-ovn openshift/origin#31455

@openshift-ci

openshift-ci Bot commented Jul 31, 2026

Copy link
Copy Markdown

@rvagner78: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-e2e-azure-ovn

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/53cfd1f0-8cf9-11f1-8b66-506f40aeb130-0

@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)
test/e2e/pre_provisioning.go (1)

71-350: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting the repeated create-volume-or-fail pattern.

The sequence req := makeCreateVolumeReq(...), resp, err := azurediskDriver.CreateVolume(ctx, req), if err != nil { ginkgo.Fail(...) }, volumeID = resp.Volume.VolumeId repeats almost verbatim across all six It blocks (Lines 76-83, 117-124, 157-163, 185-190, 252-257, 271-276, 316-321). Extracting a small helper, for example provisionVolume(ctx, name, sizeGiB, params), would reduce duplication and keep future changes to this pattern in one place.

♻️ Example helper extraction
func provisionVolume(ctx ginkgo.SpecContext, name string, sizeGiB int64, mutate func(*csi.CreateVolumeRequest)) *csi.CreateVolumeResponse {
	req := makeCreateVolumeReq(name, sizeGiB)
	if mutate != nil {
		mutate(req)
	}
	resp, err := azurediskDriver.CreateVolume(ctx, req)
	if err != nil {
		ginkgo.Fail(fmt.Sprintf("create volume error: %v", err))
	}
	return resp
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/pre_provisioning.go` around lines 71 - 350, Extract the repeated
volume creation and failure-handling sequence into a shared provisionVolume
helper, using makeCreateVolumeReq and azurediskDriver.CreateVolume. Have it
accept the request name, size, and optional request mutator so custom parameters
and capabilities remain configurable, fail through the existing Ginkgo error
path, and return the CreateVolume response. Update each affected It block to use
the helper and assign volumeID from its response.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/pre_provisioning.go`:
- Around line 58-68: Update the error message in the AfterEach cleanup block
after azurediskDriver.DeleteVolume to describe a volume deletion failure instead
of volume creation, while preserving the existing volumeID and err details.

---

Nitpick comments:
In `@test/e2e/pre_provisioning.go`:
- Around line 71-350: Extract the repeated volume creation and failure-handling
sequence into a shared provisionVolume helper, using makeCreateVolumeReq and
azurediskDriver.CreateVolume. Have it accept the request name, size, and
optional request mutator so custom parameters and capabilities remain
configurable, fail through the existing Ginkgo error path, and return the
CreateVolume response. Update each affected It block to use the helper and
assign volumeID from its response.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8f9e7fcd-1a7a-46b1-b3b6-e2ec10b0e36b

📥 Commits

Reviewing files that changed from the base of the PR and between 77d019e and 8027fbf.

⛔ Files ignored due to path filters (1)
  • cmd/openshift-tests-extension/go.sum is excluded by !**/*.sum
📒 Files selected for processing (7)
  • Dockerfile.openshift.rhel7
  • cmd/openshift-tests-extension/go.mod
  • cmd/openshift-tests-extension/main.go
  • test/e2e/dynamic_provisioning.go
  • test/e2e/pre_provisioning.go
  • test/e2e/suite.go
  • test/e2e/suite_test.go
🚧 Files skipped from review as they are similar to previous changes (5)
  • Dockerfile.openshift.rhel7
  • test/e2e/dynamic_provisioning.go
  • cmd/openshift-tests-extension/main.go
  • test/e2e/suite_test.go
  • test/e2e/suite.go

@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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/e2e/pre_provisioning.go (1)

71-350: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting the repeated create-volume-or-fail pattern.

The sequence req := makeCreateVolumeReq(...), resp, err := azurediskDriver.CreateVolume(ctx, req), if err != nil { ginkgo.Fail(...) }, volumeID = resp.Volume.VolumeId repeats almost verbatim across all six It blocks (Lines 76-83, 117-124, 157-163, 185-190, 252-257, 271-276, 316-321). Extracting a small helper, for example provisionVolume(ctx, name, sizeGiB, params), would reduce duplication and keep future changes to this pattern in one place.

♻️ Example helper extraction
func provisionVolume(ctx ginkgo.SpecContext, name string, sizeGiB int64, mutate func(*csi.CreateVolumeRequest)) *csi.CreateVolumeResponse {
	req := makeCreateVolumeReq(name, sizeGiB)
	if mutate != nil {
		mutate(req)
	}
	resp, err := azurediskDriver.CreateVolume(ctx, req)
	if err != nil {
		ginkgo.Fail(fmt.Sprintf("create volume error: %v", err))
	}
	return resp
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/pre_provisioning.go` around lines 71 - 350, Extract the repeated
volume creation and failure-handling sequence into a shared provisionVolume
helper, using makeCreateVolumeReq and azurediskDriver.CreateVolume. Have it
accept the request name, size, and optional request mutator so custom parameters
and capabilities remain configurable, fail through the existing Ginkgo error
path, and return the CreateVolume response. Update each affected It block to use
the helper and assign volumeID from its response.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/pre_provisioning.go`:
- Around line 58-68: Update the error message in the AfterEach cleanup block
after azurediskDriver.DeleteVolume to describe a volume deletion failure instead
of volume creation, while preserving the existing volumeID and err details.

---

Nitpick comments:
In `@test/e2e/pre_provisioning.go`:
- Around line 71-350: Extract the repeated volume creation and failure-handling
sequence into a shared provisionVolume helper, using makeCreateVolumeReq and
azurediskDriver.CreateVolume. Have it accept the request name, size, and
optional request mutator so custom parameters and capabilities remain
configurable, fail through the existing Ginkgo error path, and return the
CreateVolume response. Update each affected It block to use the helper and
assign volumeID from its response.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8f9e7fcd-1a7a-46b1-b3b6-e2ec10b0e36b

📥 Commits

Reviewing files that changed from the base of the PR and between 77d019e and 8027fbf.

⛔ Files ignored due to path filters (1)
  • cmd/openshift-tests-extension/go.sum is excluded by !**/*.sum
📒 Files selected for processing (7)
  • Dockerfile.openshift.rhel7
  • cmd/openshift-tests-extension/go.mod
  • cmd/openshift-tests-extension/main.go
  • test/e2e/dynamic_provisioning.go
  • test/e2e/pre_provisioning.go
  • test/e2e/suite.go
  • test/e2e/suite_test.go
🚧 Files skipped from review as they are similar to previous changes (5)
  • Dockerfile.openshift.rhel7
  • test/e2e/dynamic_provisioning.go
  • cmd/openshift-tests-extension/main.go
  • test/e2e/suite_test.go
  • test/e2e/suite.go
🛑 Comments failed to post (1)
test/e2e/pre_provisioning.go (1)

58-68: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fix the AfterEach failure message.

The AfterEach block performs azurediskDriver.DeleteVolume, but the failure message at Line 65 says "create volume %q error: %v". This text is wrong for a delete failure and misleads anyone reading CI failure logs when cleanup fails.

🐛 Proposed fix for the failure message
 			_, err := azurediskDriver.DeleteVolume(ctx, req)
 			if err != nil {
-				ginkgo.Fail(fmt.Sprintf("create volume %q error: %v", volumeID, err))
+				ginkgo.Fail(fmt.Sprintf("delete volume %q error: %v", volumeID, err))
 			}
📝 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.

	ginkgo.AfterEach(func(ctx ginkgo.SpecContext) {
		if !skipVolumeDeletion {
			req := &csi.DeleteVolumeRequest{
				VolumeId: volumeID,
			}
			_, err := azurediskDriver.DeleteVolume(ctx, req)
			if err != nil {
				ginkgo.Fail(fmt.Sprintf("delete volume %q error: %v", volumeID, err))
			}
		}
	})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/pre_provisioning.go` around lines 58 - 68, Update the error message
in the AfterEach cleanup block after azurediskDriver.DeleteVolume to describe a
volume deletion failure instead of volume creation, while preserving the
existing volumeID and err details.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant