Skip to content

Conversation

@vitorfloriano
Copy link
Contributor

This PR adds two e2e tests to verify the behavior of using the alpha update command with and without the --force flag.

  1. Force flag with conflicts: v4.5.2 β†’ v4.7.0 --force

    • Verifies command succeeds despite conflicts
    • Validates conflict markers are committed to files
  2. Stop at conflicts: v4.5.2 β†’ v4.7.0 (no --force flag)

    • Verifies command stops with appropriate error message
    • Validates merge branch left in conflict state for manual resolution

Tests use real version differences that create genuine conflicts introduced in v4.7.0.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 22, 2025
@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 22, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @vitorfloriano. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@camilamacedo86
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 22, 2025
)

const (
fromVersion = "v4.5.2"
Copy link
Member

Choose a reason for hiding this comment

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

Run make lint-fix to fix : File is not properly formatted (gci)

}
fileContent := string(content)
if strings.Contains(fileContent, "<<<<<<<") && strings.Contains(fileContent, "=======") && strings.Contains(fileContent, ">>>>>>>") {
conflictMarkersFound = true
Copy link
Member

Choose a reason for hiding this comment

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

The problem here is the size of line
broke it in 2 lines ( just give a enter )

Why?
Big lines make it harder to read the code.
That is why it is a good practice to avoid using the scroll to read everything.
defauly 120 characters

statusOutput := strings.TrimSpace(string(output))
Expect(statusOutput).NotTo(BeEmpty(), "Working directory should have uncommitted changes from merge conflict")

// Reuse existing conflict marker validation
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Reuse existing conflict marker validation

This comment is unnecessary
When we write code, it needs to be readable in a way that we do not need comments
Like reading a history, we are able to understand what is happening in each step with function names, etc.

validateConflictMarkers(mockProjectDir)
})

It("should stop in a conflict state if --force is not used", func() {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
It("should stop in a conflict state if --force is not used", func() {
It("should stop when update project from v4.5.2 to v4.7.0 without the flag force to allow manual conflicts resolution"

This commit adds two e2e tests to verify the behavior of
using the alpha update command with and without the --force flag.
Expect(string(content)).To(ContainSubstring(controllerImplementation))
}

func validateConflictMarkers(projectDir string, expectMarkers bool) {
Copy link
Member

Choose a reason for hiding this comment

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

I think it is a little overwhelming for what we need.
but lets move forward and after we improve in a follow up

Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 22, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, vitorfloriano

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 22, 2025
@k8s-ci-robot k8s-ci-robot merged commit e33dd37 into kubernetes-sigs:master Jul 22, 2025
15 checks passed
@vitorfloriano vitorfloriano deleted the e2e-test-force-flag branch July 22, 2025 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants