-
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.
fix: Fix QUOTED_IDENTIFIERS_IGNORE_CASE parameter test (#2841)
Setting `QUOTED_IDENTIFIERS_IGNORE_CASE` in `TestAcc_Parameters_QuotedIdentifiersIgnoreCaseCanBeSet` was interfering with the tests being run on other branches. It resulted in seemingly random `Database 'XYZ' does not exist or not authorized` errors for database that exists, works moments before and moments after. Sequence of example statements: ``` -- 2024-05-28 11:28:34.634 +0000 -- CREATE MATERIALIZED VIEW "int_test_db_IT_C0E0DFE82EF6223390C3723866862A273A406F10"."int_test_sc_IT_C0E0DFE82EF6223390C3723866862A273A406F10"."AFKRZIIT_C0E0DFE82EF6223390C3723866862A273A406F10" CLUSTER BY ("ID") AS SELECT id FROM "int_test_db_IT_C0E0DFE82EF6223390C3723866862A273A406F10"."int_test_sc_IT_C0E0DFE82EF6223390C3723866862A273A406F10"."VYODPJIT_C0E0DFE82EF6223390C3723866862A273A406F10" ... -- 2024-05-28 11:28:35.019 +0000 -- ALTER ACCOUNT SET QUOTED_IDENTIFIERS_IGNORE_CASE = true ... -- 2024-05-28 11:28:35.123 +0000 -- SHOW MATERIALIZED VIEWS LIKE 'AFKRZIIT_C0E0DFE82EF6223390C3723866862A273A406F10' IN SCHEMA "int_test_db_IT_C0E0DFE82EF6223390C3723866862A273A406F10"."int_test_sc_IT_C0E0DFE82EF6223390C3723866862A273A406F10" ``` What was done: - test `TestAcc_Parameters_QuotedIdentifiersIgnoreCaseCanBeSet` creates new user and sets the `QUOTED_IDENTIFIERS_IGNORE_CASE` parameter on it - fail-fast guards added to integration and acceptance tests setups to prevent running tests when `QUOTED_IDENTIFIERS_IGNORE_CASE` is set to true initially
- Loading branch information
1 parent
82d1c09
commit 92ad1d3
Showing
4 changed files
with
55 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package helpers | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"log" | ||
|
||
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk" | ||
) | ||
|
||
func EnsureQuotedIdentifiersIgnoreCaseIsSetToFalse(client *sdk.Client, ctx context.Context) error { | ||
log.Printf("[DEBUG] Making sure QUOTED_IDENTIFIERS_IGNORE_CASE parameter is set correctly") | ||
param, err := client.Parameters.ShowAccountParameter(ctx, sdk.AccountParameterQuotedIdentifiersIgnoreCase) | ||
if err != nil { | ||
return fmt.Errorf("checking QUOTED_IDENTIFIERS_IGNORE_CASE resulted in error: %w", err) | ||
} | ||
if param.Value != "false" { | ||
return fmt.Errorf("parameter QUOTED_IDENTIFIERS_IGNORE_CASE has value %s, expected: false", param.Value) | ||
} | ||
return nil | ||
} |
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