Skip to content

fix: Propose changes to assertions setup with varying test client#3406

Merged
sfc-gh-asawicki merged 1 commit into
devfrom
fix-integration-tests-setup
Feb 21, 2025
Merged

fix: Propose changes to assertions setup with varying test client#3406
sfc-gh-asawicki merged 1 commit into
devfrom
fix-integration-tests-setup

Conversation

@sfc-gh-asawicki

@sfc-gh-asawicki sfc-gh-asawicki commented Feb 21, 2025

Copy link
Copy Markdown
Contributor

Currently, the Snowflake object assertions have a fixed test client reference, e.g.: https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/9be21966ca5b1187d5c055026dd5f563900a1aa9/pkg/acceptance/bettertestspoc/assert/objectassert/user_snowflake_gen.go#L23.

Because of that, running the SDK integration tests depends on the acceptance package which is not ideal.

The current PR introduces a proposal on how the test client can be pushed to the assertions setup:

  1. We modify the common assertions setup and helper functions to allow receiving the test client as an argument. For now, these are just duplicates that will be cleaned up when we apply them to all existing object assertions and assertion types.
  2. When setting up a specific assertion, instead of passing the provider directly, we pass a function that receives the test client and returns the provider.
  3. We add a dedicated function for acceptance and integration tests that takes care of the client pick; this way, we are sure that the developer picks the proper client (later, it should be also checked on the architecture tests level - proper importing).

Next steps (1 or more PRs):

  1. Apply this for all assertion types that run the VerifyAll method underneath.
  2. Alter the generation to generate default object assert instructors without specified test client but with the function.
  3. Use proper assertions in all tests.
  4. Remove deprecated logic (old snowflake object assertion constructor receiving a provider).

@sfc-gh-asawicki sfc-gh-asawicki changed the title fix: Fix integration tests setup fix: Propose changes to assertions setup with varying test client Feb 21, 2025
@sfc-gh-asawicki sfc-gh-asawicki marked this pull request as ready for review February 21, 2025 13:20
@github-actions

Copy link
Copy Markdown

Integration tests failure for 6fdf097990126b12ab36be04af57f23f9a3eae9c

@sfc-gh-asawicki sfc-gh-asawicki merged commit fb27f6a into dev Feb 21, 2025
@sfc-gh-asawicki sfc-gh-asawicki deleted the fix-integration-tests-setup branch February 21, 2025 16:13
sfc-gh-jcieslak pushed a commit that referenced this pull request Feb 26, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.0.4](v1.0.3...v1.0.4)
(2025-02-26)


### 🔧 **Misc**

* Add GA scope to the roadmap
([#3385](#3385))
([9be2196](9be2196))
* Adjust saml2_integration documentation
([#3415](#3415))
([b8c127d](b8c127d))
* Bump Go version
([#3408](#3408))
([902670e](902670e))
* Bump provider version
([#3419](#3419))
([552e44b](552e44b))
* Remove hardcoded values from documentation
([#3381](#3381))
([cb1d6e2](cb1d6e2))
* Update user docs
([#3416](#3416))
([9d5224f](9d5224f)),
closes
[#3404](#3404)
* Upgrade deps
([#3389](#3389))
([086bf15](086bf15))


### 🐛 **Bug fixes:**

* account for null comment
([#3417](#3417))
([2f7f80f](2f7f80f))
* external function varchar return type validation
([#3400](#3400))
([abf5883](abf5883))
* Fix managed account and adjust account ticket numbers
([#3395](#3395))
([a7cb5cb](a7cb5cb))
* Propose changes to assertions setup with varying test client
([#3406](#3406))
([fb27f6a](fb27f6a))

---
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>
sfc-gh-asawicki added a commit that referenced this pull request Mar 11, 2025
Continuation to #3406.

- Parametrize test client in all assertions and helper functions
- Alter the generation of object assertions
- Use proper assertions in all tests
- Remove deprecated logic
- Fix assertions in integration tests
- Split object suffix generation to different packages
- Fix tests for resource monitors
- Fix tests and documentation for not enough privileges when
provisioning users
sfc-gh-jmichalak pushed a commit that referenced this pull request Mar 24, 2025
Continuation to #3406.

- Parametrize test client in all assertions and helper functions
- Alter the generation of object assertions
- Use proper assertions in all tests
- Remove deprecated logic
- Fix assertions in integration tests
- Split object suffix generation to different packages
- Fix tests for resource monitors
- Fix tests and documentation for not enough privileges when
provisioning users
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