Skip to content

sql: make TestDropFunction work with test tenant #107322

@yuzefovich

Description

@yuzefovich

Currently, TestDropFunction hard-codes IDs as if it is run against the system tenant. The IDs should be retrieved programmatically instead so that it would work against the test tenant too.

In order to repro:

  • remove the skip and enable CCL license:
--- a/pkg/sql/drop_function_test.go
+++ b/pkg/sql/drop_function_test.go
@@ -17,6 +17,7 @@ import (
        "testing"
 
        "github.com/cockroachdb/cockroach/pkg/base"
+       "github.com/cockroachdb/cockroach/pkg/ccl"
        "github.com/cockroachdb/cockroach/pkg/sql"
        "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb"
        "github.com/cockroachdb/cockroach/pkg/sql/catalog/descs"
@@ -33,11 +34,10 @@ import (
 func TestDropFunction(t *testing.T) {
        defer leaktest.AfterTest(t)()
        defer log.Scope(t).Close(t)
+       defer ccl.TestingEnableEnterprise()()
 
        ctx := context.Background()
-       s, sqlDB, _ := serverutils.StartServer(t, base.TestServerArgs{
-               DefaultTestTenant: base.TestDoesNotWorkWithSecondaryTenantsButWeDontKnowWhyYet(107322),
-       })
+       s, sqlDB, _ := serverutils.StartServer(t, base.TestServerArgs{})
        defer s.Stopper().Stop(ctx)
        tDB := sqlutils.MakeSQLRunner(sqlDB)
  • run with something like ./dev test pkg/sql -f=TestDropFunction -v --stream-output -- --test_env=COCKROACH_TEST_TENANT=true
        	Error:      	Received unexpected error:
        	            	function 109 does not exist: function undefined

Jira issue: CRDB-29987
Epic CRDB-48944

Metadata

Metadata

Assignees

Labels

A-multitenancyRelated to multi-tenancyC-cleanupTech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)db-cy-23target-release-26.2.0v26.2.0-prerelease

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions