Skip to content

refactor(authentication): extract the operator-wait package - #31934

Open
wouldgo wants to merge 1 commit into
openshift:mainfrom
wouldgo:refactor/operatorwait
Open

wouldgo wants to merge 1 commit into
openshift:mainfrom
wouldgo:refactor/operatorwait

Conversation

@wouldgo

@wouldgo wouldgo commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

No behavior change. This PR moves the operator status waiting helpers from operator_status_helpers.go into the new operatorwait package and exports them.

It adds a wrapper-chain constructor that composes mutation, deployment-rollout, and operator-change waiting around a test action. The existing component-proxy tests are rewired onto the package.

Review note: two spots return errors.New("no cli") as placeholder errors. They are marked with TODOs to adopt the error definition landing in #31837; I kept them local to avoid a cross-PR dependency.

Summary by CodeRabbit

  • Tests
    • Expanded authentication coverage to verify that proxy and identity-provider configuration changes are reflected after operator updates and deployment rollouts.
    • Improved cleanup handling in affected tests, including reporting cleanup errors and checking that operator changes are applied.
    • Added coverage for composed wait behavior, including execution order, error propagation, and stopping when a step fails.

@openshift-merge-bot

openshift-merge-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Pipeline controller notification

Pipeline · Chai · 5a7e236a68ba

Now: Chai marked dispatch complete. The gate doesn't confirm that jobs started.

Next: See which jobs started and how they finished in the PR status table below.

flowchart LR
  wait["Waiting"] --> trigger["Stage 1 ready"] --> handoff["Agentic dispatching"] --> outcome["Tests dispatched"]
  classDef here fill:#1757a6,stroke:#1757a6,color:#fff,stroke-width:3px
  classDef done fill:#dafbe1,stroke:#1a7f37,color:#116329,stroke-width:2px
  class wait,trigger,handoff,outcome done
Loading

If you're stuck: Use /test <job> for one missing run. To switch to Traditional, a trusted user can run /pipeline skip-agentic-mode.

About the pipeline controller

This PR uses the pipeline controller for second-stage tests. Selection and triggering follow the repository configuration.

Use /test ? to list jobs and /pipeline help for commands.

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review.

Walkthrough

The change adds composable operator and Deployment rollout waiters. Authentication proxy tests use these waiters when applying or removing proxy settings and registering an identity provider.

Changes

Authentication proxy waits

Layer / File(s) Summary
Waiter composition and contracts
test/extended/authentication/operatorwait/status.go, test/extended/authentication/operatorwait/chain.go, test/extended/authentication/operatorwait/chain_test.go, test/extended/authentication/operatorwait/status_test.go
The operatorwait package exports the status wait functions and adds wrappers for composing mutations with operator-change and Deployment rollout waits. Tests check wrapper order and error propagation.
Proxy test integration
test/extended/authentication/component_proxy.go, test/extended/authentication/component_proxy_helpers.go
Proxy configuration and IdP registration or removal use chained operator-change and OAuth Deployment rollout waits. Cleanup logs errors from resource removal, and authentication-state cleanup uses the exported operator wait.

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

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant ProxyTest
  participant RolloutWaiter
  participant OperatorChangesWaiter
  participant OAuthDeployment
  participant AuthenticationOperator
  ProxyTest->>RolloutWaiter: invoke chained mutation
  RolloutWaiter->>OAuthDeployment: read generation
  RolloutWaiter->>OperatorChangesWaiter: run mutation
  OperatorChangesWaiter->>AuthenticationOperator: wait for configuration changes
  OperatorChangesWaiter-->>RolloutWaiter: return after operator wait
  RolloutWaiter->>OAuthDeployment: wait past saved generation
Loading

Suggested reviewers: tchap, ehearne-redhat

Merge Risk: Minimal · up to 5a7e2

This is a test-only refactor that moves the operator and rollout wait helpers into their own package and uses them in the authentication proxy tests. No concrete defect was found, so merge-readiness risk is minimal. Ordinary CI on the serial authentication proxy jobs should confirm that the tests behave as before.

