From 8805d1946a4afe605e2ef6fa3248dbdc0635e5c7 Mon Sep 17 00:00:00 2001 From: Jakub Michalak Date: Tue, 13 Aug 2024 15:48:52 +0200 Subject: [PATCH] Fix tests --- pkg/resources/procedure_acceptance_test.go | 4 ++-- .../table_constraint_acceptance_test.go | 24 ++++++++++++++++++- .../TestAcc_ExternalFunction/complete/test.tf | 4 ++-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/pkg/resources/procedure_acceptance_test.go b/pkg/resources/procedure_acceptance_test.go index 9ff3dc67bd..50e5750b0f 100644 --- a/pkg/resources/procedure_acceptance_test.go +++ b/pkg/resources/procedure_acceptance_test.go @@ -17,8 +17,8 @@ import ( func testAccProcedure(t *testing.T, configDirectory string) { t.Helper() - oldId := acc.TestClient().Ids.RandomSchemaObjectIdentifier() - newId := acc.TestClient().Ids.RandomSchemaObjectIdentifier() + oldId := acc.TestClient().Ids.RandomSchemaObjectIdentifierWithArguments(sdk.DataTypeVARCHAR) + newId := acc.TestClient().Ids.RandomSchemaObjectIdentifierWithArguments(sdk.DataTypeVARCHAR) resourceName := "snowflake_procedure.p" m := func() map[string]config.Variable { diff --git a/pkg/resources/table_constraint_acceptance_test.go b/pkg/resources/table_constraint_acceptance_test.go index 4144db79f4..2feb8eca0c 100644 --- a/pkg/resources/table_constraint_acceptance_test.go +++ b/pkg/resources/table_constraint_acceptance_test.go @@ -301,7 +301,7 @@ func TestAcc_Table_issue2535_existingTable(t *testing.T) { Source: "Snowflake-Labs/snowflake", }, }, - Config: tableConstraintUniqueConfigUsingFullyQualifiedName(accName, acc.TestDatabaseName, acc.TestSchemaName), + Config: tableConstraintUniqueConfigUsingQualifiedName(accName, acc.TestDatabaseName, acc.TestSchemaName), ExpectError: regexp.MustCompile(`.*table id is incorrect.*`), }, // fixed in the current version @@ -372,6 +372,28 @@ func TestAcc_TableConstraint_ProperlyHandles_EmptyForeignKeyProperties(t *testin }) } +func tableConstraintUniqueConfigUsingQualifiedName(n string, databaseName string, schemaName string) string { + return fmt.Sprintf(` +resource "snowflake_table" "t" { + name = "%s" + database = "%s" + schema = "%s" + + column { + name = "col1" + type = "NUMBER(38,0)" + } +} + +resource "snowflake_table_constraint" "unique" { + name = "%s" + type = "UNIQUE" + table_id = snowflake_table.t.qualified_name + columns = ["col1"] +} +`, n, databaseName, schemaName, n) +} + func tableConstraintUniqueConfigUsingFullyQualifiedName(n string, databaseName string, schemaName string) string { return fmt.Sprintf(` resource "snowflake_table" "t" { diff --git a/pkg/resources/testdata/TestAcc_ExternalFunction/complete/test.tf b/pkg/resources/testdata/TestAcc_ExternalFunction/complete/test.tf index f9f72e3f6b..e1e950a78d 100644 --- a/pkg/resources/testdata/TestAcc_ExternalFunction/complete/test.tf +++ b/pkg/resources/testdata/TestAcc_ExternalFunction/complete/test.tf @@ -54,7 +54,7 @@ resource "snowflake_external_function" "external_function" { value = "snowflake" } max_batch_rows = 500 - request_translator = snowflake_function.test_func_req_translator.fully_qualified_name - response_translator = snowflake_function.test_func_res_translator.fully_qualified_name + request_translator = "${var.database}.${var.schema}.${snowflake_function.test_func_req_translator.name}" + response_translator = "${var.database}.${var.schema}.${snowflake_function.test_func_res_translator.name}" url_of_proxy_and_resource = var.url_of_proxy_and_resource }