Skip to content

Commit 41672f9

Browse files
trentrosenbaumburythehammer
authored andcommitted
Refined the QPF range to be 2x - 8x to match swagger api response
1 parent a3b98e6 commit 41672f9

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

provider/resource_rediscloud_pro_database.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,13 @@ func resourceRedisCloudProDatabase() *schema.Resource {
224224
ForceNew: true,
225225
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
226226
v := val.(string)
227-
matched, err := regexp.MatchString(`^(2|4|6|8|10|12|14|16)x$`, v)
227+
matched, err := regexp.MatchString(`^([2468])x$`, v)
228228
if err != nil {
229229
errs = append(errs, fmt.Errorf("regex match failed: %s", err))
230230
return
231231
}
232232
if !matched {
233-
errs = append(errs, fmt.Errorf("%q must be an even value between 2x and 16x (inclusive), got: %s", key, v))
233+
errs = append(errs, fmt.Errorf("%q must be an even value between 2x and 8x (inclusive), got: %s", key, v))
234234
}
235235
return
236236
},

provider/resource_rediscloud_pro_database_qpf_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func TestAccResourceRedisCloudProDatabase_invalidQueryPerformanceFactors(t *test
169169

170170
config := formatDatabaseConfig(name, testCloudAccountName, password, "5x", `modules = [{ name = "RediSearch" }]`)
171171

172-
testSubErrorCase(t, config, regexp.MustCompile(`"creation_plan\.0\.query_performance_factor" must be an even value between 2x and 16x \(inclusive\), got: 5x`))
172+
testSubErrorCase(t, config, regexp.MustCompile(`"creation_plan\.0\.query_performance_factor" must be an even value between 2x and 8x \(inclusive\), got: 5x`))
173173
}
174174

175175
func TestAccResourceRedisCloudProDatabase_invalidQueryPerformanceFactors_outOfRange(t *testing.T) {
@@ -179,5 +179,5 @@ func TestAccResourceRedisCloudProDatabase_invalidQueryPerformanceFactors_outOfRa
179179

180180
config := formatDatabaseConfig(name, testCloudAccountName, password, "30x", `modules = [{ name = "RediSearch" }]`)
181181

182-
testSubErrorCase(t, config, regexp.MustCompile(`"creation_plan\.0\.query_performance_factor" must be an even value between 2x and 16x \(inclusive\), got: 30x`))
182+
testSubErrorCase(t, config, regexp.MustCompile(`"creation_plan\.0\.query_performance_factor" must be an even value between 2x and 8x \(inclusive\), got: 30x`))
183183
}

provider/resource_rediscloud_pro_subscription.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,13 @@ func resourceRedisCloudProSubscription() *schema.Resource {
296296
Computed: true,
297297
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
298298
v := val.(string)
299-
matched, err := regexp.MatchString(`^(2|4|6|8|10|12|14|16)x$`, v)
299+
matched, err := regexp.MatchString(`^([2468])x$`, v)
300300
if err != nil {
301301
errs = append(errs, fmt.Errorf("regex match failed: %s", err))
302302
return
303303
}
304304
if !matched {
305-
errs = append(errs, fmt.Errorf("%q must be an even value between 2x and 16x (inclusive), got: %s", key, v))
305+
errs = append(errs, fmt.Errorf("%q must be an even value between 2x and 8x (inclusive), got: %s", key, v))
306306
}
307307
return
308308
},

provider/resource_rediscloud_pro_subscription_qpf_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func TestAccResourceRedisCloudProSubscription_invalidQueryPerformanceFactors(t *
135135

136136
config := formatDatabaseConfig(name, testCloudAccountName, password, "5x", `modules = [{ name = "RediSearch" }]`)
137137

138-
testSubErrorCase(t, config, regexp.MustCompile(`"creation_plan\.0\.query_performance_factor" must be an even value between 2x and 16x \(inclusive\), got: 5x`))
138+
testSubErrorCase(t, config, regexp.MustCompile(`"creation_plan\.0\.query_performance_factor" must be an even value between 2x and 8x \(inclusive\), got: 5x`))
139139
}
140140

141141
func TestAccResourceRedisCloudProSubscription_invalidQueryPerformanceFactors_outOfRange(t *testing.T) {
@@ -145,5 +145,5 @@ func TestAccResourceRedisCloudProSubscription_invalidQueryPerformanceFactors_out
145145

146146
config := formatDatabaseConfig(name, testCloudAccountName, password, "30x", `modules = [{ name = "RediSearch" }]`)
147147

148-
testSubErrorCase(t, config, regexp.MustCompile(`"creation_plan\.0\.query_performance_factor" must be an even value between 2x and 16x \(inclusive\), got: 30x`))
148+
testSubErrorCase(t, config, regexp.MustCompile(`"creation_plan\.0\.query_performance_factor" must be an even value between 2x and 8x \(inclusive\), got: 30x`))
149149
}

0 commit comments

Comments
 (0)