diff --git a/docs/resources/account_parameter.md b/docs/resources/account_parameter.md index 99e6f3d7de..c5fee04863 100644 --- a/docs/resources/account_parameter.md +++ b/docs/resources/account_parameter.md @@ -34,7 +34,7 @@ resource "snowflake_account_parameter" "p2" { ### Required -- `key` (String) Name of account parameter. Valid values are (case-insensitive): `ALLOW_CLIENT_MFA_CACHING` | `ALLOW_ID_TOKEN` | `CLIENT_ENCRYPTION_KEY_SIZE` | `CORTEX_ENABLED_CROSS_REGION` | `ENABLE_IDENTIFIER_FIRST_LOGIN` | `ENABLE_INTERNAL_STAGES_PRIVATELINK` | `ENABLE_TRI_SECRET_AND_REKEY_OPT_OUT_FOR_IMAGE_REPOSITORY` | `ENABLE_TRI_SECRET_AND_REKEY_OPT_OUT_FOR_SPCS_BLOCK_STORAGE` | `ENABLE_UNHANDLED_EXCEPTIONS_REPORTING` | `ENFORCE_NETWORK_RULES_FOR_INTERNAL_STAGES` | `EVENT_TABLE` | `EXTERNAL_OAUTH_ADD_PRIVILEGED_ROLES_TO_BLOCKED_LIST` | `INITIAL_REPLICATION_SIZE_LIMIT_IN_TB` | `MIN_DATA_RETENTION_TIME_IN_DAYS` | `NETWORK_POLICY` | `OAUTH_ADD_PRIVILEGED_ROLES_TO_BLOCKED_LIST` | `PERIODIC_DATA_REKEYING` | `PREVENT_LOAD_FROM_INLINE_URL` | `PREVENT_UNLOAD_TO_INLINE_URL` | `REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_CREATION` | `REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_OPERATION` | `SSO_LOGIN_PAGE` | `ABORT_DETACHED_QUERY` | `AUTOCOMMIT` | `BINARY_INPUT_FORMAT` | `BINARY_OUTPUT_FORMAT` | `CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS` | `CLIENT_MEMORY_LIMIT` | `CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX` | `CLIENT_METADATA_USE_SESSION_DATABASE` | `CLIENT_PREFETCH_THREADS` | `CLIENT_RESULT_CHUNK_SIZE` | `CLIENT_SESSION_KEEP_ALIVE` | `CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY` | `CLIENT_TIMESTAMP_TYPE_MAPPING` | `ENABLE_UNLOAD_PHYSICAL_TYPE_OPTIMIZATION` | `CLIENT_RESULT_COLUMN_CASE_INSENSITIVE` | `DATE_INPUT_FORMAT` | `DATE_OUTPUT_FORMAT` | `ERROR_ON_NONDETERMINISTIC_MERGE` | `ERROR_ON_NONDETERMINISTIC_UPDATE` | `GEOGRAPHY_OUTPUT_FORMAT` | `GEOMETRY_OUTPUT_FORMAT` | `HYBRID_TABLE_LOCK_TIMEOUT` | `JDBC_TREAT_DECIMAL_AS_INT` | `JDBC_TREAT_TIMESTAMP_NTZ_AS_UTC` | `JDBC_USE_SESSION_TIMEZONE` | `JSON_INDENT` | `JS_TREAT_INTEGER_AS_BIGINT` | `LOCK_TIMEOUT` | `MULTI_STATEMENT_COUNT` | `NOORDER_SEQUENCE_AS_DEFAULT` | `ODBC_TREAT_DECIMAL_AS_INT` | `QUERY_TAG` | `QUOTED_IDENTIFIERS_IGNORE_CASE` | `ROWS_PER_RESULTSET` | `S3_STAGE_VPCE_DNS_NAME` | `SEARCH_PATH` | `SIMULATED_DATA_SHARING_CONSUMER` | `STATEMENT_TIMEOUT_IN_SECONDS` | `STRICT_JSON_OUTPUT` | `TIME_INPUT_FORMAT` | `TIME_OUTPUT_FORMAT` | `TIMESTAMP_DAY_IS_ALWAYS_24H` | `TIMESTAMP_INPUT_FORMAT` | `TIMESTAMP_LTZ_OUTPUT_FORMAT` | `TIMESTAMP_NTZ_OUTPUT_FORMAT` | `TIMESTAMP_OUTPUT_FORMAT` | `TIMESTAMP_TYPE_MAPPING` | `TIMESTAMP_TZ_OUTPUT_FORMAT` | `TIMEZONE` | `TRANSACTION_ABORT_ON_ERROR` | `TRANSACTION_DEFAULT_ISOLATION_LEVEL` | `TWO_DIGIT_CENTURY_START` | `UNSUPPORTED_DDL_ACTION` | `USE_CACHED_RESULT` | `WEEK_OF_YEAR_POLICY` | `WEEK_START` | `CATALOG` | `DATA_RETENTION_TIME_IN_DAYS` | `DEFAULT_DDL_COLLATION` | `EXTERNAL_VOLUME` | `LOG_LEVEL` | `MAX_CONCURRENCY_LEVEL` | `MAX_DATA_EXTENSION_TIME_IN_DAYS` | `PIPE_EXECUTION_PAUSED` | `PREVENT_UNLOAD_TO_INTERNAL_STAGES` | `REPLACE_INVALID_CHARACTERS` | `STATEMENT_QUEUED_TIMEOUT_IN_SECONDS` | `STORAGE_SERIALIZATION_POLICY` | `SHARE_RESTRICTIONS` | `SUSPEND_TASK_AFTER_NUM_FAILURES` | `TRACE_LEVEL` | `USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE` | `USER_TASK_TIMEOUT_MS` | `TASK_AUTO_RETRY_ATTEMPTS` | `USER_TASK_MINIMUM_TRIGGER_INTERVAL_IN_SECONDS` | `METRIC_LEVEL` | `ENABLE_CONSOLE_OUTPUT` | `ENABLE_UNREDACTED_QUERY_SYNTAX_ERROR` | `ENABLE_PERSONAL_DATABASE`. +- `key` (String) Name of account parameter. Valid values are (case-insensitive): `ALLOW_CLIENT_MFA_CACHING` | `ALLOW_ID_TOKEN` | `CLIENT_ENCRYPTION_KEY_SIZE` | `CORTEX_ENABLED_CROSS_REGION` | `ENABLE_IDENTIFIER_FIRST_LOGIN` | `ENABLE_INTERNAL_STAGES_PRIVATELINK` | `ENABLE_TRI_SECRET_AND_REKEY_OPT_OUT_FOR_IMAGE_REPOSITORY` | `ENABLE_TRI_SECRET_AND_REKEY_OPT_OUT_FOR_SPCS_BLOCK_STORAGE` | `ENABLE_UNHANDLED_EXCEPTIONS_REPORTING` | `ENFORCE_NETWORK_RULES_FOR_INTERNAL_STAGES` | `EVENT_TABLE` | `EXTERNAL_OAUTH_ADD_PRIVILEGED_ROLES_TO_BLOCKED_LIST` | `INITIAL_REPLICATION_SIZE_LIMIT_IN_TB` | `MIN_DATA_RETENTION_TIME_IN_DAYS` | `NETWORK_POLICY` | `OAUTH_ADD_PRIVILEGED_ROLES_TO_BLOCKED_LIST` | `PERIODIC_DATA_REKEYING` | `PREVENT_LOAD_FROM_INLINE_URL` | `PREVENT_UNLOAD_TO_INLINE_URL` | `REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_CREATION` | `REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_OPERATION` | `SSO_LOGIN_PAGE` | `ABORT_DETACHED_QUERY` | `ACTIVE_PYTHON_PROFILER` | `AUTOCOMMIT` | `BINARY_INPUT_FORMAT` | `BINARY_OUTPUT_FORMAT` | `CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS` | `CLIENT_MEMORY_LIMIT` | `CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX` | `CLIENT_METADATA_USE_SESSION_DATABASE` | `CLIENT_PREFETCH_THREADS` | `CLIENT_RESULT_CHUNK_SIZE` | `CLIENT_SESSION_KEEP_ALIVE` | `CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY` | `CLIENT_TIMESTAMP_TYPE_MAPPING` | `ENABLE_UNLOAD_PHYSICAL_TYPE_OPTIMIZATION` | `CLIENT_RESULT_COLUMN_CASE_INSENSITIVE` | `CSV_TIMESTAMP_FORMAT` | `DATE_INPUT_FORMAT` | `DATE_OUTPUT_FORMAT` | `ERROR_ON_NONDETERMINISTIC_MERGE` | `ERROR_ON_NONDETERMINISTIC_UPDATE` | `GEOGRAPHY_OUTPUT_FORMAT` | `GEOMETRY_OUTPUT_FORMAT` | `HYBRID_TABLE_LOCK_TIMEOUT` | `JDBC_TREAT_DECIMAL_AS_INT` | `JDBC_TREAT_TIMESTAMP_NTZ_AS_UTC` | `JDBC_USE_SESSION_TIMEZONE` | `JSON_INDENT` | `JS_TREAT_INTEGER_AS_BIGINT` | `LOCK_TIMEOUT` | `MULTI_STATEMENT_COUNT` | `NOORDER_SEQUENCE_AS_DEFAULT` | `ODBC_TREAT_DECIMAL_AS_INT` | `PYTHON_PROFILER_MODULES` | `PYTHON_PROFILER_TARGET_STAGE` | `QUERY_TAG` | `QUOTED_IDENTIFIERS_IGNORE_CASE` | `ROWS_PER_RESULTSET` | `S3_STAGE_VPCE_DNS_NAME` | `SEARCH_PATH` | `SIMULATED_DATA_SHARING_CONSUMER` | `STATEMENT_TIMEOUT_IN_SECONDS` | `STRICT_JSON_OUTPUT` | `TIME_INPUT_FORMAT` | `TIME_OUTPUT_FORMAT` | `TIMESTAMP_DAY_IS_ALWAYS_24H` | `TIMESTAMP_INPUT_FORMAT` | `TIMESTAMP_LTZ_OUTPUT_FORMAT` | `TIMESTAMP_NTZ_OUTPUT_FORMAT` | `TIMESTAMP_OUTPUT_FORMAT` | `TIMESTAMP_TYPE_MAPPING` | `TIMESTAMP_TZ_OUTPUT_FORMAT` | `TIMEZONE` | `TRANSACTION_ABORT_ON_ERROR` | `TRANSACTION_DEFAULT_ISOLATION_LEVEL` | `TWO_DIGIT_CENTURY_START` | `UNSUPPORTED_DDL_ACTION` | `USE_CACHED_RESULT` | `WEEK_OF_YEAR_POLICY` | `WEEK_START` | `CATALOG` | `DATA_RETENTION_TIME_IN_DAYS` | `DEFAULT_DDL_COLLATION` | `EXTERNAL_VOLUME` | `LOG_LEVEL` | `MAX_CONCURRENCY_LEVEL` | `MAX_DATA_EXTENSION_TIME_IN_DAYS` | `PIPE_EXECUTION_PAUSED` | `PREVENT_UNLOAD_TO_INTERNAL_STAGES` | `REPLACE_INVALID_CHARACTERS` | `STATEMENT_QUEUED_TIMEOUT_IN_SECONDS` | `STORAGE_SERIALIZATION_POLICY` | `SHARE_RESTRICTIONS` | `SUSPEND_TASK_AFTER_NUM_FAILURES` | `TRACE_LEVEL` | `USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE` | `USER_TASK_TIMEOUT_MS` | `TASK_AUTO_RETRY_ATTEMPTS` | `USER_TASK_MINIMUM_TRIGGER_INTERVAL_IN_SECONDS` | `METRIC_LEVEL` | `ENABLE_CONSOLE_OUTPUT` | `ENABLE_UNREDACTED_QUERY_SYNTAX_ERROR` | `ENABLE_PERSONAL_DATABASE`. Deprecated parameters are not supported in the provider. - `value` (String) Value of account parameter, as a string. Constraints are the same as those for the parameters in Snowflake documentation. The parameter values are validated in Snowflake. ### Read-Only diff --git a/pkg/resources/account_parameter_acceptance_test.go b/pkg/resources/account_parameter_acceptance_test.go index 796a994eb7..f2b080eb46 100644 --- a/pkg/resources/account_parameter_acceptance_test.go +++ b/pkg/resources/account_parameter_acceptance_test.go @@ -152,4 +152,25 @@ func TestAcc_AccountParameter_ENFORCE_NETWORK_RULES_FOR_INTERNAL_STAGES(t *testi }) } -// TODO(next pr): add more acc tests for the remaining parameters +func TestAcc_AccountParameter_INITIAL_REPLICATION_SIZE_LIMIT_IN_TB(t *testing.T) { + model := model.AccountParameter("test", string(sdk.AccountParameterInitialReplicationSizeLimitInTB), "3.0") + resource.Test(t, resource.TestCase{ + ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories, + PreCheck: func() { acc.TestAccPreCheck(t) }, + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.RequireAbove(tfversion.Version1_5_0), + }, + CheckDestroy: acc.CheckAccountParameterUnset(t, sdk.AccountParameterInitialReplicationSizeLimitInTB), + Steps: []resource.TestStep{ + { + Config: config.FromModel(t, model), + Check: assert.AssertThat(t, resourceassert.AccountParameterResource(t, model.ResourceReference()). + HasKeyString(string(sdk.AccountParameterInitialReplicationSizeLimitInTB)). + HasValueString("3.0"), + ), + }, + }, + }) +} + +// TODO(SNOW-1866453): add more acc tests for the remaining parameters diff --git a/pkg/sdk/parameters.go b/pkg/sdk/parameters.go index 1971b7623a..fb65e84eef 100644 --- a/pkg/sdk/parameters.go +++ b/pkg/sdk/parameters.go @@ -125,12 +125,7 @@ func (parameters *parameters) SetAccountParameter(ctx context.Context, parameter } opts.Set.Parameters.AccountParameters.ExternalOAuthAddPrivilegedRolesToBlockedList = b case AccountParameterInitialReplicationSizeLimitInTB: - v, err := strconv.ParseFloat(value, 64) - if err != nil { - return fmt.Errorf("INITIAL_REPLICATION_SIZE_LIMIT_IN_TB session parameter is an integer, got %v", value) - } - opts.Set.Parameters.AccountParameters.InitialReplicationSizeLimitInTB = Pointer(v) - + opts.Set.Parameters.AccountParameters.InitialReplicationSizeLimitInTB = &value case AccountParameterMinDataRetentionTimeInDays: v, err := strconv.Atoi(value) if err != nil { @@ -196,7 +191,7 @@ func (parameters *parameters) SetAccountParameter(ctx context.Context, parameter return nil } -// TODO(next pr): add integration tests +// TODO(SNOW-1866453): add integration tests func (parameters *parameters) UnsetAccountParameter(ctx context.Context, parameter AccountParameter) error { opts := AlterAccountOptions{ Unset: &AccountUnset{ @@ -506,7 +501,6 @@ type AccountParameter string // Account Parameters include Session Parameters, Object Parameters and User Parameters const ( // Account Parameters - AccountParameterAllowClientMFACaching AccountParameter = "ALLOW_CLIENT_MFA_CACHING" AccountParameterAllowIDToken AccountParameter = "ALLOW_ID_TOKEN" // #nosec G101 AccountParameterClientEncryptionKeySize AccountParameter = "CLIENT_ENCRYPTION_KEY_SIZE" @@ -1181,31 +1175,33 @@ var AllProcedureParameters = []ProcedureParameter{ // AccountParameters is based on https://docs.snowflake.com/en/sql-reference/parameters#account-parameters. type AccountParameters struct { // Account Parameters - AllowClientMFACaching *bool `ddl:"parameter" sql:"ALLOW_CLIENT_MFA_CACHING"` - AllowIDToken *bool `ddl:"parameter" sql:"ALLOW_ID_TOKEN"` - ClientEncryptionKeySize *int `ddl:"parameter" sql:"CLIENT_ENCRYPTION_KEY_SIZE"` - CortexEnabledCrossRegion *string `ddl:"parameter,single_quotes" sql:"CORTEX_ENABLED_CROSS_REGION"` - EnableIdentifierFirstLogin *bool `ddl:"parameter" sql:"ENABLE_IDENTIFIER_FIRST_LOGIN"` - EnableInternalStagesPrivatelink *bool `ddl:"parameter" sql:"ENABLE_INTERNAL_STAGES_PRIVATELINK"` - EnablePersonalDatabase *bool `ddl:"parameter" sql:"ENABLE_PERSONAL_DATABASE"` - EnableUnredactedQuerySyntaxError *bool `ddl:"parameter" sql:"ENABLE_UNREDACTED_QUERY_SYNTAX_ERROR"` - EnableTriSecretAndRekeyOptOutForImageRepository *bool `ddl:"parameter" sql:"ENABLE_TRI_SECRET_AND_REKEY_OPT_OUT_FOR_IMAGE_REPOSITORY"` - EnableTriSecretAndRekeyOptOutForSpcsBlockStorage *bool `ddl:"parameter" sql:"ENABLE_TRI_SECRET_AND_REKEY_OPT_OUT_FOR_SPCS_BLOCK_STORAGE"` - EnableUnhandledExceptionsReporting *bool `ddl:"parameter" sql:"ENABLE_UNHANDLED_EXCEPTIONS_REPORTING"` - EnforceNetworkRulesForInternalStages *bool `ddl:"keyword" sql:"ENFORCE_NETWORK_RULES_FOR_INTERNAL_STAGES"` - EventTable *string `ddl:"parameter,single_quotes" sql:"EVENT_TABLE"` - ExternalOAuthAddPrivilegedRolesToBlockedList *bool `ddl:"parameter" sql:"EXTERNAL_OAUTH_ADD_PRIVILEGED_ROLES_TO_BLOCKED_LIST"` - InitialReplicationSizeLimitInTB *float64 `ddl:"parameter" sql:"INITIAL_REPLICATION_SIZE_LIMIT_IN_TB"` - MinDataRetentionTimeInDays *int `ddl:"parameter" sql:"MIN_DATA_RETENTION_TIME_IN_DAYS"` - NetworkPolicy *string `ddl:"parameter,single_quotes" sql:"NETWORK_POLICY"` - OAuthAddPrivilegedRolesToBlockedList *bool `ddl:"parameter" sql:"OAUTH_ADD_PRIVILEGED_ROLES_TO_BLOCKED_LIST"` - PeriodicDataRekeying *bool `ddl:"parameter" sql:"PERIODIC_DATA_REKEYING"` - PreventLoadFromInlineURL *bool `ddl:"parameter" sql:"PREVENT_LOAD_FROM_INLINE_URL"` - PreventUnloadToInlineURL *bool `ddl:"parameter" sql:"PREVENT_UNLOAD_TO_INLINE_URL"` - PreventUnloadToInternalStages *bool `ddl:"parameter" sql:"PREVENT_UNLOAD_TO_INTERNAL_STAGES"` - RequireStorageIntegrationForStageCreation *bool `ddl:"parameter" sql:"REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_CREATION"` - RequireStorageIntegrationForStageOperation *bool `ddl:"parameter" sql:"REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_OPERATION"` - SSOLoginPage *bool `ddl:"parameter" sql:"SSO_LOGIN_PAGE"` + AllowClientMFACaching *bool `ddl:"parameter" sql:"ALLOW_CLIENT_MFA_CACHING"` + AllowIDToken *bool `ddl:"parameter" sql:"ALLOW_ID_TOKEN"` + ClientEncryptionKeySize *int `ddl:"parameter" sql:"CLIENT_ENCRYPTION_KEY_SIZE"` + CortexEnabledCrossRegion *string `ddl:"parameter,single_quotes" sql:"CORTEX_ENABLED_CROSS_REGION"` + EnableIdentifierFirstLogin *bool `ddl:"parameter" sql:"ENABLE_IDENTIFIER_FIRST_LOGIN"` + EnableInternalStagesPrivatelink *bool `ddl:"parameter" sql:"ENABLE_INTERNAL_STAGES_PRIVATELINK"` + EnablePersonalDatabase *bool `ddl:"parameter" sql:"ENABLE_PERSONAL_DATABASE"` + EnableUnredactedQuerySyntaxError *bool `ddl:"parameter" sql:"ENABLE_UNREDACTED_QUERY_SYNTAX_ERROR"` + EnableTriSecretAndRekeyOptOutForImageRepository *bool `ddl:"parameter" sql:"ENABLE_TRI_SECRET_AND_REKEY_OPT_OUT_FOR_IMAGE_REPOSITORY"` + EnableTriSecretAndRekeyOptOutForSpcsBlockStorage *bool `ddl:"parameter" sql:"ENABLE_TRI_SECRET_AND_REKEY_OPT_OUT_FOR_SPCS_BLOCK_STORAGE"` + EnableUnhandledExceptionsReporting *bool `ddl:"parameter" sql:"ENABLE_UNHANDLED_EXCEPTIONS_REPORTING"` + EnforceNetworkRulesForInternalStages *bool `ddl:"keyword" sql:"ENFORCE_NETWORK_RULES_FOR_INTERNAL_STAGES"` + EventTable *string `ddl:"parameter,single_quotes" sql:"EVENT_TABLE"` + ExternalOAuthAddPrivilegedRolesToBlockedList *bool `ddl:"parameter" sql:"EXTERNAL_OAUTH_ADD_PRIVILEGED_ROLES_TO_BLOCKED_LIST"` + // InitialReplicationSizeLimitInTB is a string because values like 3.0 get rounded to 3, resulting in an error in Snowflake. + // This is still validated below. + InitialReplicationSizeLimitInTB *string `ddl:"parameter" sql:"INITIAL_REPLICATION_SIZE_LIMIT_IN_TB"` + MinDataRetentionTimeInDays *int `ddl:"parameter" sql:"MIN_DATA_RETENTION_TIME_IN_DAYS"` + NetworkPolicy *string `ddl:"parameter,single_quotes" sql:"NETWORK_POLICY"` + OAuthAddPrivilegedRolesToBlockedList *bool `ddl:"parameter" sql:"OAUTH_ADD_PRIVILEGED_ROLES_TO_BLOCKED_LIST"` + PeriodicDataRekeying *bool `ddl:"parameter" sql:"PERIODIC_DATA_REKEYING"` + PreventLoadFromInlineURL *bool `ddl:"parameter" sql:"PREVENT_LOAD_FROM_INLINE_URL"` + PreventUnloadToInlineURL *bool `ddl:"parameter" sql:"PREVENT_UNLOAD_TO_INLINE_URL"` + PreventUnloadToInternalStages *bool `ddl:"parameter" sql:"PREVENT_UNLOAD_TO_INTERNAL_STAGES"` + RequireStorageIntegrationForStageCreation *bool `ddl:"parameter" sql:"REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_CREATION"` + RequireStorageIntegrationForStageOperation *bool `ddl:"parameter" sql:"REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_OPERATION"` + SSOLoginPage *bool `ddl:"parameter" sql:"SSO_LOGIN_PAGE"` } func (v *AccountParameters) validate() error { @@ -1216,10 +1212,11 @@ func (v *AccountParameters) validate() error { } } if valueSet(v.InitialReplicationSizeLimitInTB) { - l := *v.InitialReplicationSizeLimitInTB - if l < 0.0 { - errs = append(errs, fmt.Errorf("InitialReplicationSizeLimitInTB must be 0.0 and above with a scale of at least 1 (e.g. 20.5, 32.25, 33.333, etc.), got %f", l)) + value, err := strconv.ParseFloat(*v.InitialReplicationSizeLimitInTB, 64) + 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) { diff --git a/pkg/sdk/parameters_impl_test.go b/pkg/sdk/parameters_impl_test.go index 3b86f5d2da..b8859154d2 100644 --- a/pkg/sdk/parameters_impl_test.go +++ b/pkg/sdk/parameters_impl_test.go @@ -19,6 +19,7 @@ func TestSessionParameters_setParam(t *testing.T) { {parameter: SessionParameterAutocommit, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.Autocommit }}, {parameter: SessionParameterBinaryInputFormat, value: "some", expectedValue: BinaryInputFormat("some"), accessor: func(sp *SessionParameters) any { return *sp.BinaryInputFormat }}, {parameter: SessionParameterBinaryOutputFormat, value: "some", expectedValue: BinaryOutputFormat("some"), accessor: func(sp *SessionParameters) any { return *sp.BinaryOutputFormat }}, + {parameter: SessionParameterClientEnableLogInfoStatementParameters, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.ClientEnableLogInfoStatementParameters }}, {parameter: SessionParameterClientMemoryLimit, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.ClientMemoryLimit }}, {parameter: SessionParameterClientMetadataRequestUseConnectionCtx, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.ClientMetadataRequestUseConnectionCtx }}, {parameter: SessionParameterClientPrefetchThreads, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.ClientPrefetchThreads }}, @@ -36,10 +37,12 @@ func TestSessionParameters_setParam(t *testing.T) { {parameter: SessionParameterErrorOnNondeterministicUpdate, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.ErrorOnNondeterministicUpdate }}, {parameter: SessionParameterGeographyOutputFormat, value: "some", expectedValue: GeographyOutputFormat("some"), accessor: func(sp *SessionParameters) any { return *sp.GeographyOutputFormat }}, {parameter: SessionParameterGeometryOutputFormat, value: "some", expectedValue: GeometryOutputFormat("some"), accessor: func(sp *SessionParameters) any { return *sp.GeometryOutputFormat }}, + {parameter: SessionParameterHybridTableLockTimeout, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.HybridTableLockTimeout }}, {parameter: SessionParameterJdbcTreatDecimalAsInt, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.JdbcTreatDecimalAsInt }}, {parameter: SessionParameterJdbcTreatTimestampNtzAsUtc, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.JdbcTreatTimestampNtzAsUtc }}, {parameter: SessionParameterJdbcUseSessionTimezone, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.JdbcUseSessionTimezone }}, {parameter: SessionParameterJsonIndent, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.JsonIndent }}, + {parameter: SessionParameterJsTreatIntegerAsBigInt, value: "true", expectedValue: true, accessor: func(sp *SessionParameters) any { return *sp.JsTreatIntegerAsBigInt }}, {parameter: SessionParameterLockTimeout, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.LockTimeout }}, {parameter: SessionParameterLogLevel, value: "some", expectedValue: LogLevel("some"), accessor: func(sp *SessionParameters) any { return *sp.LogLevel }}, {parameter: SessionParameterMultiStatementCount, value: "1", expectedValue: 1, accessor: func(sp *SessionParameters) any { return *sp.MultiStatementCount }}, @@ -91,7 +94,6 @@ func TestSessionParameters_setParam(t *testing.T) { value string }{ {parameter: SessionParameterAbortDetachedQuery, value: "true123"}, - // {parameter: SessionParameterActivePythonProfiler, value: "some"}, // add validation {parameter: SessionParameterAutocommit, value: "true123"}, // {parameter: SessionParameterBinaryInputFormat, value: "some"}, // add validation // {parameter: SessionParameterBinaryOutputFormat, value: "some"}, // add validation diff --git a/pkg/sdk/validations_test.go b/pkg/sdk/validations_test.go index d6f4af90e2..f9661d50aa 100644 --- a/pkg/sdk/validations_test.go +++ b/pkg/sdk/validations_test.go @@ -168,7 +168,7 @@ func TestValueSet(t *testing.T) { }) } -func TestValidateIntInRange(t *testing.T) { +func TestValidateIntInRangeInclusive(t *testing.T) { t.Run("with value in range", func(t *testing.T) { ok := validateIntInRangeInclusive(5, 0, 10) assert.Equal(t, ok, true)