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

sql: move query result checking in testutils/sqlutils #10646

Merged

Conversation

RaduBerinde
Copy link
Member

@RaduBerinde RaduBerinde commented Nov 11, 2016

Moving code to verify the result of a Query to sqlutils, where it can be used by
other tests. In the descriptor mutation test we now check the number of keys
against known values rather than relying on checkQueryResponse to count the
number of NULLs in the expected result (which we know).


This change is Reviewable

@tamird
Copy link
Contributor

tamird commented Nov 11, 2016

Looks to me like this is increasing the number of magic values in these tests. Can that be avoided?

Also, as always, it's a bummer that this will produce unpleasant error line numbers.


Reviewed 1 of 3 files at r1.
Review status: 1 of 3 files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@RaduBerinde
Copy link
Member Author

The magic values (number of KVs) are coming from the expected strings just above and are very easily deduced just by looking at them. Honestly I feel it's more clear like this, the numVals return value was harder to explain (and in one of the instances we had a strange idxVals++ which was confusing).


Review status: 1 of 3 files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@tamird
Copy link
Contributor

tamird commented Nov 11, 2016

OK, I'll take your word for it. Errors produced by this are still bad, but not worse than before, so LGTM (with the caveat that whatever future use you had in mind for this will also get bad error messages).


Reviewed 2 of 3 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@RaduBerinde
Copy link
Member Author

Yeah, it's not the best, but it's an improvement since all messages now show the query.


Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@RaduBerinde
Copy link
Member Author

Actually, it should be easy to just get the caller once and then display it in the error message, I'll do that.


Comments from Reviewable

Moving code to verify the result of a Query to sqlutils, where it can be used by
other tests. In the descriptor mutation test we now check the number of keys
against known values rather than relying on checkQueryResponse to count the
number of NULLs in the expected result (which we know).

Embedding a SQLRunner in mutationTest which allows us to use the new function
directly, as well as the other Fatal-on-error wrappers.
@RaduBerinde RaduBerinde force-pushed the check-query-result-cleanup branch from f67a7ac to 97415e1 Compare November 12, 2016 04:02
@RaduBerinde
Copy link
Member Author

Updated.

@tamird
Copy link
Contributor

tamird commented Nov 12, 2016

Reviewed 3 of 3 files at r2.
Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@RaduBerinde RaduBerinde merged commit 2257842 into cockroachdb:master Nov 12, 2016
@RaduBerinde RaduBerinde deleted the check-query-result-cleanup branch November 12, 2016 15:58
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.

3 participants