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

testutils: add storageutils test utilities #83389

Merged
merged 1 commit into from
Jun 29, 2022

Conversation

erikgrinaker
Copy link
Contributor

@erikgrinaker erikgrinaker commented Jun 26, 2022

This patch adds a bunch of test utilities to storageutils, replacing
the old sstutil package. This is done to ease testing of MVCC range
keys in tests outside the storage package.

Unfortunately, these are mostly duplicates of utilities in storage.
Storage tests use the storage package rather than storage_test, and
can't make use of storageutils yet because it causes an import cycle
with storage. This will (hopefully) be addressed separately.

Release note: None

@erikgrinaker erikgrinaker requested a review from aliher1911 June 26, 2022 17:13
@erikgrinaker erikgrinaker self-assigned this Jun 26, 2022
@erikgrinaker erikgrinaker requested review from a team as code owners June 26, 2022 17:13
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@nicktrav nicktrav left a comment

Choose a reason for hiding this comment

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

:lgtm: - I did a fairly mechanical review, operating under the assumption that a lot of this was copypasta, and then some mechanical changes to the tests to make use of the new (for now, duplicate) utils / helpers.

Reviewed 19 of 19 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @aliher1911 and @erikgrinaker)


-- commits line 11 at r1:

This will (hopefully) be addressed separately.

It sounds like we want the utils moved out of storage and into storageutils. Then storage (both the test and lib targets) can have a dep on this new package, removing the need for duplication? Or is it more nuanced than that?

If that sounds right, I'll create an issue and we can get this cleaned up in the background.

Copy link
Contributor Author

@erikgrinaker erikgrinaker left a comment

Choose a reason for hiding this comment

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

Yeah, and this is all fairly straightforward code. TFTR!

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @aliher1911 and @nicktrav)


-- commits line 11 at r1:

Previously, nicktrav (Nick Travers) wrote…

This will (hopefully) be addressed separately.

It sounds like we want the utils moved out of storage and into storageutils. Then storage (both the test and lib targets) can have a dep on this new package, removing the need for duplication? Or is it more nuanced than that?

If that sounds right, I'll create an issue and we can get this cleaned up in the background.

Not that simple, I'm afraid. storageutils must depend on storage, because it needs e.g. storage.MVCCKey, but that means that the tests in storage can't depend on storageutils, because it depends on storage, so it's a circular dependency.

For this to work, all storage tests must be in storage_test, which depends on storageutils, which depends on storage.

I really wish it would be possible to just import _test.go contents from a different package, so e.g. batcheval could just import test utils from storage, but no such luck -- this is the canonical way, apparently.

This patch adds a bunch of test utilities to `storageutils`, replacing
the old `sstutil` package. This is done to ease testing of MVCC range
keys in tests outside the `storage` package.

Unfortunately, these are mostly duplicates of utilities in `storage`.
Storage tests use the `storage` package rather than `storage_test`, and
can't make use of `storageutils` yet because it causes an import cycle
with `storage`. This will (hopefully) be addressed separately.

Release note: None
@erikgrinaker
Copy link
Contributor Author

CI failures are unrelated.

bors r=nicktrav

@craig
Copy link
Contributor

craig bot commented Jun 29, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jun 29, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jun 29, 2022

Build succeeded:

@craig craig bot merged commit 73e4816 into cockroachdb:master Jun 29, 2022
@erikgrinaker erikgrinaker deleted the storageutils branch June 30, 2022 10:55
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