Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix QUOTED_IDENTIFIERS_IGNORE_CASE parameter test #2841

Merged
merged 1 commit into from
May 29, 2024

Conversation

sfc-gh-asawicki
Copy link
Collaborator

@sfc-gh-asawicki sfc-gh-asawicki commented May 28, 2024

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

@sfc-gh-asawicki sfc-gh-asawicki marked this pull request as ready for review May 28, 2024 16:19
Copy link

Integration tests success for fa774500942c2b3cb0d791cadb0299732d5905c6

func sessionParameterOnUser(userName string) string {
return fmt.Sprintf(
`
resource "snowflake_user" "u" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no "rule" if we should prefer helper over tf config. The rule of thumb should be: what is more readable? In this case, the user resource is really simple to set up, so both options would be good. It's a bit hard now to get the id of the helper-generated user to put it into config (because of how tf tests are run - we will address this in the future, maybe on one of the happy Fridays), and as you can see there is no method to create with name (and these methods should be avoided for various cases, mostly because it opens a way to use id that is not the generated one), that's why I went with user in tf config.

@sfc-gh-asawicki sfc-gh-asawicki merged commit 92ad1d3 into main May 29, 2024
10 checks passed
@sfc-gh-asawicki sfc-gh-asawicki deleted the fix-parameters-test branch May 29, 2024 07:34
sfc-gh-jmichalak pushed a commit that referenced this pull request May 31, 2024
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
sfc-gh-jcieslak pushed a commit that referenced this pull request Jun 6, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.92.0](v0.91.0...v0.92.0)
(2024-06-06)


### 🎉 **What's new:**

* Add Api Authentication security integration to sdk
([#2840](#2840))
([57a07ee](57a07ee))
* Add External Oauth security integration to sdk
([#2835](#2835))
([82d1c09](82d1c09))
* add network rules
([#2746](#2746))
([c79fa29](c79fa29))
* Add SCIM and SAML2 security integrations to sdk
([#2799](#2799))
([1312ff1](1312ff1))
* Add Snowflake Oauth security integration to sdk
([#2830](#2830))
([b576f29](b576f29))
* Database resource v1 readiness
([#2834](#2834))
([30fe136](30fe136))
* Database SDK upgrade
([#2814](#2814))
([750fe37](750fe37))


### 🔧 **Misc**

* accept non-pointer values in the generated builder methods
([#2816](#2816))
([c29fbf1](c29fbf1))
* Add a script for creating labels
([#2778](#2778))
([ce0fbad](ce0fbad))
* Adjust before 0.92.0
([#2857](#2857))
([0598656](0598656))
* Continue random ids rework
([#2819](#2819))
([f20940c](f20940c))
* Random ids rework part3
([#2833](#2833))
([36ead85](36ead85))
* Random ids rework part4
([#2837](#2837))
([64518a3](64518a3))
* Update issue for table and warehouse redesign state
([#2845](#2845))
([149e55e](149e55e))


### 🐛 **Bug fixes:**

* Fix failing integration tests
([#2832](#2832))
([2e2ca6c](2e2ca6c))
* Fix QUOTED_IDENTIFIERS_IGNORE_CASE parameter test
([#2841](#2841))
([92ad1d3](92ad1d3))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: snowflake-release-please[bot] <105954990+snowflake-release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants