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

Fix Delete(...) early return #425

Merged
merged 3 commits into from
Jan 18, 2024
Merged

Fix Delete(...) early return #425

merged 3 commits into from
Jan 18, 2024

Conversation

jsign
Copy link
Collaborator

@jsign jsign commented Jan 17, 2024

This PR fixes a bug that appeared once in a while in the TestRandom(...) tests.

…lure

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
break
return false, nil
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

While breaking was reasonable, the right thing is to return false. Only break would mean L625 being executed signaling that a node deletion should happen, when that shouldn't be the case.

@@ -1806,3 +1806,36 @@ func TestRandom(t *testing.T) {
t.Fatal(err)
}
}

func TestRandomExtracted(t *testing.T) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So after a while of debugging TestRandom(...) I extracted (and manually "minified") a simple test that surfaced the bug. Leaving the test here to avoid regressions.

Interestingly, this bug wasn't affecting this other test that was targeting this API.

@jsign jsign marked this pull request as ready for review January 17, 2024 19:57
@jsign jsign requested a review from gballet January 17, 2024 19:57
Copy link
Member

@gballet gballet left a comment

Choose a reason for hiding this comment

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

That was subtle. I guess it's a good thing we added this test. LGTM.

@gballet gballet merged commit f25b11e into master Jan 18, 2024
7 checks passed
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.

None yet

2 participants