Pre-merge checks: Passed 14

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "refactor(authentication): extract the operator-wait package" matches the main change. The PR moves the operator-status wait helpers into a new operatorwait package, exports them, adds a Cha…
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 check applies to Ginkgo test titles (It, Describe, Context, When, and similar). I inspected the reviewed diff range (refs/coderabbit/pre-merge-check/base..head). It changes six files: component_pr…
Test Structure And Quality Passed The check applies to Ginkgo test code. The PR changes Ginkgo specs in test/extended/authentication/component_proxy.go, but it adds no new g.It, g.Describe, BeforeEach, or AfterEach blocks. Item 6 (Inf…
Microshift Test Compatibility Passed The check applies only when new Ginkgo e2e specs (It, Describe, Context, When) are added. The diff adds none. - Changed files: component_proxy.go and component_proxy_helpers.go are modified. `oper…
Single Node Openshift (Sno) Test Compatibility Passed The check applies only when new Ginkgo e2e test nodes (It, Describe, Context, When) are added. The reviewed range (refs/coderabbit/pre-merge-check/base..head) adds none: - `test/extended/authenticatio…
Topology-Aware Scheduling Compatibility Passed The check applies when deployment manifests, operator code, or controllers are added or modified and introduce scheduling constraints. This PR changes only Go e2e test code under test/extended/authent…
Ote Binary Stdout Contract Passed The check bans stdout writes only in process-level code: main(), init(), TestMain(), suite setup hooks, and top-level var/const initializers. I scanned every added line under test/ in the reviewed ran…
Ipv6 And Disconnected Network Test Compatibility Passed The check applies to newly added Ginkgo e2e tests (It, Describe, Context, When). This PR adds none. Evidence: - The changed-file list has 6 entries. Two are modified (component_proxy.go, component_pro…
No-Weak-Crypto Passed The no-weak-crypto check does not apply to this PR's changes. The changed-file inventory (name-status against the review base) covers only Go test-harness files under test/extended/authentication: com…
Container-Privileges Passed The container-privileges check targets container and Kubernetes manifests that set privileged mode, host namespaces, dangerous capabilities, root execution, or privilege escalation. This PR changes no…
No-Sensitive-Data-In-Logs Passed The PR adds or changes only a few log statements in the authentication e2e tests, and none of them logs a password, token, API key, PII, session ID, internal hostname, or customer data. - Two new line…
Full details: Title check

Explanation

The title "refactor(authentication): extract the operator-wait package" matches the main change. The PR moves the operator-status wait helpers into a new operatorwait package, exports them, adds a Chain/wrapper composition helper, and rewires the component-proxy tests to use it. The title is short, single-sentence, and specific. It omits the Chain composition helper, which is a secondary detail and acceptable under the criteria.

Full details: Stable And Deterministic Test Names

Explanation

The check applies to Ginkgo test titles (It, Describe, Context, When, and similar). I inspected the reviewed diff range (refs/coderabbit/pre-merge-check/base..head). It changes six files: component_proxy.go, component_proxy_helpers.go, the new operatorwait/chain.go and chain_test.go, and the renamed operatorwait/status.go and status_test.go. A search of all added and removed lines for It/Describe/Context/When/DescribeTable/Entry calls found no matches. No test title was added, removed, or modified. The changes are refactors of test bodies: the proxy tests now call operatorwait.Chain, and the helpers were renamed and exported. The existing titles are unchanged, so no dynamic values, legacy metadata tokens, or Polarion IDs were introduced into test names. The check therefore passes.

Full details: Test Structure And Quality

Explanation

The check applies to Ginkgo test code. The PR changes Ginkgo specs in test/extended/authentication/component_proxy.go, but it adds no new g.It, g.Describe, BeforeEach, or AfterEach blocks. Item 6 (Informing) therefore does not apply. Evidence from the reviewed range: - Timeouts (item 3): The waits moved into the new operatorwait package keep their existing bounds. WaitForDeploymentRollout polls with a 10-minute timeout (wait.PollUntilContextTimeout). WaitForOperatorToPickUpChanges uses a 5-minute progress window. The settle step is unchanged. No new unbounded wait was added. - Cleanup (item 2): The IdP cleanup is still registered with g.DeferCleanup inside the Chain callback. The PR changes cleanup failures from silently discarded to logged through GinkgoWriter. Cleanup is still present, so no resource is left without cleanup. - Structure (items 1 and 5): The refactor replaces repeated get-generation, mutate, and wait blocks with operatorwait.Chain over RolloutWaiter and OperatorChangesWaiter. This follows the existing shared-helper pattern in the package. Each spec keeps its prior behavior and scope. - Assertion messages (item 4), minor observation: the new o.Expect(err).NotTo(o.HaveOccurred()) lines have no custom message. This matches the file's existing style, and the PR keeps the assertions it replaces. It does not introduce a new deficiency, so it does not support FAIL. chain_test.go is a plain Go testing test (TestChain), not a Ginkgo spec. It does not change the Ginkgo criteria. No single-responsibility or setup regression was found in the modified specs.

Full details: Microshift Test Compatibility

Explanation

The check applies only when new Ginkgo e2e specs (It, Describe, Context, When) are added. The diff adds none. - Changed files: component_proxy.go and component_proxy_helpers.go are modified. operator_status_helpers.go and operator_status_helpers_test.go are renamed to operatorwait/status.go and operatorwait/status_test.go. operatorwait/chain.go and operatorwait/chain_test.go are added. - component_proxy.go: a grep of added or removed lines finds no g.It, g.Describe, g.Context, g.When, [Serial], apigroup, Skipped, or skip-check changes. The six g.It specs in the existing serial Describe are unchanged in name and label. Their bodies now call operatorwait helpers, so they are modified, not new. - operatorwait/chain.go: adds helper types and functions (Wrapper, Chain, OperatorChangesWaiter, RolloutWaiter). These are plain Go helpers, not Ginkgo specs. - operatorwait/chain_test.go: adds TestChain(t *testing.T), a standard Go unit test. It is not a Ginkgo spec. - operatorwait/status.go and status_test.go: a package rename and export of existing helpers. No new specs. No new e2e specs means no new API surface for MicroShift to skip. The check does not apply to these changes, so it passes. The existing serial tests keep their pre-existing labels and behavior. This verdict covers the diff only.

Full details: Single Node Openshift (Sno) Test Compatibility

Explanation

The check applies only when new Ginkgo e2e test nodes (It, Describe, Context, When) are added. The reviewed range (refs/coderabbit/pre-merge-check/base..head) adds none: - test/extended/authentication/component_proxy.go only modifies existing test bodies. The diff changes g.By step text, removes and adds o.Expect and g.DeferCleanup calls, and changes cleanup closures. No g.It, g.Describe, g.Context, or g.When line is added. - test/extended/authentication/component_proxy_helpers.go swaps one helper call for another. - test/extended/authentication/operatorwait/chain.go and status.go are helper code. They add Chain, Wrapper, OperatorChangesWaiter, RolloutWaiter, and exported wait helpers. They define no Ginkgo nodes. - test/extended/authentication/operatorwait/chain_test.go adds a standard Go unit test, func TestChain(t *testing.T). It is not a Ginkgo spec. - status_test.go is a package rename and a file rename only. A grep over the added lines for g.It(, g.Describe(, g.Context(, g.When(, It(, Describe(, Context(, [Serial], and Skip( returned no matches. The SNO multi-node assumption rule therefore has no new test to evaluate. The PR contains no new e2e test that could assume a multi-node or HA topology. The check is not applicable.

Full details: Topology-Aware Scheduling Compatibility

Explanation

The check applies when deployment manifests, operator code, or controllers are added or modified and introduce scheduling constraints. This PR changes only Go e2e test code under test/extended/authentication/. The changed files are component_proxy.go, component_proxy_helpers.go, the new operatorwait/chain.go and chain_test.go, and the renamed operatorwait/status.go and status_test.go (moved from operator_status_helpers*.go). The diff adds no Deployment, DaemonSet, or StatefulSet manifests, no pod spec scheduling fields (affinity, tolerations, nodeSelector, topology spread, PodDisruptionBudget, maxUnavailable, replicas), and no controller or operator reconciliation code. A search of the diff for these scheduling terms matched only two comment lines about rollout generation. The helpers wait on existing deployments and operators; they do not define new scheduling constraints. The check is therefore inapplicable, and it passes.

Full details: Ote Binary Stdout Contract

Explanation

The check bans stdout writes only in process-level code: main(), init(), TestMain(), suite setup hooks, and top-level var/const initializers. I scanned every added line under test/ in the reviewed range (refs/coderabbit/pre-merge-check/base..head). The scan covered fmt.Print*, os.Stdout, klog, log.*, SetOutput, LogToStderr, func init, func main, TestMain, the suite hooks, RunSpecs, and column-zero var/const. It found no matches. The only output calls in the new code are in these locations: - test/extended/authentication/operatorwait/status.go: g.GinkgoWriter.Printf and g.GinkgoWriter.Println inside WaitForOperatorToPickUpChanges and WaitForDeploymentRollout. GinkgoWriter is explicitly allowed by the check. - test/extended/authentication/operatorwait/chain.go: g.By calls inside OperatorChangesWaiter.WaitChanges, which run from test bodies. The new Chain, RolloutWaiter, and OperatorChangesWaiter declarations are functions and types, with no top-level side effects. The moved helpers and the rewired component_proxy tests do not add process-level output. No new init(), main(), or suite-level stdout writes exist in the diff.

Full details: Ipv6 And Disconnected Network Test Compatibility

Explanation

The check applies to newly added Ginkgo e2e tests (It, Describe, Context, When). This PR adds none. Evidence: - The changed-file list has 6 entries. Two are modified (component_proxy.go, component_proxy_helpers.go), two are added (operatorwait/chain.go, operatorwait/chain_test.go), and two are renames (operator_status_helpers*.go to operatorwait/status*.go). - In component_proxy.go, the count of g.It/g.Describe/g.Context/g.When blocks is 7 in both base and head. No added diff line contains an It, Describe, Context, When, or DescribeTable call. - The new chain_test.go adds TestChain, a standard Go unit test using t.Run. It is not a Ginkgo e2e test. - The new and moved helpers (chain.go, status.go) contain no hardcoded IPv4 addresses, IPv4 parsing, net.ParseIP or ParseCIDR calls, URL interpolation, or public-internet hosts. The only added network-related text is pre-existing proxy configuration that the PR rewires. The PR changes existing serial tests and refactors helpers. Its wiring changes do not add new network assumptions. The IPv6 and disconnected-environment notice therefore does not apply.

Full details: No-Weak-Crypto

Explanation

The no-weak-crypto check does not apply to this PR's changes. The changed-file inventory (name-status against the review base) covers only Go test-harness files under test/extended/authentication: component_proxy.go, component_proxy_helpers.go, the new operatorwait/chain.go and chain_test.go, and the renamed status.go and status_test.go. A case-insensitive search of all added diff lines found no MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB, cipher, HMAC, or hash usage, no crypto imports, and no math/rand use. I read the added code in chain.go and component_proxy_helpers.go. It contains only context-based composition, Deployment generation reads, and operator wait calls. The only comparisons are generation-based rollout checks, not comparisons of secrets or tokens. The PR is a refactor with no behavior change. It does not introduce custom crypto or non-constant-time secret comparison. The primary PR is openshift/origin #31934 by wouldgo.

Full details: Container-Privileges

Explanation

The container-privileges check targets container and Kubernetes manifests that set privileged mode, host namespaces, dangerous capabilities, root execution, or privilege escalation. This PR changes no manifests. The changed-file inventory (git diff --name-status against the review base) lists only Go test files under test/extended/authentication/: component_proxy.go, component_proxy_helpers.go, the new operatorwait/chain.go and chain_test.go, and the renamed status.go and status_test.go. A search of the full PR diff for privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, allowPrivilegeEscalation, runAsUser, securityContext, and capabilities returned no matches. The check does not apply to the changed content, so it passes.

Full details: No-Sensitive-Data-In-Logs

Explanation

The PR adds or changes only a few log statements in the authentication e2e tests, and none of them logs a password, token, API key, PII, session ID, internal hostname, or customer data. - Two new lines in test/extended/authentication/component_proxy.go log cleanup failures: g.GinkgoWriter.Printf("failed cleanup resources: %v", err). The err value comes from removeResources(ctx, idpCleanups...). It holds only a cleanup error message, such as a Kubernetes API error. It does not hold credentials or user data. The IdP credentials and the Keycloak user password are not passed to this log line. - test/extended/authentication/operatorwait/chain.go adds only fmt.Errorf wrappers. These messages name a deployment namespace and name and a wrapped error. They contain no secrets. - The new chain_test.go only logs an execution order of synthetic wrapper names such as "A:before". It holds no sensitive data. - The remaining log lines in component_proxy_helpers.go and operator_status_helpers are renamed or moved, not newly added. Residual note: removeResources is not read in full. Its error text is assumed to contain only resource-level API messages. That assumption does not change the verdict.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: openshift/origin
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 35d2e54
  • Layers: Repository YAML (base), Central YAML (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8ae96dd9-265a-4e34-88f7-dfbc1b7e2c1b
Commits

Reviewing files that changed from the base of the PR and between a28b2d1 and 5a7e236.

Files selected for processing: 6

  • test/extended/authentication/component_proxy.go
  • test/extended/authentication/component_proxy_helpers.go
  • test/extended/authentication/operatorwait/chain.go
  • test/extended/authentication/operatorwait/chain_test.go
  • test/extended/authentication/operatorwait/status.go
  • test/extended/authentication/operatorwait/status_test.go

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@openshift-ci
openshift-ci Bot requested review from ibihim and liouk November 19, 2026 15:10
@openshift-ci openshift-ci Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Nov 19, 2026
@redhat-chai-bot

Copy link
Copy Markdown
Contributor

Chai test selection for a28b2d1e98c1eedc2b33ed75d949197778fb2ca9 → main

  • pull-ci-openshift-origin-main-e2e-aws-ovn-serial-1of2
  • pull-ci-openshift-origin-main-e2e-aws-ovn-serial-2of2

Reason: Restructures authentication component proxy test orchestration via a new operatorwait.Chain wrapper composition, replacing the sequential get-generation/mutate/wait pattern. The affected tests are [sig-auth][Suite:openshift/conformance/serial]; both serial halves are selected to ensure the auth proxy tests are exercised in whichever split they land.

/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2

@redhat-chai-bot

Copy link
Copy Markdown
Contributor

/pipeline mark-pipeline-gate a28b2d1

@ehearne-redhat ehearne-redhat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Took a while to go through and understand this - I love a clever implementation! :D

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Nov 24, 2026

@liouk liouk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good overall, just one clarification from my side.

@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 26, 2026
Move the operator status waiting helpers from operator_status_helpers.go
into the operatorwait package and export them. Add a wrapper-chain
constructor that composes mutation, deployment-rollout, and
operator-change waiting around a test action. Rewire the existing
component-proxy tests onto the package. No behavior change.
@wouldgo
wouldgo force-pushed the refactor/operatorwait branch from a28b2d1 to 5a7e236 Compare November 26, 2026 15:17
@openshift-ci

openshift-ci Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ehearne-redhat, wouldgo
Once this PR has been reviewed and has the lgtm label, please ask for approval from liouk. 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

@redhat-chai-bot

Copy link
Copy Markdown
Contributor

Chai test selection for 5a7e236a68ba17dff4a032f897b685b9d1d0a196 → main

  • pull-ci-openshift-origin-main-e2e-aws-ovn-serial-1of2
  • pull-ci-openshift-origin-main-e2e-aws-ovn-serial-2of2

Reason: Refactors authentication serial test helpers into a new operatorwait package with a Chain composition pattern. Same mutation-wait sequences with a restructured API; the rewired [sig-auth][Suite:openshift/conformance/serial] component-proxy tests need serial e2e execution to verify the integration of Chain/RolloutWaiter/OperatorChangesWaiter with actual cluster operations. Both serial halves selected because the split assignment is opaque.

/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2

@redhat-chai-bot

Copy link
Copy Markdown
Contributor

/pipeline mark-pipeline-gate 5a7e236

@openshift-ci

openshift-ci Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

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

@openshift-trt

openshift-trt Bot commented Nov 26, 2026

Copy link
Copy Markdown

Job Failure Risk Analysis for sha: 5a7e236

Job Name Failure Risk
pull-ci-openshift-origin-main-e2e-aws-ovn-serial-2of2 Low
[sig-api-machinery][Feature:APIServer][Feature:UpgradeWebhooks] [OTP][OCP-50362] Verify cluster handles bad admission webhooks correctly [Serial][apigroup:config.openshift.io][apigroup:admissionregistration.k8s.io][apigroup:apiextensions.k8s.io] [Suite:openshift/conformance/serial]
This test has passed 54.48% of 145 runs on release 4.23 [Overall] in the last week.
---
[sig-api-machinery][Feature:APIServer][Feature:UpgradeWebhooks] [OTP][OCP-50223] Checks on different bad admission webhook errors and kube-apiserver status [Serial][apigroup:admissionregistration.k8s.io][apigroup:apiextensions.k8s.io][Timeout:15m] [Suite:openshift/conformance/serial]
This test has passed 55.12% of 127 runs on release 4.23 [Overall] in the last week.

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

Labels

ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants