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

multitenant: add TestTenants() helper to TestServer #88476

Merged
merged 1 commit into from
Sep 22, 2022

Conversation

msbutler
Copy link
Collaborator

This patch adds a helper method for accessing information about the tenant(s) that were probabilistically created with the TestServer.

Release note: None

This patch adds a helper method for accessing information about the tenant(s)
that were probabilistically created with the TestServer.

Release note: None
@msbutler msbutler added the T-multitenant Issues owned by the multi-tenant virtual team label Sep 22, 2022
@msbutler msbutler self-assigned this Sep 22, 2022
@msbutler msbutler requested review from a team as code owners September 22, 2022 16:41
@msbutler msbutler requested review from smg260 and removed request for a team September 22, 2022 16:41
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@ajstorm ajstorm left a comment

Choose a reason for hiding this comment

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

:lgtm: One nit for your consideration.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @knz, @msbutler, and @smg260)


pkg/server/testserver.go line 505 at r1 (raw file):

// TestTenants provides information to tenant(s) that _may_ have been created
func (ts *TestServer) TestTenants() []serverutils.TestTenantInterface {

Nit: Rather than return the whole slice, does it make more sense to have the function take an integer argument and only return the test tenant in question (or nil if the index exceeds the size of the slice)? I'd imagine that in most cases, only a specific test tenant would be needed by the caller (this is definitely the case now, as there will only ever be one test tenant).

Copy link
Collaborator Author

@msbutler msbutler 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! 1 of 0 LGTMs obtained (waiting on @ajstorm, @knz, and @smg260)


pkg/server/testserver.go line 505 at r1 (raw file):

Previously, ajstorm (Adam Storm) wrote…

Nit: Rather than return the whole slice, does it make more sense to have the function take an integer argument and only return the test tenant in question (or nil if the index exceeds the size of the slice)? I'd imagine that in most cases, only a specific test tenant would be needed by the caller (this is definitely the case now, as there will only ever be one test tenant).

yeah good q: i'm tempted to keep it as is, because I'm unsure how a test user would know which tenant they'd want, and therefore, which index they'd use. Once the testServer starts generating multiple tenants per server, I imagine this func could be refactored.

@msbutler
Copy link
Collaborator Author

TFTR!
bors r=ajstorm

@craig
Copy link
Contributor

craig bot commented Sep 22, 2022

Build succeeded:

@craig craig bot merged commit d390148 into cockroachdb:master Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-multitenant Issues owned by the multi-tenant virtual team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants