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

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

@jmao-dd
Copy link

jmao-dd commented Jan 3, 2025

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)

I think main_test.go needs a small update as follows since the return type of ValidateAndReturnVisualize is changed. After applying the following change make test-robustness passed in my local.

git diff
diff --git a/tests/robustness/main_test.go b/tests/robustness/main_test.go
index 32e032838..345fe7957 100644
--- a/tests/robustness/main_test.go
+++ b/tests/robustness/main_test.go
@@ -103,7 +103,7 @@ func testRobustness(ctx context.Context, t *testing.T, lg *zap.Logger, s scenari
                client.ValidateGotAtLeastOneProgressNotify(t, r.Client, s.Watch.RequestProgress || watchProgressNotifyEnabled)
        }
        validateConfig := validate.Config{ExpectRevisionUnique: s.Traffic.ExpectUniqueRevision()}
-       r.Visualize = validate.ValidateAndReturnVisualize(t, lg, validateConfig, r.Client, persistedRequests, 5*time.Minute)
+       r.Visualize = validate.ValidateAndReturnVisualize(t, lg, validateConfig, r.Client, persistedRequests, 5*time.Minute).Visualize

        panicked = false
 }

@@ -32,7 +32,7 @@ require (
go.etcd.io/etcd/etcdutl/v3 v3.6.0-alpha.0
go.etcd.io/etcd/pkg/v3 v3.6.0-alpha.0
go.etcd.io/etcd/server/v3 v3.6.0-alpha.0
go.etcd.io/etcd/tests/v3 v3.0.0-00010101000000-000000000000
go.etcd.io/etcd/tests/v3 v3.5.17
Copy link
Member

Choose a reason for hiding this comment

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

Don't think changes to go.mod nor go.sum are needed. As porcupine is a test dependency it's not mentioned in go.mod. We just need to update tests/go.mod and tests/go.sum

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
4 participants