Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jmichalak committed Aug 13, 2024
1 parent fc97d84 commit 8805d19
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/resources/procedure_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
24 changes: 23 additions & 1 deletion pkg/resources/table_constraint_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 8805d19

Please sign in to comment.