Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate: Refactor linearization handling and visualization in operations.go #19094

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

VidhuSarwal
Copy link

Closes #19089

Changes made:
Refactored operations.go

  • Refactored the validateLinearizableOperationsAndVisualize function
  • Eliminated the anonymous function for visualization.
  • Introduced a Results struct to store LinearizationInfo, Model, and the logger.
  • The Results struct simplifies the code by removing the need to pass these components separately.

Refactored validateLinearizableOperationsAndVisualize to remove the anonymous visualization function. Made a Results struct to store LinearizationInfo, Model, and the logger, simplifying the code.

Signed-off-by: VidhuSarwal <[email protected]>
validate: refactor linearization handling in operations.go
@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: VidhuSarwal
Once this PR has been reviewed and has the lgtm label, please assign spzala for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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
Copy link

Hi @VidhuSarwal. Thanks for your PR.

I'm waiting for a etcd-io 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.

@serathius
Copy link
Member

/ok-to-test

Lg *zap.Logger // Include logger in the Results struct
}

// Change the Visualize method to match the signature func(path string) error
Copy link
Member

Choose a reason for hiding this comment

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

This commend describes the PR, but they will no longer be relevant after we merge it.

Copy link
Author

Choose a reason for hiding this comment

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

Okay, Removing it...

if linearizable != porcupine.Ok {
t.Error("Failed linearization, skipping further validation")
return visualize
return results.Visualize
Copy link
Member

Choose a reason for hiding this comment

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

Why not return results struct? It should allow caller to call results.Visualize and futher eliminate usage of arbitrary function interface.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah right. Will do it.

type Results struct {
Info porcupine.LinearizationInfo
Model porcupine.Model
Lg *zap.Logger // Include logger in the Results struct
Copy link
Member

Choose a reason for hiding this comment

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

This comment doesn't do much. Maybe instead we leave a TODO to remove logger from struct and instead of making it an argument for Visualize?

Copy link
Author

Choose a reason for hiding this comment

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

Sure, will leave a TODO.

@serathius
Copy link
Member

High level looks good, just couple of nits.

@serathius
Copy link
Member

Tests failed with stderr: robustness/validate/operations.go:36:18: undefined: porcupine.LinearizationInfo

Think you need to upgrade the porcupine version.

@VidhuSarwal
Copy link
Author

updated porcupine to v1.0.0, Made the change in go.mod (bumped the version number) ran go mod tidy and now getting these errors.

test like pull-etcd-e2e-arm64 suggests go.sum entry is missing, but go.sum did make it (evident in changes) so not able to understand what exact issue is. Even manually ran go get github.com/anishathalye/[email protected]

Also one test (robustness) suggests I update the test file to the new return type of ValidateAndReturnVisualize (result struct)

Copy link

codecov bot commented Dec 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.81%. Comparing base (9fa35e5) to head (e451f4f).

Additional details and impacted files

see 25 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #19094      +/-   ##
==========================================
- Coverage   68.85%   68.81%   -0.04%     
==========================================
  Files         420      420              
  Lines       35642    35642              
==========================================
- Hits        24541    24527      -14     
- Misses       9676     9689      +13     
- Partials     1425     1426       +1     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9fa35e5...e451f4f. Read the comment docs.

@k8s-ci-robot
Copy link

k8s-ci-robot commented Dec 21, 2024

@VidhuSarwal: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-etcd-verify e451f4f link true /test pull-etcd-verify
pull-etcd-robustness-arm64 e451f4f link true /test pull-etcd-robustness-arm64
pull-etcd-unit-test-386 e451f4f link true /test pull-etcd-unit-test-386
pull-etcd-unit-test-arm64 e451f4f link true /test pull-etcd-unit-test-arm64
pull-etcd-unit-test-amd64 e451f4f link true /test pull-etcd-unit-test-amd64
pull-etcd-robustness-amd64 e451f4f link true /test pull-etcd-robustness-amd64
pull-etcd-integration-1-cpu-amd64 e451f4f link true /test pull-etcd-integration-1-cpu-amd64

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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

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

Successfully merging this pull request may close these issues.

Remove passing of anonymous visualize function
3 participants