@@ -344,6 +344,23 @@ var _ = Describe("Commands", func() {
344344 Expect (val ).NotTo (BeEmpty ())
345345 })
346346
347+ It ("should ConfigGet Modules" , func () {
348+ SkipBeforeRedisMajor (8 , "Config doesn't include modules before Redis 8" )
349+ expected := map [string ]string {
350+ "search-*" : "search-min-prefix" ,
351+ "ts-*" : "ts-retention-policy" ,
352+ "bf-*" : "bf-error-rate" ,
353+ "cf-*" : "cf-initial-size" ,
354+ }
355+
356+ for prefix , lookup := range expected {
357+ val , err := client .ConfigGet (ctx , prefix ).Result ()
358+ Expect (err ).NotTo (HaveOccurred ())
359+ Expect (val ).NotTo (BeEmpty ())
360+ Expect (val [lookup ]).NotTo (BeEmpty ())
361+ }
362+ })
363+
347364 It ("should ConfigResetStat" , Label ("NonRedisEnterprise" ), func () {
348365 r := client .ConfigResetStat (ctx )
349366 Expect (r .Err ()).NotTo (HaveOccurred ())
@@ -362,6 +379,64 @@ var _ = Describe("Commands", func() {
362379 Expect (configSet .Val ()).To (Equal ("OK" ))
363380 })
364381
382+ It ("should ConfigSet Modules" , func () {
383+ SkipBeforeRedisMajor (8 , "Config doesn't include modules before Redis 8" )
384+ defaults := map [string ]string {}
385+ expected := map [string ]string {
386+ "search-min-prefix" : "32" ,
387+ "ts-retention-policy" : "2" ,
388+ "bf-error-rate" : "0.13" ,
389+ "cf-initial-size" : "64" ,
390+ }
391+
392+ // read the defaults to set them back later
393+ for setting , _ := range expected {
394+ val , err := client .ConfigGet (ctx , setting ).Result ()
395+ Expect (err ).NotTo (HaveOccurred ())
396+ defaults [setting ] = val [setting ]
397+ }
398+
399+ // check if new values can be set
400+ for setting , value := range expected {
401+ val , err := client .ConfigSet (ctx , setting , value ).Result ()
402+ Expect (err ).NotTo (HaveOccurred ())
403+ Expect (val ).NotTo (BeEmpty ())
404+ Expect (val ).To (Equal ("OK" ))
405+ }
406+
407+ for setting , value := range expected {
408+ val , err := client .ConfigGet (ctx , setting ).Result ()
409+ Expect (err ).NotTo (HaveOccurred ())
410+ Expect (val ).NotTo (BeEmpty ())
411+ Expect (val [setting ]).To (Equal (value ))
412+ }
413+
414+ // set back to the defaults
415+ for setting , value := range defaults {
416+ val , err := client .ConfigSet (ctx , setting , value ).Result ()
417+ Expect (err ).NotTo (HaveOccurred ())
418+ Expect (val ).NotTo (BeEmpty ())
419+ Expect (val ).To (Equal ("OK" ))
420+ }
421+ })
422+
423+ It ("should Fail ConfigSet Modules" , func () {
424+ SkipBeforeRedisMajor (8 , "Config doesn't include modules before Redis 8" )
425+ expected := map [string ]string {
426+ "search-min-prefix" : "-32" ,
427+ "ts-retention-policy" : "-10" ,
428+ "bf-error-rate" : "1.5" ,
429+ "cf-initial-size" : "-10" ,
430+ }
431+
432+ for setting , value := range expected {
433+ val , err := client .ConfigSet (ctx , setting , value ).Result ()
434+ Expect (err ).To (HaveOccurred ())
435+ Expect (err ).To (MatchError (ContainSubstring (setting )))
436+ Expect (val ).To (BeEmpty ())
437+ }
438+ })
439+
365440 It ("should ConfigRewrite" , Label ("NonRedisEnterprise" ), func () {
366441 configRewrite := client .ConfigRewrite (ctx )
367442 Expect (configRewrite .Err ()).NotTo (HaveOccurred ())
0 commit comments