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: datadriven telemetry tests #47133

Merged
merged 3 commits into from
Apr 9, 2020
Merged

Conversation

RaduBerinde
Copy link
Member

server: clean up telemetry URL code

This change moves the code related to diagnostics URLs to diagnosicspb and
adds infrastructure to override the URLs via testing knobs (rather than fiddling
with global values).

Release note: None

server: move mockRecorder

Move mockRecorder to diagutil.Server and clean up the API.

Release note: None

sql: add datadriven telemetry tests

This commit adds sql.TestTelemetry which uses a datadriven approach to
telemetry testing. See the comment for that function for more details.

TestCBOReportUsage is converted to a datadriven test. Similar tests should be
moved over in subsequent changes.

Informs #46730.

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@blathers-crl
Copy link

blathers-crl bot commented Apr 7, 2020

❌ The GitHub CI (Cockroach) build has failed on 3683cd58.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. I am experimental - my owner is otan.

Copy link
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

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

Very nice.

LGTM with two nits

return errors.Errorf("expected cluster id %v got %v", expected, actual)
}
if expected, actual := ts.node.Descriptor.NodeID, r.last.Node.NodeID; expected != actual {
if expected, actual := ts.node.Descriptor.NodeID, last.Node.NodeID; expected != actual {
Copy link
Contributor

Choose a reason for hiding this comment

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

is there maybe a way to pretty-print the report in the datadriven test, and make all these assertions in the datadriven test too?

if errors.HasAssertionFailure(err) {
td.Fatalf(t, "%+v", err)
}
return fmt.Sprintf("error: %v\n", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

your tests don't have expected errors. I'd fatal the test upon any error here.

Copy link
Member Author

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

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

TFTR!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @asubiotto, @dt, @knz, @otan, and @yuzefovich)


pkg/server/updates_test.go, line 486 at r3 (raw file):

Previously, knz (kena) wrote…

is there maybe a way to pretty-print the report in the datadriven test, and make all these assertions in the datadriven test too?

Yeah I plan to think about something for this too. Just wanted to get a review before I go too deep into the rabbit hole :)


pkg/sql/telemetry_test.go, line 101 at r3 (raw file):

Previously, knz (kena) wrote…

your tests don't have expected errors. I'd fatal the test upon any error here.

There will be cases where we expect errors - at least the crdb_internal.force_error tests from TestReportUsage; I was also thinking of adding a telemetry counter for when someone tries to use a recursive CTE that uses UNION instead of UNION ALL, which is not currently supported.

This change moves the code related to diagnostics URLs to `diagnosicspb` and
adds infrastructure to override the URLs via testing knobs (rather than fiddling
with global values).

Release note: None
Move `mockRecorder` to `diagutil.Server` and clean up the API.

Release note: None
This commit adds `sql.TestTelemetry` which uses a datadriven approach to
telemetry testing. See the comment for that function for more details.

`TestCBOReportUsage` is converted to a datadriven test. Similar tests should be
moved over in subsequent changes.

Informs cockroachdb#46730.

Release note: None
@RaduBerinde
Copy link
Member Author

bors r+

@craig
Copy link
Contributor

craig bot commented Apr 9, 2020

Build succeeded

@craig craig bot merged commit 59d8c9d into cockroachdb:master Apr 9, 2020
@RaduBerinde RaduBerinde deleted the telemetry-stuff branch April 10, 2020 01:30
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