cockroachdb / cockroachdb/cockroach

ua: remove usage of `tenant 2` as an application tenant from tests

Open
#151,327 0 comments 0 reactions 0 assignees View on GitHub
C-enhancement T-db-server
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

Part of https://github.com/cockroachdb/cockroach/issues/136667

There are around 31 usages of `roachpb.MustMakeTenantID(2)` in tests used for application tenant. We should be replacing them with `tenant 3` or any other relevant id number. This would align with real world scenario where tenant with id 2 doesn't exist currently, which is enforced in demo cluster and normal operations as seen here:

https://github.com/cockroachdb/cockroach/blob/9919801f067f26c951f43cbedfa093c37cdda20e/pkg/sql/tenant_creation.go#L604-L609

When and if a cluster goes through UA migration, tenant 2 would be reserved as a system tenant.

Now, while this migration is necessary to better reflect our production environment, we need to address the following concerns to ensure our test coverage remains robust:

**Boundary Testing of Keyspace Prefixes:** Some of our existing tests may be implicitly testing the boundary conditions between the system tenant keyspace and the application tenant keyspace. We need to identify these tests and ensure that they continue to provide the same level of coverage after the migration to tenant ID 3. This may require refactoring the tests to explicitly target these boundary conditions.

**Preserving Tenant-Specific Test Coverage:** We should keep in mind that we do not lose any test coverage that was specifically designed for tenant 2. We need to carefully analyze the existing tests that use `roachpb.MustMakeTenantID(2)` and ensure that the scenarios they cover are either migrated to the new tenant ID or replaced with equivalent tests.

Jira issue: CRDB-53184

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.