Skip to content

Commit

Permalink
fix: Fixes in account parameters (#3310)
Browse files Browse the repository at this point in the history
<!-- Feel free to delete comments as you fill this in -->
- Add missing parameters based on the docs and output of SHOW PARAMETERS
IN ACCOUNT
- Add missing unit tests and implementations
- Add missing validations
- Relax validations for ints - just validate if they are non-negative
- Update docs
<!-- summary of changes -->

## Test Plan
<!-- detail ways in which this PR has been tested or needs to be tested
-->
* [ ] acceptance tests
<!-- add more below if you think they are relevant -->
* [ ] …

## References
<!-- issues documentation links, etc  -->
#3044
#3116
#3245

## TODO
- Do not add missing user parameters - this will be done in
SNOW-1844996. Here, they are added only to account and session level
- More acceptance and integration tests should be done on a separate
account. This should be done during account resource follow-up
(SNOW-1866453)
  • Loading branch information
sfc-gh-jmichalak authored and sfc-gh-jcieslak committed Jan 20, 2025
1 parent 61ee1bd commit 96a1f17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/resources/account_parameter_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func TestAcc_AccountParameter_ENFORCE_NETWORK_RULES_FOR_INTERNAL_STAGES(t *testi
CheckDestroy: acc.CheckAccountParameterUnset(t, sdk.AccountParameterRequireStorageIntegrationForStageCreation),
Steps: []resource.TestStep{
{
Config: config.FromModels(t, model),
Config: config.FromModel(t, model),
Check: assert.AssertThat(t, resourceassert.AccountParameterResource(t, model.ResourceReference()).
HasKeyString(string(sdk.AccountParameterRequireStorageIntegrationForStageCreation)).
HasValueString("true"),
Expand All @@ -163,7 +163,7 @@ func TestAcc_AccountParameter_INITIAL_REPLICATION_SIZE_LIMIT_IN_TB(t *testing.T)
CheckDestroy: acc.CheckAccountParameterUnset(t, sdk.AccountParameterInitialReplicationSizeLimitInTB),
Steps: []resource.TestStep{
{
Config: config.FromModels(t, model),
Config: config.FromModel(t, model),
Check: assert.AssertThat(t, resourceassert.AccountParameterResource(t, model.ResourceReference()).
HasKeyString(string(sdk.AccountParameterInitialReplicationSizeLimitInTB)).
HasValueString("3.0"),
Expand Down
1 change: 1 addition & 0 deletions pkg/sdk/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,7 @@ func (v *AccountParameters) validate() error {
if err != nil || value < 0 {
return fmt.Errorf("InitialReplicationSizeLimitInTB must be a non-negative float, got %v", *v.InitialReplicationSizeLimitInTB)
}

}
if valueSet(v.MinDataRetentionTimeInDays) {
if !validateIntInRangeInclusive(*v.MinDataRetentionTimeInDays, 0, 90) {
Expand Down

0 comments on commit 96a1f17

Please sign in to comment.