Skip to content

Commit

Permalink
fix max compute size setting
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Kisler <[email protected]>
  • Loading branch information
kislerdm committed Sep 28, 2024
1 parent ef02a01 commit 70e6710
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added support of Postgres 17. See the Neon [announcement](https://neon.tech/blog/postgres-17) and the Postgres
[announcement](https://www.postgresql.org/about/news/postgresql-17-released-2936/).

### Fixed

- Fixed validation of the autoscalling limits. You can now set the maximum compute size up to `10`.

## [v0.6.0] - 2024-09-23

### Added
Expand Down
12 changes: 2 additions & 10 deletions internal/provider/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,12 @@ func validateAutoscallingLimit(val interface{}, name string) (warns []string, er
switch val.(type) {
case float64:
switch v := val.(float64); v {
case 0.25,
0.5,
1.,
2.,
3.,
4.,
5.,
6.,
7.:
case 0.25, 0.5, 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.:
return
}
case int:
switch v := val.(int); v {
case 1, 2, 3, 4, 5, 6, 7:
case 1, 2, 3, 4, 5, 6, 7, 8, 9, 10:
return
}
}
Expand Down
6 changes: 3 additions & 3 deletions internal/provider/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func Test_validateAutoscallingLimit(t *testing.T) {

t.Run(
"happy path: int input", func(t *testing.T) {
input := []int{1, 2, 3, 4, 5, 6, 7}
input := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
for _, in := range input {
_, errs := validateAutoscallingLimit(in, "")
if errs != nil {
Expand All @@ -24,7 +24,7 @@ func Test_validateAutoscallingLimit(t *testing.T) {

t.Run(
"happy path: float64 input", func(t *testing.T) {
input := []float64{0.25, 0.5, 1, 2, 3, 4, 5, 6, 7}
input := []float64{0.25, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
for _, in := range input {
_, errs := validateAutoscallingLimit(in, "")
if errs != nil {
Expand All @@ -36,7 +36,7 @@ func Test_validateAutoscallingLimit(t *testing.T) {

t.Run(
"unhappy path", func(t *testing.T) {
input := []interface{}{"foo", 0, 0.1, 1.5, 10}
input := []interface{}{"foo", 0, 0.1, 1.5, 11, 12, 20}
for _, in := range input {
_, errs := validateAutoscallingLimit(in, "")
if errs == nil {
Expand Down

0 comments on commit 70e6710

Please sign in to comment.