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

feat: Add secret to sdk #3091

Merged
merged 35 commits into from
Oct 1, 2024
Merged

feat: Add secret to sdk #3091

merged 35 commits into from
Oct 1, 2024

Conversation

sfc-gh-fbudzynski
Copy link
Collaborator

@sfc-gh-fbudzynski sfc-gh-fbudzynski commented Sep 19, 2024

Changes

  • Changed name of Secret struct in common_types.go due to naming clash
  • Added Secret Object to SDK
  • Unit and integration tests

References

Copy link

Integration tests failure for 01a70062a3b2aed8351229d43d94e520ec3c1e05

Copy link

Integration tests failure for 929c810a42e5eade5724b107bb10432ed35e376b

Copy link

Integration tests failure for 8c5dcfb3ad8ad5d7394d32c8c8f6896697c5e498

pkg/acceptance/helpers/secret_client.go Outdated Show resolved Hide resolved
pkg/sdk/secrets_def.go Outdated Show resolved Hide resolved
pkg/sdk/secrets_def.go Outdated Show resolved Hide resolved
pkg/sdk/secrets_def.go Outdated Show resolved Hide resolved
pkg/sdk/secrets_def.go Outdated Show resolved Hide resolved
pkg/sdk/testint/secrets_gen_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/testint/secrets_gen_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/testint/secrets_gen_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/testint/secrets_gen_integration_test.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@sfc-gh-jmichalak sfc-gh-jmichalak left a comment

Choose a reason for hiding this comment

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

Overall a good first PR 👍

pkg/acceptance/helpers/secret_client.go Outdated Show resolved Hide resolved
pkg/acceptance/helpers/secret_client.go Outdated Show resolved Hide resolved
pkg/sdk/secrets_def.go Outdated Show resolved Hide resolved
pkg/sdk/secrets_def.go Outdated Show resolved Hide resolved
pkg/sdk/secrets_def.go Outdated Show resolved Hide resolved
pkg/sdk/testint/secrets_gen_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/secrets_gen.go Outdated Show resolved Hide resolved
Copy link

Integration tests failure for 4ccc4e7c6e391151251af148c4f0d03d559d2344

pkg/sdk/secrets_gen_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/secrets_validations_gen.go Outdated Show resolved Hide resolved
pkg/sdk/testint/secrets_gen_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/testint/secrets_gen_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/testint/secrets_gen_integration_test.go Outdated Show resolved Hide resolved
Copy link

Integration tests failure for bdf2585574da6c6a5f77546015d0d107907aae1b

Copy link

Integration tests failure for 7791f33dae8de262967283156065ac9cee49972e

Copy link

Integration tests failure for 0e181360fceab0b55bdadc37a4822102200908d4

Copy link

Integration tests failure for a18b8f59fb9a22f523103e577aefe35cddf90835

sfc-gh-jcieslak
sfc-gh-jcieslak previously approved these changes Oct 1, 2024
# Conflicts:
#	pkg/acceptance/bettertestspoc/assert/objectassert/gen/sdk_object_def.go
Copy link

github-actions bot commented Oct 1, 2024

Integration tests failure for 22e809e0ae065fd1a4c644467cad5d6989d683c9

@sfc-gh-fbudzynski sfc-gh-fbudzynski merged commit 7430aee into main Oct 1, 2024
8 of 9 checks passed
@sfc-gh-fbudzynski sfc-gh-fbudzynski deleted the add-secret-to-sdk branch October 1, 2024 11:10
assertOptsInvalidJoinedErrors(t, opts, errExactlyOneOf("AlterSecretOptions", "Set", "Unset"))
})

t.Run("validation: conflicting fields for [opts.Set.SetForOAuthClientCredentialsFlow opts.Set.SetForOAuthAuthorizationFlow opts.Set.SetForBasicAuthentication opts.Set.SetForGenericString]", func(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit-pick: in such cases we usually have two tests: 1. with no value set 2. with at least two values set


integrationId := testClientHelper().Ids.RandomAccountObjectIdentifier()

// "YYYY-MM-DD" or "YYYY-MM-DD HH-MI-SS" format has to be used, otherwise Snowflake returns error: "Invalid date/time format"
Copy link
Collaborator

Choose a reason for hiding this comment

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

instead of such a comment we can document this as a test (wrong format passed -> error expected)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok, will do the tests for such cases next time, or I will try to add them with the next PRs

)
t.Cleanup(apiIntegrationCleanup)

stringDateToSnowflakeTimeFormat := func(inputLayout, date string) *time.Time {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this method works for our test accounts with location set to "America/Los_Angeles" but will fail if account in any other location is used, right?

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'm not sure, but i think that it would fail. If there is a way to change location of the account then it would be nice to test it and ultimately change the test so it won't depend on account location somehow.

})
})

// regarding the https://docs.snowflake.com/en/sql-reference/sql/create-secret secret with empty oauth_scopes list should inherit scopes from security_integration, but it does not
Copy link
Collaborator

Choose a reason for hiding this comment

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

here and in the previous test - if it does not, then it is a SNowflake problem that should be revisited in the future, right? In such cases we should leave a TODO with issue number assigned.

sfc-gh-jcieslak pushed a commit that referenced this pull request Oct 11, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.97.0](v0.96.0...v0.97.0)
(2024-10-10)


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

* Add secret to sdk
([#3091](#3091))
([7430aee](7430aee))
* Add service user and legacy service user resources
([#3119](#3119))
([0e88e08](0e88e08))
* Handle all Task parameters in SDK
([#3103](#3103))
([08ae072](08ae072))
* Stream on external table resource
([#3122](#3122))
([d837341](d837341))
* Stream on table resource
([#3109](#3109))
([97fa9b4](97fa9b4))
* Tasks v1 readiness - SDK part
([#3086](#3086))
([0a77383](0a77383))
* Upgrade stream sdk
([#3105](#3105))
([ad5fa11](ad5fa11))


### 🔧 **Misc**

* Add pre check to each datasource
([#3065](#3065))
([560ab6b](560ab6b))
* Bump golang-ci lint to 1.61
([#3112](#3112))
([f23e085](f23e085))
* Secret Validation change
([#3111](#3111))
([666630e](666630e))


### 🐛 **Bug fixes:**

* Fix parsing text in view, check parenthesis in
ParseSchemaObjectIdentifierWithArguments
([#3102](#3102))
([b0a67e6](b0a67e6))
* Try to reproduce 2679 and 3117
([#3124](#3124))
([ccdbc30](ccdbc30))

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

4 participants