From 96a1f17ce839288566b9c4b58d168e2cfe1fac89 Mon Sep 17 00:00:00 2001 From: Jakub Michalak Date: Fri, 20 Dec 2024 14:57:07 +0100 Subject: [PATCH] fix: Fixes in account parameters (#3310) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 ## Test Plan * [ ] acceptance tests * [ ] … ## References #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) --- pkg/resources/account_parameter_acceptance_test.go | 4 ++-- pkg/sdk/parameters.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/resources/account_parameter_acceptance_test.go b/pkg/resources/account_parameter_acceptance_test.go index 2df5a3a9dc..6ee2edb147 100644 --- a/pkg/resources/account_parameter_acceptance_test.go +++ b/pkg/resources/account_parameter_acceptance_test.go @@ -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"), @@ -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"), diff --git a/pkg/sdk/parameters.go b/pkg/sdk/parameters.go index aea226a018..86551dd14e 100644 --- a/pkg/sdk/parameters.go +++ b/pkg/sdk/parameters.go @@ -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) {