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

chore: Improve tags integration tests #3193

Merged
merged 4 commits into from
Nov 18, 2024
Merged

chore: Improve tags integration tests #3193

merged 4 commits into from
Nov 18, 2024

Conversation

sfc-gh-jmichalak
Copy link
Collaborator

@sfc-gh-jmichalak sfc-gh-jmichalak commented Nov 12, 2024

  • move all of the set/unset tags integration tests to one place
  • add necessary helper clients
  • return error on getting tag of a resource that is not supported

Test Plan

  • integration tests

TODO

  • rework tag and tag_association resources
  • add tags data source
  • support empty tag values in GetTag

Copy link

Integration tests failure for c2bd0bffba07d56b8320187313bb7f0fae918a36

@sfc-gh-jmichalak sfc-gh-jmichalak requested review from sfc-gh-asawicki and sfc-gh-jcieslak and removed request for sfc-gh-asawicki November 13, 2024 10:28
@sfc-gh-jmichalak sfc-gh-jmichalak marked this pull request as ready for review November 13, 2024 10:28
Copy link
Collaborator

@sfc-gh-jcieslak sfc-gh-jcieslak left a comment

Choose a reason for hiding this comment

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

nice tests 📈

pkg/sdk/security_integrations_dto_gen.go Show resolved Hide resolved
pkg/sdk/tag_association_validations.go Outdated Show resolved Hide resolved
})
require.NoError(t, err)

_, err = client.SystemFunctions.GetTag(ctx, tag.ID(), testClientHelper().Ids.AccountIdentifierWithLocator(), sdk.ObjectTypeAccount)
Copy link
Collaborator

Choose a reason for hiding this comment

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

it's a rather ugly error, weren't we supposed to do something with it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Next PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, please add to the PR description then, and I am keeping it open

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It already was: support empty tag values in GetTag will tackle this.

pkg/sdk/testint/tags_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/testint/tags_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/testint/tags_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/testint/tags_integration_test.go Show resolved Hide resolved
{
name: "ApplicationPackage",
objectType: sdk.ObjectTypeApplicationPackage,
setupObject: func() sdk.AccountObjectIdentifier {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: setupObject could be extracted to method:

  • invoking creation on the given client method
  • setting up the cleanup
  • returning ID
    setup of all tests would be shorter then

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Partially done.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Any follow-up added to the cleanup epic?

Copy link

Integration tests cancelled for 04775c054e844c4d65c44023b54e22a2d9415edc

@sfc-gh-jmichalak sfc-gh-jmichalak mentioned this pull request Nov 15, 2024
2 tasks
Copy link

Integration tests failure for 99796c92bab2733b79c65980a48189a8a8f35014

@@ -15,6 +15,8 @@ type Tags interface {
Undrop(ctx context.Context, request *UndropTagRequest) error
Set(ctx context.Context, request *SetTagRequest) error
Copy link
Collaborator

Choose a reason for hiding this comment

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

To be more consistent with other objects, we could modify the Set method so that inside, you would choose on what object you want to set the tag (I think the Options struct should be more similar to GrantPrivilegesToAccountRoleOptions one where you have on field with sub-fields being: OnAccount, OnObject, OnColumn).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I disagree because in SetOnCurrentAccount we don't use any identifier. We're modifying the current account like ALTER ACCOUNT, where this one uses ALTER <type> <id> which is different.

@sfc-gh-asawicki sfc-gh-asawicki self-requested a review November 18, 2024 10:17
@sfc-gh-jmichalak sfc-gh-jmichalak merged commit 7736e0a into main Nov 18, 2024
8 of 9 checks passed
@sfc-gh-jmichalak sfc-gh-jmichalak deleted the tags-v1 branch November 18, 2024 13:08
sfc-gh-jmichalak pushed a commit that referenced this pull request Nov 26, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.99.0](v0.98.0...v0.99.0)
(2024-11-26)


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

* Add tags data source
([#3211](#3211))
([8907d9d](8907d9d))
* Tag resource v1
([#3197](#3197))
([77b3bf0](77b3bf0))
* Tasks v1 readiness
([#3222](#3222))
([e2284d9](e2284d9))


### 🔧 **Misc**

* Add support for usage tracking to data sources
([#3224](#3224))
([8210bb8](8210bb8))
* Add usage tracking for the rest of the resources and fix views
([#3223](#3223))
([231f653](231f653))
* Basic object tracking
([#3205](#3205))
([1f0dc94](1f0dc94))
* basic object tracking part 2
([#3214](#3214))
([e44f2e1](e44f2e1))
* Improve tags integration tests
([#3193](#3193))
([7736e0a](7736e0a))
* parser and secret tests
([#3192](#3192))
([5ec9c86](5ec9c86))
* Storage integration with custom protocol
([#3213](#3213))
([a3a44ae](a3a44ae))
* Unskip auth config tests
([#3180](#3180))
([46ab142](46ab142))


### 🐛 **Bug fixes:**

* Small fixes and adjustments
([#3226](#3226))
([9f67457](9f67457))

---
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