Skip to content

Commit a954eb2

Browse files
Merge pull request #240 from RedisLabs/fix/endpoint-script
Global value fields in API and endpoint scripts fix
2 parents 93a5193 + eff2a2b commit a954eb2

File tree

9 files changed

+360
-26
lines changed

9 files changed

+360
-26
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,3 +277,4 @@ CLAUDE.md
277277
.claude
278278

279279
coverage.out
280+
swagger-redis-api.json

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22
All notable changes to this project will be documented in this file.
33
See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/).
44

5+
## 0.40.0 (31st October 2025)
6+
7+
### Added:
8+
* Added global values fields to `ActiveActiveDatabase` read response: `GlobalDataPersistence`, `GlobalSourceIP`, `GlobalPassword`, `GlobalAlerts`, and `GlobalEnableDefaultUser`
9+
* New `TestAADatabase_Get` test for ActiveActive Get method coverage
10+
* Updated `TestAADatabase_List` test to include global values in response
11+
12+
### Updated:
13+
* Bump golang.org/x/tools to 0.38.0
14+
* Bump github.com/avast/retry-go/v4 to 4.7.0
15+
16+
### Fixed:
17+
* Fixed an issue with endpoint scripts not unmarshalling correctly.
18+
519
## 0.39.0 (21st October 2025)
620

721
### Added:

active_active_database_test.go

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,221 @@ func TestAADatabase_Update(t *testing.T) {
256256
require.NoError(t, err)
257257
}
258258

