-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Clean up old test object helpers (#3049)
- remove old helpers (testDb, testSchema, testWarehouse) - use `TestClient` instead of `Client` in the acceptance tests - add missing helpers - add missing helper methods - move grant helpers from role client to grant client
- Loading branch information
1 parent
5f54ff9
commit 78ecb62
Showing
46 changed files
with
636 additions
and
684 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package helpers | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
type ExternalTableClient struct { | ||
context *TestClientContext | ||
ids *IdsGenerator | ||
} | ||
|
||
func NewExternalTableClient(context *TestClientContext, idsGenerator *IdsGenerator) *ExternalTableClient { | ||
return &ExternalTableClient{ | ||
context: context, | ||
ids: idsGenerator, | ||
} | ||
} | ||
|
||
func (c *ExternalTableClient) client() sdk.ExternalTables { | ||
return c.context.client.ExternalTables | ||
} | ||
|
||
func (c *ExternalTableClient) PublishDataToStage(t *testing.T, stageId sdk.SchemaObjectIdentifier, data []byte) { | ||
t.Helper() | ||
ctx := context.Background() | ||
|
||
_, err := c.context.client.ExecForTests(ctx, fmt.Sprintf(`copy into @%s/external_tables_test_data/test_data from (select parse_json('%s')) overwrite = true`, stageId.FullyQualifiedName(), string(data))) | ||
require.NoError(t, err) | ||
} |
Oops, something went wrong.