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

server: add tests for combined stmts api source tables #112106

Merged
merged 2 commits into from
Oct 31, 2023

Conversation

xinhaoz
Copy link
Member

@xinhaoz xinhaoz commented Oct 10, 2023

This patch creates the sqlstatstestutils pkg in
sqlstats/persistedsqlstats. It moves the function
GetRandomizedCollectedStatementStatisticsForTest which was
previously in sqlstatsutil. This pkg is introduced in
preparation for adding more testing utilities to mock sql
stats tables without creating cyclic dependencies with
sqlstatsutil.

Epic: none

Release note: None

2: server: add tests for combined stmts api

Add testing to verify that the combined stmts api uses the
correct source tables given different table states.

Epic: none

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@xinhaoz xinhaoz force-pushed the add-stmts-api-tests branch from 4fcc4d2 to f854072 Compare October 10, 2023 17:12
@xinhaoz xinhaoz changed the title sqlstats: move testutils to own package server: add tests for combined stmts api source tables Oct 10, 2023
@xinhaoz xinhaoz marked this pull request as ready for review October 10, 2023 17:12
@xinhaoz xinhaoz requested review from a team and abarganier and removed request for a team October 10, 2023 17:13
@xinhaoz xinhaoz force-pushed the add-stmts-api-tests branch 2 times, most recently from 2d46114 to d005e98 Compare October 10, 2023 17:23
Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Reviewed 7 of 7 files at r1, 5 of 5 files at r2, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @abarganier and @xinhaoz)


pkg/sql/sqlstats/persistedsqlstats/sqlstatsutil/sqlstatstestutil/testutils.go line 365 at r2 (raw file):

		statistics,             // statistics
		plan,                   // plan
		// TODO allow these values to be mocked. No need ffor them for now.

nit: typo ffor

@xinhaoz xinhaoz force-pushed the add-stmts-api-tests branch 8 times, most recently from 317a5eb to 7d6d4c5 Compare October 12, 2023 19:50
@xinhaoz xinhaoz force-pushed the add-stmts-api-tests branch from 7d6d4c5 to 9c963e8 Compare October 30, 2023 14:33
@xinhaoz xinhaoz requested a review from maryliag October 30, 2023 14:34
Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

just one nit, otherwise :lgtm:

Reviewed 5 of 14 files at r3, 5 of 5 files at r4, 5 of 9 files at r5, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @abarganier and @xinhaoz)


pkg/sql/sqlstats/persistedsqlstats/sqlstatstestutil/testutils.go line 1 at r4 (raw file):

// Copyright 2021 The Cockroach Authors.

nit: 2023

@xinhaoz xinhaoz force-pushed the add-stmts-api-tests branch 2 times, most recently from 302ee56 to bfb6d0c Compare October 30, 2023 18:01
@xinhaoz xinhaoz requested review from a team as code owners October 30, 2023 18:01
@xinhaoz xinhaoz requested review from msbutler and removed request for a team October 30, 2023 18:01
@xinhaoz xinhaoz force-pushed the add-stmts-api-tests branch from bfb6d0c to 5a1ac14 Compare October 30, 2023 18:01
This patch creates the sqlstatstestutils pkg in
sqlstats/persistedsqlstats.  It moves the function
`GetRandomizedCollectedStatementStatisticsForTest` which was
previously in sqlstatsutil. This pkg is introduced in
preparation for adding more testing utilities to mock sql
stats tables without creating cyclic dependencies with
sqlstatsutil.

Epic: none

Release note: None
Add testing to verify that the combined stmts api uses the
correct source tables given different table states.

Epic: none

Release note: None
@xinhaoz xinhaoz force-pushed the add-stmts-api-tests branch from 5a1ac14 to 392a28b Compare October 31, 2023 14:19
@xinhaoz
Copy link
Member Author

xinhaoz commented Oct 31, 2023

tftr!
bors r=maryliag

@craig
Copy link
Contributor

craig bot commented Oct 31, 2023

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Oct 31, 2023

Build succeeded:

@craig craig bot merged commit 6bd0235 into cockroachdb:master Oct 31, 2023
3 checks passed
@xinhaoz xinhaoz deleted the add-stmts-api-tests branch April 1, 2024 17:06
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