259+
func TestAADatabase_Get(t *testing.T) {
260+
body := `{
261+
"databaseId": 1466,
262+
"name": "active-active-db",
263+
"redisVersion": "7.2",
264+
"protocol": "redis",
265+
"status": "active",
266+
"memoryStorage": "ram",
267+
"activeActiveRedis": true,
268+
"activatedOn": "2024-05-08T08:10:02Z",
269+
"lastModified": "2024-05-08T08:22:34Z",
270+
"supportOSSClusterApi": false,
271+
"useExternalEndpointForOSSClusterApi": false,
272+
"replication": true,
273+
"dataEvictionPolicy": "noeviction",
274+
"autoMinorVersionUpgrade": true,
275+
"modules": [],
276+
"globalDataPersistence": "aof-every-1-second",
277+
"globalSourceIp": ["192.168.1.0/24"],
278+
"globalPassword": "********",
279+
"globalAlerts": [
280+
{
281+
"name": "throughput-higher-than",
282+
"value": 90
283+
}
284+
],
285+
"globalEnableDefaultUser": false,
286+
"crdbDatabases": [
287+
{
288+
"provider": "AWS",
289+
"region": "us-east-1",
290+
"redisVersionCompliance": "7.2.0",
291+
"publicEndpoint": "redis-14383.mc940-1.us-east-1-mz.ec2.qa-cloud.rlrcp.com:14383",
292+
"privateEndpoint": "redis-14383.internal.mc940-1.us-east-1-mz.ec2.qa-cloud.rlrcp.com:14383",
293+
"memoryLimitInGb": 2,
294+
"datasetSizeInGb": 2,
295+
"memoryUsedInMb": 45.5,
296+
"readOperationsPerSecond": 2000,
297+
"writeOperationsPerSecond": 2000,
298+
"dataPersistence": "aof-every-1-second",
299+
"queryPerformanceFactor": "6x",
300+
"alerts": [
301+
{
302+
"id": "51054122-2",
303+
"name": "dataset-size",
304+
"value": 85,
305+
"defaultValue": 80
306+
}
307+
],
308+
"security": {
309+
"enableDefaultUser": false,
310+
"sslClientAuthentication": false,
311+
"tlsClientAuthentication": true,
312+
"enableTls": true,
313+
"sourceIps": ["10.0.0.0/8"]
314+
},
315+
"backup": {
316+
"enableRemoteBackup": true,
317+
"interval": "every-12-hours",
318+
"timeUTC": "10:00",
319+
"destination": "s3://bucket/path"
320+
}
321+
},
322+
{
323+
"provider": "AWS",
324+
"region": "us-east-2",
325+
"redisVersionCompliance": "7.2.0",
326+
"publicEndpoint": "redis-14383.mc940-0.us-east-2-mz.ec2.qa-cloud.rlrcp.com:14383",
327+
"privateEndpoint": "redis-14383.internal.mc940-0.us-east-2-mz.ec2.qa-cloud.rlrcp.com:14383",
328+
"memoryLimitInGb": 2,
329+
"datasetSizeInGb": 2,
330+
"memoryUsedInMb": 45.3,
331+
"readOperationsPerSecond": 2000,
332+
"writeOperationsPerSecond": 2000,
333+
"dataPersistence": "aof-every-1-second",
334+
"queryPerformanceFactor": "6x",
335+
"alerts": [
336+
{
337+
"id": "51054121-2",
338+
"name": "dataset-size",
339+
"value": 85,
340+
"defaultValue": 80
341+
}
342+
],
343+
"security": {
344+
"enableDefaultUser": false,
345+
"sslClientAuthentication": false,
346+
"tlsClientAuthentication": true,
347+
"enableTls": true,
348+
"sourceIps": ["10.0.0.0/8"]
349+
},
350+
"backup": {
351+
"enableRemoteBackup": true,
352+
"interval": "every-12-hours",
353+
"timeUTC": "10:00",
354+
"destination": "s3://bucket/path"
355+
}
356+
}
357+
]
358+
}`
359+
360+
s := httptest.NewServer(
361+
testServer(
362+
"apiKey",
363+
"secret",
364+
getRequest(t, "/subscriptions/111478/databases/1466", body),
365+
),
366+
)
367+
defer s.Close()
368+
369+
subject, err := clientFromTestServer(s, "apiKey", "secret")
370+
require.NoError(t, err)
371+
372+
actual, err := subject.Database.GetActiveActive(context.TODO(), 111478, 1466)
373+
require.NoError(t, err)
374+
375+
expected := &databases.ActiveActiveDatabase{
376+
ID: redis.Int(1466),
377+
Name: redis.String("active-active-db"),
378+
Protocol: redis.String("redis"),
379+
RedisVersion: redis.String("7.2"),
380+
Status: redis.String("active"),
381+
MemoryStorage: redis.String("ram"),
382+
ActiveActiveRedis: redis.Bool(true),
383+
ActivatedOn: redis.Time(time.Date(2024, 5, 8, 8, 10, 02, 0, time.UTC)),
384+
LastModified: redis.Time(time.Date(2024, 5, 8, 8, 22, 34, 0, time.UTC)),
385+
SupportOSSClusterAPI: redis.Bool(false),
386+
UseExternalEndpointForOSSClusterAPI: redis.Bool(false),
387+
Replication: redis.Bool(true),
388+
DataEvictionPolicy: redis.String("noeviction"),
389+
AutoMinorVersionUpgrade: redis.Bool(true),
390+
Modules: []*databases.Module{},
391+
GlobalDataPersistence: redis.String("aof-every-1-second"),
392+
GlobalSourceIP: redis.StringSlice("192.168.1.0/24"),
393+
GlobalPassword: redis.String("********"),
394+
GlobalAlerts: []*databases.Alert{
395+
{
396+
Name: redis.String("throughput-higher-than"),
397+
Value: redis.Int(90),
398+
},
399+
},
400+
GlobalEnableDefaultUser: redis.Bool(false),
401+
CrdbDatabases: []*databases.CrdbDatabase{
402+
{
403+
Provider: redis.String("AWS"),
404+
Region: redis.String("us-east-1"),
405+
RedisVersionCompliance: redis.String("7.2.0"),
406+
PublicEndpoint: redis.String("redis-14383.mc940-1.us-east-1-mz.ec2.qa-cloud.rlrcp.com:14383"),
407+
PrivateEndpoint: redis.String("redis-14383.internal.mc940-1.us-east-1-mz.ec2.qa-cloud.rlrcp.com:14383"),
408+
MemoryLimitInGB: redis.Float64(2),
409+
DatasetSizeInGB: redis.Float64(2),
410+
MemoryUsedInMB: redis.Float64(45.5),
411+
ReadOperationsPerSecond: redis.Int(2000),
412+
WriteOperationsPerSecond: redis.Int(2000),
413+
DataPersistence: redis.String("aof-every-1-second"),
414+
QueryPerformanceFactor: redis.String("6x"),
415+
Alerts: []*databases.Alert{
416+
{
417+
Name: redis.String("dataset-size"),
418+
Value: redis.Int(85),
419+
},
420+
},
421+
Security: &databases.Security{
422+
EnableDefaultUser: redis.Bool(false),
423+
SSLClientAuthentication: redis.Bool(false),
424+
TLSClientAuthentication: redis.Bool(true),
425+
EnableTls: redis.Bool(true),
426+
SourceIPs: redis.StringSlice("10.0.0.0/8"),
427+
},
428+
Backup: &databases.Backup{
429+
Enabled: redis.Bool(true),
430+
Interval: redis.String("every-12-hours"),
431+
TimeUTC: redis.String("10:00"),
432+
Destination: redis.String("s3://bucket/path"),
433+
},
434+
},
435+
{
436+
Provider: redis.String("AWS"),
437+
Region: redis.String("us-east-2"),
438+
RedisVersionCompliance: redis.String("7.2.0"),
439+
PublicEndpoint: redis.String("redis-14383.mc940-0.us-east-2-mz.ec2.qa-cloud.rlrcp.com:14383"),
440+
PrivateEndpoint: redis.String("redis-14383.internal.mc940-0.us-east-2-mz.ec2.qa-cloud.rlrcp.com:14383"),
441+
MemoryLimitInGB: redis.Float64(2),
442+
DatasetSizeInGB: redis.Float64(2),
443+
MemoryUsedInMB: redis.Float64(45.3),
444+
ReadOperationsPerSecond: redis.Int(2000),
445+
WriteOperationsPerSecond: redis.Int(2000),
446+
DataPersistence: redis.String("aof-every-1-second"),
447+
QueryPerformanceFactor: redis.String("6x"),
448+
Alerts: []*databases.Alert{
449+
{
450+
Name: redis.String("dataset-size"),
451+
Value: redis.Int(85),
452+
},
453+
},
454+
Security: &databases.Security{
455+
EnableDefaultUser: redis.Bool(false),
456+
SSLClientAuthentication: redis.Bool(false),
457+
TLSClientAuthentication: redis.Bool(true),
458+
EnableTls: redis.Bool(true),
459+
SourceIPs: redis.StringSlice("10.0.0.0/8"),
460+
},
461+
Backup: &databases.Backup{
462+
Enabled: redis.Bool(true),
463+
Interval: redis.String("every-12-hours"),
464+
TimeUTC: redis.String("10:00"),
465+
Destination: redis.String("s3://bucket/path"),
466+
},
467+
},
468+
},
469+
}
470+
471+
assert.Equal(t, expected, actual)
472+
}
473+
259474
func TestAADatabase_List(t *testing.T) {
260475
body := `{
261476
"accountId": 69369,
@@ -280,6 +495,15 @@ func TestAADatabase_List(t *testing.T) {
280495
"dataEvictionPolicy": "noeviction",
281496
"autoMinorVersionUpgrade": true,
282497
"modules": [],
498+
"globalDataPersistence": "none",
499+
"globalSourceIp": ["0.0.0.0/0"],
500+
"globalAlerts": [
501+
{
502+
"name": "dataset-size",
503+
"value": 80
504+
}
505+
],
506+
"globalEnableDefaultUser": true,
283507
"crdbDatabases": [
284508
{
285509
"provider": "AWS",
@@ -423,6 +647,15 @@ func TestAADatabase_List(t *testing.T) {
423647
DataEvictionPolicy: redis.String("noeviction"),
424648
AutoMinorVersionUpgrade: redis.Bool(true),
425649
Modules: []*databases.Module{},
650+
GlobalDataPersistence: redis.String("none"),
651+
GlobalSourceIP: redis.StringSlice("0.0.0.0/0"),
652+
GlobalAlerts: []*databases.Alert{
653+
{
654+
Name: redis.String("dataset-size"),
655+
Value: redis.Int(80),
656+
},
657+
},
658+
GlobalEnableDefaultUser: redis.Bool(true),
426659
CrdbDatabases: []*databases.CrdbDatabase{
427660
{
428661
Provider: redis.String("AWS"),

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ go 1.24.0
55
toolchain go1.24.1
66

77
require (
8-
github.com/avast/retry-go/v4 v4.6.0
8+
github.com/avast/retry-go/v4 v4.7.0
99
github.com/stretchr/testify v1.11.1
10-
golang.org/x/tools v0.37.0
10+
golang.org/x/tools v0.38.0
1111
)
1212

1313
require (
1414
github.com/davecgh/go-spew v1.1.1 // indirect
1515
github.com/pmezard/go-difflib v1.0.0 // indirect
1616
github.com/stretchr/objx v0.5.2 // indirect
17-
golang.org/x/mod v0.28.0 // indirect
17+
golang.org/x/mod v0.29.0 // indirect
1818
golang.org/x/sync v0.17.0 // indirect
19-
golang.org/x/sys v0.36.0 // indirect
20-
golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 // indirect
19+
golang.org/x/sys v0.37.0 // indirect
20+
golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8 // indirect
2121
gopkg.in/yaml.v3 v3.0.1 // indirect
2222
)

go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/avast/retry-go/v4 v4.6.0 h1:K9xNA+KeB8HHc2aWFuLb25Offp+0iVRXEvFx8IinRJA=
2-
github.com/avast/retry-go/v4 v4.6.0/go.mod h1:gvWlPhBVsvBbLkVGDg/KwvBv0bEkCOLRRSHKIr2PyOE=
1+
github.com/avast/retry-go/v4 v4.7.0 h1:yjDs35SlGvKwRNSykujfjdMxMhMQQM0TnIjJaHB+Zio=
2+
github.com/avast/retry-go/v4 v4.7.0/go.mod h1:ZMPDa3sY2bKgpLtap9JRUgk2yTAba7cgiFhqxY2Sg6Q=
33
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
44
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
55
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
@@ -10,16 +10,16 @@ github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
1010
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
1111
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
1212
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
13-
golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U=
14-
golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI=
13+
golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
14+
golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
1515
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
1616
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
17-
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
18-
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
19-
golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 h1:dHQOQddU4YHS5gY33/6klKjq7Gp3WwMyOXGNp5nzRj8=
20-
golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053/go.mod h1:+nZKN+XVh4LCiA9DV3ywrzN4gumyCnKjau3NGb9SGoE=
21-
golang.org/x/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE=
22-
golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w=
17+
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
18+
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
19+
golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8 h1:LvzTn0GQhWuvKH/kVRS3R3bVAsdQWI7hvfLHGgh9+lU=
20+
golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8/go.mod h1:Pi4ztBfryZoJEkyFTI5/Ocsu2jXyDr6iSdgJiYE/uwE=
21+
golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
22+
golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
2323
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
2424
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2525
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

0 commit comments

Comments
 (0)