Skip to content

Conversation

@britaniar
Copy link
Collaborator

@britaniar britaniar commented Nov 25, 2025

Description of your changes

I have:

  • Update updateRun controller to use State from the Spec to determine whether to start/stop/abandon update run.

  • Updated conditional checks to disregard generation checks as update run is immutable but the State field.

  • Refactor (*Reconciler).executeUpdatingStage to help with cyclomatic complexity (linter failure)

  • Added/update integrations tests and e2e tests.

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

  • Integration Tests
  • E2E Test

Special notes for your reviewer

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

❌ Patch coverage is 92.10526% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/controllers/updaterun/controller.go 89.83% 4 Missing and 2 partials ⚠️
pkg/controllers/updaterun/execution.go 93.25% 4 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@britaniar britaniar force-pushed the startStopImplementation branch from 9884da7 to 07c7ac6 Compare November 25, 2025 19:23
Signed-off-by: Britania Rodriguez Reyes <[email protected]>
@britaniar britaniar force-pushed the startStopImplementation branch from 07c7ac6 to 6a68b64 Compare November 25, 2025 19:43
Signed-off-by: Britania Rodriguez Reyes <[email protected]>
@britaniar britaniar marked this pull request as ready for review November 25, 2025 20:12
Copilot finished reviewing on behalf of ryanzhang-oss November 25, 2025 23:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements the Start/Stop API for update runs, introducing state-based control over update run execution. The changes enable users to create update runs in a NotStarted state, transition them to Started to begin execution, Stopped to pause, and Abandoned to terminate. Key changes include:

  • Updated the updateRun controller to use State from the Spec to determine execution flow
  • Modified conditional checks to disregard generation for immutable fields (only State changes)
  • Refactored executeUpdatingStage into smaller helper methods to reduce complexity
  • Added comprehensive integration and E2E tests for state transitions

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/controllers/updaterun/controller.go Added state-based execution control with early checks for Abandoned/Stopped states; modified initialization logic to ignore generation changes
pkg/controllers/updaterun/execution.go Refactored executeUpdatingStage into smaller helper methods; removed generation checks from condition evaluations
pkg/controllers/updaterun/validation.go Updated condition checks to be generation-independent for succeeded/failed states
pkg/utils/condition/reason.go Added new condition reasons: UpdateRunPausedReason and UpdateRunAbandonedReason
test/e2e/staged_updaterun_test.go Updated all createStagedUpdateRunSucceed calls to include state parameter; added comprehensive E2E test for state transitions
test/e2e/cluster_staged_updaterun_test.go Updated all createClusterStagedUpdateRunSucceed calls to include state parameter; added E2E test for cluster-scoped state transitions
test/e2e/actuals_test.go Added helper functions for validating NotStarted, Stopped, and Abandoned states; refactored status building logic
pkg/controllers/updaterun/*_integration_test.go Updated test helpers to use reason strings; added integration tests for NotStarted/Stopped/Abandoned states


By("Validating crp status as member-cluster-2 updated only")
rpStatusUpdatedActual := rpStatusWithExternalStrategyActual(nil, "", false, allMemberClusterNames, []string{"", resourceSnapshotIndex1st, ""}, []bool{false, true, false}, nil, nil)
Eventually(rpStatusUpdatedActual, eventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to update RP %s status as expected", crpName)
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

The variable name crpName is used in the error message, but this test is for namespaced resource placements which use rpName. The error message should use rpName instead to match the test context and be consistent with other assertions in this test (see lines 1527, 1541).

Suggested change
Eventually(rpStatusUpdatedActual, eventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to update RP %s status as expected", crpName)
Eventually(rpStatusUpdatedActual, eventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to update RP %s status as expected", rpName)

Copilot uses AI. Check for mistakes.
})
})

//TODO(britaniar): Add more e2e tests for updateRun Start/Stop Implementation
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

The TODO comment lacks a reference to a tracking issue. Consider adding an issue link or ticket number to track this work, following the pattern used elsewhere in the codebase.

Suggested change
//TODO(britaniar): Add more e2e tests for updateRun Start/Stop Implementation
//TODO(britaniar): Add more e2e tests for updateRun Start/Stop Implementation (see issue #1234)

Copilot uses AI. Check for mistakes.
})
})

//TODO(britaniar): Add more e2e tests for updateRun Start/Stop Implementation
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

The TODO comment lacks a reference to a tracking issue. Consider adding an issue link or ticket number to track this work, following the pattern used elsewhere in the codebase.

Suggested change
//TODO(britaniar): Add more e2e tests for updateRun Start/Stop Implementation
//TODO(britaniar): Add more e2e tests for updateRun Start/Stop Implementation. See issue #1234

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Eventually(surSucceededActual, updateRunEventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to validate updateRun %s succeeded", updateRunNames[0])
})

It("Should stop update run when updated to Abandoned state", func() {
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

Misleading test description. The test says "Should stop update run" but it actually abandons the update run. Consider changing to: "Should abandon update run when updated to Abandoned state"

Suggested change
It("Should stop update run when updated to Abandoned state", func() {
It("Should abandon update run when updated to Abandoned state", func() {

Copilot uses AI. Check for mistakes.
Eventually(csurSucceededActual, updateRunEventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to validate updateRun %s succeeded", updateRunNames[0])
})

It("Should stop update run when updated to Abandoned state", func() {
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

Misleading test description. The test says "Should stop update run" but it actually abandons the update run. Consider changing to: "Should abandon update run when updated to Abandoned state"

Suggested change
It("Should stop update run when updated to Abandoned state", func() {
It("Should abandon update run when updated to Abandoned state", func() {

Copilot uses AI. Check for mistakes.
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