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

storage: remove dependency to sql/catalog/bootstrap #83719

Merged

Conversation

Xiang-Gu
Copy link
Contributor

@Xiang-Gu Xiang-Gu commented Jul 1, 2022

Previously, tests in pkg/storage depended on sql/catalog/bootstrap.
This was inadequate/weird because storage is a much lower layer in the
architectural stack. It will also help prevent dependency cycles in
other PRs when we introduce depencies (see #82172 if interested).

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @Xiang-Gu)


pkg/storage/BUILD.bazel line 192 at r1 (raw file):

    disallowed_list = [
        "//pkg/sql/catalog/bootstrap",
    ],

I don't think this does what you think it does. I think this only ensure that the library itself does not depend on bootstrap. Sadly, I don't think there's a way right now to represent the test dependencies.

Code quote:

disallowed_imports_test(
    src = "storage",
    disallowed_list = [
        "//pkg/sql/catalog/bootstrap",
    ],

pkg/storage/helpers_test.go line 11 at r1 (raw file):

// licenses/APL.txt.

package storage_test

consider calling this file external_helpers_test.go. I think of helpers_test.go as the conventional file for forwarding unexported references from the current packages to tests defined in the _test package. This is going the other way.


pkg/storage/mvcc_test.go line 5018 at r1 (raw file):

}

var TestingUserTableDataMin func() roachpb.Key

note that this is injected via external_helpers_test.go, same for the other var

@Xiang-Gu Xiang-Gu force-pushed the break_dep_from_storage_to_bootstrap branch from 0e2f329 to bc7e733 Compare July 1, 2022 21:42
Previously, tests in `pkg/storage` depended on `sql/catalog/bootstrap`.
This was inadequate/weird because `storage` is a much lower layer in the
architectural stack. It will also help prevent dependency cycles in
other PRs when we introduce depencies (see cockroachdb#82172 if interested).

Release note: None
@Xiang-Gu Xiang-Gu force-pushed the break_dep_from_storage_to_bootstrap branch from bc7e733 to 6ba0ac6 Compare July 1, 2022 21:45
Copy link
Contributor Author

@Xiang-Gu Xiang-Gu left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner)


pkg/storage/BUILD.bazel line 192 at r1 (raw file):

Previously, ajwerner wrote…

I don't think this does what you think it does. I think this only ensure that the library itself does not depend on bootstrap. Sadly, I don't think there's a way right now to represent the test dependencies.

So, this rule will ignore files that end with *_test.go, so even if one *_test.go file (packaged storage) imports /pkg/sql/catalog/bootstrap, it won't catch and disallow it, right?


pkg/storage/mvcc_test.go line 5018 at r1 (raw file):

Previously, ajwerner wrote…

note that this is injected via external_helpers_test.go, same for the other var

done


pkg/storage/helpers_test.go line 11 at r1 (raw file):

Previously, ajwerner wrote…

consider calling this file external_helpers_test.go. I think of helpers_test.go as the conventional file for forwarding unexported references from the current packages to tests defined in the _test package. This is going the other way.

done

@Xiang-Gu Xiang-Gu marked this pull request as ready for review July 1, 2022 21:46
@Xiang-Gu Xiang-Gu requested a review from a team as a code owner July 1, 2022 21:46
Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 4 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @Xiang-Gu)

@Xiang-Gu
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Jul 11, 2022

Build failed (retrying...):

@craig craig bot merged commit 10853d2 into cockroachdb:master Jul 11, 2022
@craig
Copy link
Contributor

craig bot commented Jul 11, 2022

Build succeeded:

@Xiang-Gu Xiang-Gu deleted the break_dep_from_storage_to_bootstrap branch July 11, 2022 21:03
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