1
0
mirror of https://github.com/redis/go-redis.git synced 2025-04-16 09:23:06 +03:00

test: add test for info in RCE 8 (#3269)

This commit is contained in:
Nedyalko Dyakov 2025-02-10 14:55:15 +02:00 committed by GitHub
parent 71311d8044
commit acbf4a688f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -532,6 +532,59 @@ var _ = Describe("Commands", func() {
Expect(info.Val()).To(HaveLen(1))
})
It("should Info Modules", Label("redis.info"), func() {
SkipBeforeRedisMajor(8, "modules are included in info for Redis Version >= 8")
info := client.Info(ctx)
Expect(info.Err()).NotTo(HaveOccurred())
Expect(info.Val()).NotTo(BeNil())
info = client.Info(ctx, "search")
Expect(info.Err()).NotTo(HaveOccurred())
Expect(info.Val()).To(ContainSubstring("search"))
info = client.Info(ctx, "modules")
Expect(info.Err()).NotTo(HaveOccurred())
Expect(info.Val()).To(ContainSubstring("search"))
Expect(info.Val()).To(ContainSubstring("ReJSON"))
Expect(info.Val()).To(ContainSubstring("timeseries"))
Expect(info.Val()).To(ContainSubstring("bf"))
info = client.Info(ctx, "everything")
Expect(info.Err()).NotTo(HaveOccurred())
Expect(info.Val()).To(ContainSubstring("search"))
Expect(info.Val()).To(ContainSubstring("ReJSON"))
Expect(info.Val()).To(ContainSubstring("timeseries"))
Expect(info.Val()).To(ContainSubstring("bf"))
})
It("should InfoMap Modules", Label("redis.info"), func() {
SkipBeforeRedisMajor(8, "modules are included in info for Redis Version >= 8")
info := client.InfoMap(ctx)
Expect(info.Err()).NotTo(HaveOccurred())
Expect(info.Val()).NotTo(BeNil())
info = client.InfoMap(ctx, "search")
Expect(info.Err()).NotTo(HaveOccurred())
Expect(len(info.Val())).To(BeNumerically(">=", 2))
Expect(info.Val()["search_version"]).ToNot(BeNil())
info = client.InfoMap(ctx, "modules")
Expect(info.Err()).NotTo(HaveOccurred())
val := info.Val()
modules, ok := val["Modules"]
Expect(ok).To(BeTrue())
Expect(len(val)).To(BeNumerically(">=", 2))
Expect(val["search_version"]).ToNot(BeNil())
Expect(modules["search"]).ToNot(BeNil())
Expect(modules["ReJSON"]).ToNot(BeNil())
Expect(modules["timeseries"]).ToNot(BeNil())
Expect(modules["bf"]).ToNot(BeNil())
info = client.InfoMap(ctx, "everything")
Expect(info.Err()).NotTo(HaveOccurred())
Expect(len(info.Val())).To(BeNumerically(">=", 10))
})
It("should Info cpu", func() {
info := client.Info(ctx, "cpu")
Expect(info.Err()).NotTo(HaveOccurred())