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

kv: fix assertion in TestProxyTracing #133609

Merged

Conversation

nvanbenschoten
Copy link
Member

This commit fixes the assertion in TestProxyTracing so that the test will fail if request proxying is not working as expected. The test was fooling itself, expecting QueryRowContext to return a nil Row if no matching trace event was found. This is not the case, as a nil Row is never returned. Instead, Row.Scan returns ErrNoRows if no matching row is found.

Also, the query wasn't even running because it was passing the last line of the query string in as a parameter, leading to the error: "pq: got 1 parameters but the statement requires 0".

I confirmed that before this change, the test passes even with request proxying disabled. After this change, the test fails.

Epic: None
Release note: None

This commit fixes the assertion in TestProxyTracing so that the test
will fail if request proxying is not working as expected. The test was
fooling itself, expecting QueryRowContext to return a nil Row if no
matching trace event was found. This is not the case, as a nil Row is
never returned. Instead, Row.Scan returns ErrNoRows if no matching row
is found.

Also, the query wasn't even running because it was passing the last line
of the query string in as a parameter, leading to the error: "pq: got 1
parameters but the statement requires 0".

I confirmed that before this change, the test passes even with request
proxying disabled. After this change, the test fails.

Epic: None
Release note: None
@nvanbenschoten nvanbenschoten added backport-24.1.x Flags PRs that need to be backported to 24.1. backport-24.2.x Flags PRs that need to be backported to 24.2 backport-24.3.x Flags PRs that need to be backported to 24.3 labels Oct 28, 2024
@nvanbenschoten nvanbenschoten requested a review from a team as a code owner October 28, 2024 21:28
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@kvoli kvoli left a comment

Choose a reason for hiding this comment

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

Yikes! Thank you for fixing my broken logic. Out of curiosity, how did you come across this?

@nvanbenschoten
Copy link
Member Author

TFTR!

Out of curiosity, how did you come across this?

I was trying to add leader leases to the test to demonstrate that we've recently fixed request proxying with them and found that the test passed even without the fix.

bors r+

@craig craig bot merged commit c061bd6 into cockroachdb:master Oct 28, 2024
22 of 23 checks passed
@nvanbenschoten nvanbenschoten deleted the nvanbenschoten/fixTestProxyTracing branch October 29, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-24.1.x Flags PRs that need to be backported to 24.1. backport-24.2.x Flags PRs that need to be backported to 24.2 backport-24.3.x Flags PRs that need to be backported to 24.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants