Skip to content

Commit

Permalink
Fix accepteance tests (#388)
Browse files Browse the repository at this point in the history
- Update database resource Redis tests with new default value for Redis
settings;
- Remove redundant check in OpenSearch resource (reported by
`staticcheck`);
- Update instance template used by instance pool resource test.
  • Loading branch information
kobajagi authored Sep 23, 2024
1 parent 89a46e1 commit 7d33569
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ IMPROVEMENTS:

- go.mk: upgrade to v2.0.3 #383

BUG FIXES:

- Fix tests for database redis resource #388

## 0.60.0

FEATURES:
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/database/resource_opensearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ func (r *Resource) updateOpensearch(ctx context.Context, stateData *ResourceMode
updated = true
}

if planData.Opensearch.IndexPatterns != nil && len(planData.Opensearch.IndexPatterns) > 0 {
if len(planData.Opensearch.IndexPatterns) > 0 {
patterns := []struct {
MaxIndexCount *int64 `json:"max-index-count,omitempty"`
Pattern *string `json:"pattern,omitempty"`
Expand Down
5 changes: 2 additions & 3 deletions pkg/resources/database/resource_redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func testResourceRedis(t *testing.T) {
dataCreate.MaintenanceDow = "monday"
dataCreate.MaintenanceTime = "01:23:00"
dataCreate.IpFilter = []string{"1.2.3.4/32"}
dataCreate.RedisSettings = strconv.Quote(`{"lfu_decay_time":1,"lfu_log_factor":10,"maxmemory_policy":"noeviction","notify_keyspace_events":"","persistence":"rdb","ssl":true,"timeout":300}`)
dataCreate.RedisSettings = strconv.Quote(`{"io_threads":1,"lfu_decay_time":1,"lfu_log_factor":10,"maxmemory_policy":"noeviction","notify_keyspace_events":"","persistence":"rdb","ssl":true,"timeout":300}`)
buf := &bytes.Buffer{}
err = tpl.Execute(buf, &dataCreate)
if err != nil {
Expand All @@ -68,8 +68,7 @@ func testResourceRedis(t *testing.T) {
dataUpdate.MaintenanceDow = "tuesday"
dataUpdate.MaintenanceTime = "02:34:00"
dataUpdate.IpFilter = nil
dataUpdate.RedisSettings = strconv.Quote(`{"long_query_time":5,"sql_mode":"ANSI,TRADITIONAL","sql_require_primary_key":true}`)
dataUpdate.RedisSettings = strconv.Quote(`{"lfu_decay_time":1,"lfu_log_factor":10,"maxmemory_policy":"noeviction","notify_keyspace_events":"","persistence":"rdb","pubsub_client_output_buffer_limit":64,"ssl":true,"timeout":300}`)
dataUpdate.RedisSettings = strconv.Quote(`{"io_threads":1,"lfu_decay_time":1,"lfu_log_factor":10,"maxmemory_policy":"noeviction","notify_keyspace_events":"","persistence":"rdb","pubsub_client_output_buffer_limit":64,"ssl":true,"timeout":300}`)
buf = &bytes.Buffer{}
err = tpl.Execute(buf, &dataUpdate)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/instance_pool/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ locals {
data "exoscale_template" "debian" {
zone = local.zone
name = "Linux Debian 10 (Buster) 64-bit"
name = "Linux Debian 12 (Bookworm) 64-bit"
}
resource "exoscale_private_network" "test" {
Expand Down

0 comments on commit 7d33569

Please sign in to comment.