diff --git a/pkg/sdk/testint/helpers_test.go b/pkg/sdk/testint/helpers_test.go index d264b88a028..8012ad0ed45 100644 --- a/pkg/sdk/testint/helpers_test.go +++ b/pkg/sdk/testint/helpers_test.go @@ -47,10 +47,10 @@ func useWarehouse(t *testing.T, client *sdk.Client, warehouseID sdk.AccountObjec func createDatabase(t *testing.T, client *sdk.Client) (*sdk.Database, func()) { t.Helper() - return createDatabaseWithOptions(t, client, sdk.RandomAccountObjectIdentifier(), testSchema(t).ID(), &sdk.CreateDatabaseOptions{}) + return createDatabaseWithOptions(t, client, sdk.RandomAccountObjectIdentifier(), &sdk.CreateDatabaseOptions{}) } -func createDatabaseWithOptions(t *testing.T, client *sdk.Client, id sdk.AccountObjectIdentifier, useSchemaAfterDatabaseDrop sdk.DatabaseObjectIdentifier, opts *sdk.CreateDatabaseOptions) (*sdk.Database, func()) { +func createDatabaseWithOptions(t *testing.T, client *sdk.Client, id sdk.AccountObjectIdentifier, opts *sdk.CreateDatabaseOptions) (*sdk.Database, func()) { t.Helper() ctx := context.Background() err := client.Databases.Create(ctx, id, opts) @@ -60,7 +60,7 @@ func createDatabaseWithOptions(t *testing.T, client *sdk.Client, id sdk.AccountO return database, func() { err := client.Databases.Drop(ctx, id, nil) require.NoError(t, err) - err = client.Sessions.UseSchema(ctx, useSchemaAfterDatabaseDrop) + err = client.Sessions.UseSchema(ctx, sdk.NewDatabaseObjectIdentifier(TestDatabaseName, TestSchemaName)) require.NoError(t, err) } } diff --git a/pkg/sdk/testint/setup_test.go b/pkg/sdk/testint/setup_test.go index 190f5db2a22..2af6cbe5725 100644 --- a/pkg/sdk/testint/setup_test.go +++ b/pkg/sdk/testint/setup_test.go @@ -15,6 +15,12 @@ const ( secondaryAccountProfile = "secondary_test_account" ) +var ( + TestWarehouseName = "int_test_wh_" + random.UUID() + TestDatabaseName = "int_test_db_" + random.UUID() + TestSchemaName = "int_test_sc_" + random.UUID() +) + var itc integrationTestContext func TestMain(m *testing.M) { @@ -146,8 +152,7 @@ func (itc *integrationTestContext) initialize() error { } func createDb(client *sdk.Client, ctx context.Context) (*sdk.Database, func(), error) { - name := "int_test_db_" + random.UUID() - id := sdk.NewAccountObjectIdentifier(name) + id := sdk.NewAccountObjectIdentifier(TestDatabaseName) err := client.Databases.Create(ctx, id, nil) if err != nil { return nil, nil, err @@ -159,21 +164,19 @@ func createDb(client *sdk.Client, ctx context.Context) (*sdk.Database, func(), e } func createSc(client *sdk.Client, ctx context.Context, db *sdk.Database) (*sdk.Schema, func(), error) { - name := "int_test_sc_" + random.UUID() - id := sdk.NewDatabaseObjectIdentifier(db.Name, name) + id := sdk.NewDatabaseObjectIdentifier(db.Name, TestSchemaName) err := client.Schemas.Create(ctx, id, nil) if err != nil { return nil, nil, err } - schema, err := client.Schemas.ShowByID(ctx, sdk.NewDatabaseObjectIdentifier(db.Name, name)) + schema, err := client.Schemas.ShowByID(ctx, sdk.NewDatabaseObjectIdentifier(db.Name, TestSchemaName)) return schema, func() { _ = client.Schemas.Drop(ctx, id, nil) }, err } func createWh(client *sdk.Client, ctx context.Context) (*sdk.Warehouse, func(), error) { - name := "int_test_wh_" + random.UUID() - id := sdk.NewAccountObjectIdentifier(name) + id := sdk.NewAccountObjectIdentifier(TestWarehouseName) err := client.Warehouses.Create(ctx, id, nil) if err != nil { return nil, nil, err diff --git a/pkg/sdk/testint/shares_integration_test.go b/pkg/sdk/testint/shares_integration_test.go index fe282b35fe1..0050a1e43c9 100644 --- a/pkg/sdk/testint/shares_integration_test.go +++ b/pkg/sdk/testint/shares_integration_test.go @@ -183,7 +183,7 @@ func TestInt_SharesAlter(t *testing.T) { }) t.Run("set accounts", func(t *testing.T) { - db, dbCleanup := createDatabaseWithOptions(t, secondaryClient, sdk.RandomAccountObjectIdentifier(), testSchema(t).ID(), nil) + db, dbCleanup := createDatabase(t, secondaryClient) t.Cleanup(dbCleanup) shareTest, shareCleanup := createShare(t, secondaryClient) @@ -372,7 +372,7 @@ func TestInt_ShareDescribeConsumer(t *testing.T) { consumerClient := testClient(t) t.Run("describe share", func(t *testing.T) { - db, dbCleanup := createDatabaseWithOptions(t, providerClient, sdk.RandomAccountObjectIdentifier(), testSchema(t).ID(), nil) + db, dbCleanup := createDatabase(t, providerClient) t.Cleanup(dbCleanup) shareTest, shareCleanup := createShare(t, providerClient)