Merge branch 'master' into ankit/add-custom-label-support

This commit is contained in:
Ankit Chahar 2024-01-02 14:34:47 +05:30 committed by GitHub
commit 1a693b080a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 212 additions and 113 deletions

View File

@ -0,0 +1,59 @@
name: RE Tests
on:
push:
branches: [master]
pull_request:
permissions:
contents: read
jobs:
build:
name: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: [1.21.x]
re-build: ["7.2.4-92"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Clone Redis EE docker repository
uses: actions/checkout@v4
with:
repository: RedisLabs/redis-ee-docker
path: redis-ee
- name: Set up ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Build cluster
working-directory: redis-ee
env:
IMAGE: "redislabs/redis-internal:${{ matrix.re-build }}"
RE_USERNAME: ${{ secrets.RE_USERNAME }}
RE_PASS: ${{ secrets.RE_PASS }}
RE_CLUSTER_NAME: ${{ secrets.RE_CLUSTER_NAME }}
OSS_CLUSTER: false
DB_PORT: ${{ secrets.RE_DB_PORT }}
DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
run: ./build.sh
- name: Test
env:
RE_CLUSTER: "1"
run: |
go test \
--ginkgo.skip-file="ring_test.go" \
--ginkgo.skip-file="sentinel_test.go" \
--ginkgo.skip-file="osscluster_test.go" \
--ginkgo.skip-file="pubsub_test.go" \
--ginkgo.skip-file="gears_commands_test.go" \
--ginkgo.label-filter='!NonRedisEnterprise'

View File

@ -107,7 +107,7 @@ var _ = Describe("Commands", func() {
Expect(time.Now()).To(BeTemporally("~", start.Add(waitAOF), 3*time.Second))
})
It("should Select", func() {
It("should Select", Label("NonRedisEnterprise"), func() {
pipe := client.Pipeline()
sel := pipe.Select(ctx, 1)
_, err := pipe.Exec(ctx)
@ -117,7 +117,7 @@ var _ = Describe("Commands", func() {
Expect(sel.Val()).To(Equal("OK"))
})
It("should SwapDB", func() {
It("should SwapDB", Label("NonRedisEnterprise"), func() {
pipe := client.Pipeline()
sel := pipe.SwapDB(ctx, 1, 2)
_, err := pipe.Exec(ctx)
@ -219,7 +219,7 @@ var _ = Describe("Commands", func() {
Expect(info).NotTo(BeNil())
})
It("should ClientPause", func() {
It("should ClientPause", Label("NonRedisEnterprise"), func() {
err := client.ClientPause(ctx, time.Second).Err()
Expect(err).NotTo(HaveOccurred())
@ -299,13 +299,13 @@ var _ = Describe("Commands", func() {
Expect(val).NotTo(BeEmpty())
})
It("should ConfigResetStat", func() {
It("should ConfigResetStat", Label("NonRedisEnterprise"), func() {
r := client.ConfigResetStat(ctx)
Expect(r.Err()).NotTo(HaveOccurred())
Expect(r.Val()).To(Equal("OK"))
})
It("should ConfigSet", func() {
It("should ConfigSet", Label("NonRedisEnterprise"), func() {
configGet := client.ConfigGet(ctx, "maxmemory")
Expect(configGet.Err()).NotTo(HaveOccurred())
Expect(configGet.Val()).To(HaveLen(1))
@ -317,7 +317,7 @@ var _ = Describe("Commands", func() {
Expect(configSet.Val()).To(Equal("OK"))
})
It("should ConfigRewrite", func() {
It("should ConfigRewrite", Label("NonRedisEnterprise"), func() {
configRewrite := client.ConfigRewrite(ctx)
Expect(configRewrite.Err()).NotTo(HaveOccurred())
Expect(configRewrite.Val()).To(Equal("OK"))
@ -364,20 +364,20 @@ var _ = Describe("Commands", func() {
Expect(info.Val()).To(ContainSubstring(`memory`))
})
It("should LastSave", func() {
It("should LastSave", Label("NonRedisEnterprise"), func() {
lastSave := client.LastSave(ctx)
Expect(lastSave.Err()).NotTo(HaveOccurred())
Expect(lastSave.Val()).NotTo(Equal(0))
})
It("should Save", func() {
It("should Save", Label("NonRedisEnterprise"), func() {
// workaround for "ERR Background save already in progress"
Eventually(func() string {
return client.Save(ctx).Val()
}, "10s").Should(Equal("OK"))
})
It("should SlaveOf", func() {
It("should SlaveOf", Label("NonRedisEnterprise"), func() {
slaveOf := client.SlaveOf(ctx, "localhost", "8888")
Expect(slaveOf.Err()).NotTo(HaveOccurred())
Expect(slaveOf.Val()).To(Equal("OK"))
@ -393,7 +393,7 @@ var _ = Describe("Commands", func() {
Expect(tm).To(BeTemporally("~", time.Now(), 3*time.Second))
})
It("should Command", func() {
It("should Command", Label("NonRedisEnterprise"), func() {
cmds, err := client.Command(ctx).Result()
Expect(err).NotTo(HaveOccurred())
Expect(len(cmds)).To(BeNumerically("~", 240, 25))
@ -624,7 +624,7 @@ var _ = Describe("Commands", func() {
Expect(keys.Val()).To(ConsistOf([]string{"four", "one", "three", "two"}))
})
It("should Migrate", func() {
It("should Migrate", Label("NonRedisEnterprise"), func() {
migrate := client.Migrate(ctx, "localhost", redisSecondaryPort, "key", 0, 0)
Expect(migrate.Err()).NotTo(HaveOccurred())
Expect(migrate.Val()).To(Equal("NOKEY"))
@ -638,7 +638,7 @@ var _ = Describe("Commands", func() {
Expect(migrate.Val()).To(Equal(""))
})
It("should Move", func() {
It("should Move", Label("NonRedisEnterprise"), func() {
move := client.Move(ctx, "key", 2)
Expect(move.Err()).NotTo(HaveOccurred())
Expect(move.Val()).To(Equal(false))
@ -799,7 +799,7 @@ var _ = Describe("Commands", func() {
Expect(randomKey.Val()).To(Equal("key"))
})
It("should Rename", func() {
It("should Rename", Label("NonRedisEnterprise"), func() {
set := client.Set(ctx, "key", "hello", 0)
Expect(set.Err()).NotTo(HaveOccurred())
Expect(set.Val()).To(Equal("OK"))
@ -813,7 +813,7 @@ var _ = Describe("Commands", func() {
Expect(get.Val()).To(Equal("hello"))
})
It("should RenameNX", func() {
It("should RenameNX", Label("NonRedisEnterprise"), func() {
set := client.Set(ctx, "key", "hello", 0)
Expect(set.Err()).NotTo(HaveOccurred())
Expect(set.Val()).To(Equal("OK"))
@ -914,7 +914,7 @@ var _ = Describe("Commands", func() {
Expect(els).To(Equal([]string{"1", "2"}))
})
It("should Sort and Get", func() {
It("should Sort and Get", Label("NonRedisEnterprise"), func() {
size, err := client.LPush(ctx, "list", "1").Result()
Expect(err).NotTo(HaveOccurred())
Expect(size).To(Equal(int64(1)))
@ -947,7 +947,7 @@ var _ = Describe("Commands", func() {
}
})
It("should Sort and Store", func() {
It("should Sort and Store", Label("NonRedisEnterprise"), func() {
size, err := client.LPush(ctx, "list", "1").Result()
Expect(err).NotTo(HaveOccurred())
Expect(size).To(Equal(int64(1)))
@ -1147,7 +1147,7 @@ var _ = Describe("Commands", func() {
Expect(bitCount.Val()).To(Equal(int64(6)))
})
It("should BitOpAnd", func() {
It("should BitOpAnd", Label("NonRedisEnterprise"), func() {
set := client.Set(ctx, "key1", "1", 0)
Expect(set.Err()).NotTo(HaveOccurred())
Expect(set.Val()).To(Equal("OK"))
@ -1165,7 +1165,7 @@ var _ = Describe("Commands", func() {
Expect(get.Val()).To(Equal("0"))
})
It("should BitOpOr", func() {
It("should BitOpOr", Label("NonRedisEnterprise"), func() {
set := client.Set(ctx, "key1", "1", 0)
Expect(set.Err()).NotTo(HaveOccurred())
Expect(set.Val()).To(Equal("OK"))
@ -1183,7 +1183,7 @@ var _ = Describe("Commands", func() {
Expect(get.Val()).To(Equal("1"))
})
It("should BitOpXor", func() {
It("should BitOpXor", Label("NonRedisEnterprise"), func() {
set := client.Set(ctx, "key1", "\xff", 0)
Expect(set.Err()).NotTo(HaveOccurred())
Expect(set.Val()).To(Equal("OK"))
@ -1201,7 +1201,7 @@ var _ = Describe("Commands", func() {
Expect(get.Val()).To(Equal("\xf0"))
})
It("should BitOpNot", func() {
It("should BitOpNot", Label("NonRedisEnterprise"), func() {
set := client.Set(ctx, "key1", "\x00", 0)
Expect(set.Err()).NotTo(HaveOccurred())
Expect(set.Val()).To(Equal("OK"))
@ -1530,7 +1530,7 @@ var _ = Describe("Commands", func() {
}))
})
It("should MSetNX", func() {
It("should MSetNX", Label("NonRedisEnterprise"), func() {
mSetNX := client.MSetNX(ctx, "key1", "hello1", "key2", "hello2")
Expect(mSetNX.Err()).NotTo(HaveOccurred())
Expect(mSetNX.Val()).To(Equal(true))
@ -1995,7 +1995,7 @@ var _ = Describe("Commands", func() {
Expect(strLen.Val()).To(Equal(int64(0)))
})
It("should Copy", func() {
It("should Copy", Label("NonRedisEnterprise"), func() {
set := client.Set(ctx, "key", "hello", 0)
Expect(set.Err()).NotTo(HaveOccurred())
Expect(set.Val()).To(Equal("OK"))
@ -2027,7 +2027,7 @@ var _ = Describe("Commands", func() {
Expect(dryRun.Val()).To(Equal("OK"))
})
It("should fail module loadex", func() {
It("should fail module loadex", Label("NonRedisEnterprise"), func() {
dryRun := client.ModuleLoadex(ctx, &redis.ModuleLoadexConfig{
Path: "/path/to/non-existent-library.so",
Conf: map[string]interface{}{
@ -2075,7 +2075,7 @@ var _ = Describe("Commands", func() {
Expect(args).To(Equal(expectedArgs))
})
It("should ACL LOG", func() {
It("should ACL LOG", Label("NonRedisEnterprise"), func() {
err := client.Do(ctx, "acl", "setuser", "test", ">test", "on", "allkeys", "+get").Err()
Expect(err).NotTo(HaveOccurred())
@ -2108,7 +2108,7 @@ var _ = Describe("Commands", func() {
Expect(len(limitedLogEntries)).To(Equal(2))
})
It("should ACL LOG RESET", func() {
It("should ACL LOG RESET", Label("NonRedisEnterprise"), func() {
// Call ACL LOG RESET
resetCmd := client.ACLLogReset(ctx)
Expect(resetCmd.Err()).NotTo(HaveOccurred())
@ -2417,7 +2417,7 @@ var _ = Describe("Commands", func() {
})
Describe("hyperloglog", func() {
It("should PFMerge", func() {
It("should PFMerge", Label("NonRedisEnterprise"), func() {
pfAdd := client.PFAdd(ctx, "hll1", "1", "2", "3", "4", "5")
Expect(pfAdd.Err()).NotTo(HaveOccurred())
@ -2442,7 +2442,7 @@ var _ = Describe("Commands", func() {
})
Describe("lists", func() {
It("should BLPop", func() {
It("should BLPop", Label("NonRedisEnterprise"), func() {
rPush := client.RPush(ctx, "list1", "a", "b", "c")
Expect(rPush.Err()).NotTo(HaveOccurred())
@ -2496,7 +2496,7 @@ var _ = Describe("Commands", func() {
Expect(stats.Timeouts).To(Equal(uint32(0)))
})
It("should BRPop", func() {
It("should BRPop", Label("NonRedisEnterprise"), func() {
rPush := client.RPush(ctx, "list1", "a", "b", "c")
Expect(rPush.Err()).NotTo(HaveOccurred())
@ -2538,7 +2538,7 @@ var _ = Describe("Commands", func() {
}
})
It("should BRPopLPush", func() {
It("should BRPopLPush", Label("NonRedisEnterprise"), func() {
_, err := client.BRPopLPush(ctx, "list1", "list2", time.Second).Result()
Expect(err).To(Equal(redis.Nil))
@ -2550,7 +2550,7 @@ var _ = Describe("Commands", func() {
Expect(v).To(Equal("c"))
})
It("should LCS", func() {
It("should LCS", Label("NonRedisEnterprise"), func() {
err := client.MSet(ctx, "key1", "ohmytext", "key2", "mynewtext").Err()
Expect(err).NotTo(HaveOccurred())
@ -2664,7 +2664,7 @@ var _ = Describe("Commands", func() {
Expect(lRange.Val()).To(Equal([]string{"Hello", "There", "World"}))
})
It("should LMPop", func() {
It("should LMPop", Label("NonRedisEnterprise"), func() {
err := client.LPush(ctx, "list1", "one", "two", "three", "four", "five").Err()
Expect(err).NotTo(HaveOccurred())
@ -2704,7 +2704,7 @@ var _ = Describe("Commands", func() {
Expect(err).To(HaveOccurred())
})
It("should BLMPop", func() {
It("should BLMPop", Label("NonRedisEnterprise"), func() {
err := client.LPush(ctx, "list1", "one", "two", "three", "four", "five").Err()
Expect(err).NotTo(HaveOccurred())
@ -3038,7 +3038,7 @@ var _ = Describe("Commands", func() {
Expect(lRange.Val()).To(Equal([]string{"one", "two"}))
})
It("should RPopLPush", func() {
It("should RPopLPush", Label("NonRedisEnterprise"), func() {
rPush := client.RPush(ctx, "list", "one")
Expect(rPush.Err()).NotTo(HaveOccurred())
rPush = client.RPush(ctx, "list", "two")
@ -3107,7 +3107,7 @@ var _ = Describe("Commands", func() {
Expect(lRange.Val()).To(Equal([]string{}))
})
It("should LMove", func() {
It("should LMove", Label("NonRedisEnterprise"), func() {
rPush := client.RPush(ctx, "lmove1", "ichi")
Expect(rPush.Err()).NotTo(HaveOccurred())
Expect(rPush.Val()).To(Equal(int64(1)))
@ -3129,7 +3129,7 @@ var _ = Describe("Commands", func() {
Expect(lRange.Val()).To(Equal([]string{"san"}))
})
It("should BLMove", func() {
It("should BLMove", Label("NonRedisEnterprise"), func() {
rPush := client.RPush(ctx, "blmove1", "ichi")
Expect(rPush.Err()).NotTo(HaveOccurred())
Expect(rPush.Val()).To(Equal(int64(1)))
@ -3196,7 +3196,7 @@ var _ = Describe("Commands", func() {
Expect(sCard.Val()).To(Equal(int64(2)))
})
It("should SDiff", func() {
It("should SDiff", Label("NonRedisEnterprise"), func() {
sAdd := client.SAdd(ctx, "set1", "a")
Expect(sAdd.Err()).NotTo(HaveOccurred())
sAdd = client.SAdd(ctx, "set1", "b")
@ -3216,7 +3216,7 @@ var _ = Describe("Commands", func() {
Expect(sDiff.Val()).To(ConsistOf([]string{"a", "b"}))
})
It("should SDiffStore", func() {
It("should SDiffStore", Label("NonRedisEnterprise"), func() {
sAdd := client.SAdd(ctx, "set1", "a")
Expect(sAdd.Err()).NotTo(HaveOccurred())
sAdd = client.SAdd(ctx, "set1", "b")
@ -3240,7 +3240,7 @@ var _ = Describe("Commands", func() {
Expect(sMembers.Val()).To(ConsistOf([]string{"a", "b"}))
})
It("should SInter", func() {
It("should SInter", Label("NonRedisEnterprise"), func() {
sAdd := client.SAdd(ctx, "set1", "a")
Expect(sAdd.Err()).NotTo(HaveOccurred())
sAdd = client.SAdd(ctx, "set1", "b")
@ -3260,7 +3260,7 @@ var _ = Describe("Commands", func() {
Expect(sInter.Val()).To(Equal([]string{"c"}))
})
It("should SInterCard", func() {
It("should SInterCard", Label("NonRedisEnterprise"), func() {
sAdd := client.SAdd(ctx, "set1", "a")
Expect(sAdd.Err()).NotTo(HaveOccurred())
sAdd = client.SAdd(ctx, "set1", "b")
@ -3290,7 +3290,7 @@ var _ = Describe("Commands", func() {
Expect(sInterCard.Val()).To(Equal(int64(2)))
})
It("should SInterStore", func() {
It("should SInterStore", Label("NonRedisEnterprise"), func() {
sAdd := client.SAdd(ctx, "set1", "a")
Expect(sAdd.Err()).NotTo(HaveOccurred())
sAdd = client.SAdd(ctx, "set1", "b")
@ -3358,7 +3358,7 @@ var _ = Describe("Commands", func() {
Expect(sMembersMap.Val()).To(Equal(map[string]struct{}{"Hello": {}, "World": {}}))
})
It("should SMove", func() {
It("should SMove", Label("NonRedisEnterprise"), func() {
sAdd := client.SAdd(ctx, "set1", "one")
Expect(sAdd.Err()).NotTo(HaveOccurred())
sAdd = client.SAdd(ctx, "set1", "two")
@ -3466,7 +3466,7 @@ var _ = Describe("Commands", func() {
Expect(sMembers.Val()).To(ConsistOf([]string{"three", "two"}))
})
It("should SUnion", func() {
It("should SUnion", Label("NonRedisEnterprise"), func() {
sAdd := client.SAdd(ctx, "set1", "a")
Expect(sAdd.Err()).NotTo(HaveOccurred())
sAdd = client.SAdd(ctx, "set1", "b")
@ -3486,7 +3486,7 @@ var _ = Describe("Commands", func() {
Expect(sUnion.Val()).To(HaveLen(5))
})
It("should SUnionStore", func() {
It("should SUnionStore", Label("NonRedisEnterprise"), func() {
sAdd := client.SAdd(ctx, "set1", "a")
Expect(sAdd.Err()).NotTo(HaveOccurred())
sAdd = client.SAdd(ctx, "set1", "b")
@ -3512,7 +3512,7 @@ var _ = Describe("Commands", func() {
})
Describe("sorted sets", func() {
It("should BZPopMax", func() {
It("should BZPopMax", Label("NonRedisEnterprise"), func() {
err := client.ZAdd(ctx, "zset1", redis.Z{
Score: 1,
Member: "one",
@ -3594,7 +3594,7 @@ var _ = Describe("Commands", func() {
Expect(stats.Timeouts).To(Equal(uint32(0)))
})
It("should BZPopMin", func() {
It("should BZPopMin", Label("NonRedisEnterprise"), func() {
err := client.ZAdd(ctx, "zset1", redis.Z{
Score: 1,
Member: "one",
@ -4176,7 +4176,7 @@ var _ = Describe("Commands", func() {
}}))
})
It("should ZInterStore", func() {
It("should ZInterStore", Label("NonRedisEnterprise"), func() {
err := client.ZAdd(ctx, "zset1", redis.Z{
Score: 1,
Member: "one",
@ -4213,7 +4213,7 @@ var _ = Describe("Commands", func() {
}}))
})
It("should ZMPop", func() {
It("should ZMPop", Label("NonRedisEnterprise"), func() {
err := client.ZAdd(ctx, "zset", redis.Z{Score: 1, Member: "one"}).Err()
Expect(err).NotTo(HaveOccurred())
err = client.ZAdd(ctx, "zset", redis.Z{Score: 2, Member: "two"}).Err()
@ -4287,7 +4287,7 @@ var _ = Describe("Commands", func() {
}}))
})
It("should BZMPop", func() {
It("should BZMPop", Label("NonRedisEnterprise"), func() {
err := client.ZAdd(ctx, "zset", redis.Z{Score: 1, Member: "one"}).Err()
Expect(err).NotTo(HaveOccurred())
err = client.ZAdd(ctx, "zset", redis.Z{Score: 2, Member: "two"}).Err()
@ -4827,7 +4827,7 @@ var _ = Describe("Commands", func() {
Expect(vals).To(Equal([]redis.Z{}))
})
It("should ZRangeStore", func() {
It("should ZRangeStore", Label("NonRedisEnterprise"), func() {
added, err := client.ZAddArgs(ctx, "zset", redis.ZAddArgs{
Members: []redis.Z{
{Score: 1, Member: "one"},
@ -5203,7 +5203,7 @@ var _ = Describe("Commands", func() {
Expect(zScore.Val()).To(Equal(1.001))
})
It("should ZUnion", func() {
It("should ZUnion", Label("NonRedisEnterprise"), func() {
err := client.ZAddArgs(ctx, "zset1", redis.ZAddArgs{
Members: []redis.Z{
{Score: 1, Member: "one"},
@ -5242,7 +5242,7 @@ var _ = Describe("Commands", func() {
}))
})
It("should ZUnionStore", func() {
It("should ZUnionStore", Label("NonRedisEnterprise"), func() {
err := client.ZAdd(ctx, "zset1", redis.Z{Score: 1, Member: "one"}).Err()
Expect(err).NotTo(HaveOccurred())
err = client.ZAdd(ctx, "zset1", redis.Z{Score: 2, Member: "two"}).Err()
@ -5298,7 +5298,7 @@ var _ = Describe("Commands", func() {
))
})
It("should ZDiff", func() {
It("should ZDiff", Label("NonRedisEnterprise"), func() {
err := client.ZAdd(ctx, "zset1", redis.Z{Score: 1, Member: "one"}).Err()
Expect(err).NotTo(HaveOccurred())
err = client.ZAdd(ctx, "zset1", redis.Z{Score: 2, Member: "two"}).Err()
@ -5313,7 +5313,7 @@ var _ = Describe("Commands", func() {
Expect(v).To(Equal([]string{"two", "three"}))
})
It("should ZDiffWithScores", func() {
It("should ZDiffWithScores", Label("NonRedisEnterprise"), func() {
err := client.ZAdd(ctx, "zset1", redis.Z{Score: 1, Member: "one"}).Err()
Expect(err).NotTo(HaveOccurred())
err = client.ZAdd(ctx, "zset1", redis.Z{Score: 2, Member: "two"}).Err()
@ -5337,7 +5337,7 @@ var _ = Describe("Commands", func() {
}))
})
It("should ZInter", func() {
It("should ZInter", Label("NonRedisEnterprise"), func() {
err := client.ZAdd(ctx, "zset1", redis.Z{Score: 1, Member: "one"}).Err()
Expect(err).NotTo(HaveOccurred())
err = client.ZAdd(ctx, "zset1", redis.Z{Score: 2, Member: "two"}).Err()
@ -5356,7 +5356,7 @@ var _ = Describe("Commands", func() {
Expect(v).To(Equal([]string{"one", "two"}))
})
It("should ZInterCard", func() {
It("should ZInterCard", Label("NonRedisEnterprise"), func() {
err := client.ZAdd(ctx, "zset1", redis.Z{Score: 1, Member: "one"}).Err()
Expect(err).NotTo(HaveOccurred())
err = client.ZAdd(ctx, "zset1", redis.Z{Score: 2, Member: "two"}).Err()
@ -5382,7 +5382,7 @@ var _ = Describe("Commands", func() {
Expect(sInterCard.Val()).To(Equal(int64(2)))
})
It("should ZInterWithScores", func() {
It("should ZInterWithScores", Label("NonRedisEnterprise"), func() {
err := client.ZAdd(ctx, "zset1", redis.Z{Score: 1, Member: "one"}).Err()
Expect(err).NotTo(HaveOccurred())
err = client.ZAdd(ctx, "zset1", redis.Z{Score: 2, Member: "two"}).Err()
@ -5412,7 +5412,7 @@ var _ = Describe("Commands", func() {
}))
})
It("should ZDiffStore", func() {
It("should ZDiffStore", Label("NonRedisEnterprise"), func() {
err := client.ZAdd(ctx, "zset1", redis.Z{Score: 1, Member: "one"}).Err()
Expect(err).NotTo(HaveOccurred())
err = client.ZAdd(ctx, "zset1", redis.Z{Score: 2, Member: "two"}).Err()
@ -6143,7 +6143,7 @@ var _ = Describe("Commands", func() {
Expect(res[1].Name).To(Equal("Catania"))
})
It("should geo radius and store the result", func() {
It("should geo radius and store the result", Label("NonRedisEnterprise"), func() {
n, err := client.GeoRadiusStore(ctx, "Sicily", 15, 37, &redis.GeoRadiusQuery{
Radius: 200,
Store: "result",
@ -6163,7 +6163,7 @@ var _ = Describe("Commands", func() {
}))
})
It("should geo radius and store dist", func() {
It("should geo radius and store dist", Label("NonRedisEnterprise"), func() {
n, err := client.GeoRadiusStore(ctx, "Sicily", 15, 37, &redis.GeoRadiusQuery{
Radius: 200,
StoreDist: "result",
@ -6445,7 +6445,7 @@ var _ = Describe("Commands", func() {
}))
})
It("should geo search store", func() {
It("should geo search store", Label("NonRedisEnterprise"), func() {
q := &redis.GeoSearchStoreQuery{
GeoSearchQuery: redis.GeoSearchQuery{
Longitude: 15,
@ -6705,7 +6705,7 @@ var _ = Describe("Commands", func() {
q = redis.FunctionListQuery{}
})
It("Loads a new library", func() {
It("Loads a new library", Label("NonRedisEnterprise"), func() {
functionLoad := client.FunctionLoad(ctx, lib1Code)
Expect(functionLoad.Err()).NotTo(HaveOccurred())
Expect(functionLoad.Val()).To(Equal(lib1.Name))
@ -6715,7 +6715,7 @@ var _ = Describe("Commands", func() {
Expect(functionList.Val()).To(HaveLen(1))
})
It("Loads and replaces a new library", func() {
It("Loads and replaces a new library", Label("NonRedisEnterprise"), func() {
// Load a library for the first time
err := client.FunctionLoad(ctx, lib1Code).Err()
Expect(err).NotTo(HaveOccurred())
@ -6786,7 +6786,7 @@ var _ = Describe("Commands", func() {
// Add test for a long-running function, once we make the test for `function stats` pass
})
It("Lists registered functions", func() {
It("Lists registered functions", Label("NonRedisEnterprise"), func() {
err := client.FunctionLoad(ctx, lib1Code).Err()
Expect(err).NotTo(HaveOccurred())
@ -6825,7 +6825,7 @@ var _ = Describe("Commands", func() {
Expect(err).To(Equal(redis.Nil))
})
It("Dump and restores all libraries", func() {
It("Dump and restores all libraries", Label("NonRedisEnterprise"), func() {
err := client.FunctionLoad(ctx, lib1Code).Err()
Expect(err).NotTo(HaveOccurred())
err = client.FunctionLoad(ctx, lib2Code).Err()

View File

@ -657,6 +657,11 @@ func ExampleNewUniversalClient_cluster() {
}
func ExampleClient_SlowLogGet() {
if RECluster {
// skip slowlog test for cluster
fmt.Println(2)
return
}
const key = "slowlog-log-slower-than"
old := rdb.ConfigGet(ctx, key).Val()

View File

@ -19,7 +19,7 @@ var _ = Describe("JSON Commands", Label("json"), func() {
BeforeEach(func() {
client = redis.NewClient(&redis.Options{Addr: ":6379"})
Expect(client.FlushDB(ctx).Err()).NotTo(HaveOccurred())
Expect(client.FlushAll(ctx).Err()).NotTo(HaveOccurred())
})
AfterEach(func() {
@ -270,7 +270,7 @@ var _ = Describe("JSON Commands", Label("json"), func() {
Expect(res).To(Equal(`[{"a":1,"b":3,"c":4}]`))
})
It("should JSONMSet", Label("json.mset", "json"), func() {
It("should JSONMSet", Label("json.mset", "json", "NonRedisEnterprise"), func() {
doc1 := redis.JSONSetArgs{Key: "mset1", Path: "$", Value: `{"a": 1}`}
doc2 := redis.JSONSetArgs{Key: "mset2", Path: "$", Value: 2}
docs := []redis.JSONSetArgs{doc1, doc2}
@ -287,11 +287,11 @@ var _ = Describe("JSON Commands", Label("json"), func() {
Expect(err).NotTo(HaveOccurred())
Expect(res).To(Equal([]interface{}{`[{"a":1}]`, "[2]"}))
mSetResult, err = client.JSONMSet(ctx, "mset1", "$.a", 2, "mset3", "$", `[1]`).Result()
_, err = client.JSONMSet(ctx, "mset1", "$.a", 2, "mset3", "$", `[1]`).Result()
Expect(err).NotTo(HaveOccurred())
})
It("should JSONMGet", Label("json.mget", "json"), func() {
It("should JSONMGet", Label("json.mget", "json", "NonRedisEnterprise"), func() {
cmd1 := client.JSONSet(ctx, "mget2a", "$", `{"a": ["aa", "ab", "ac", "ad"], "b": {"a": ["ba", "bb", "bc", "bd"]}}`)
Expect(cmd1.Err()).NotTo(HaveOccurred())
Expect(cmd1.Val()).To(Equal("OK"))
@ -306,7 +306,7 @@ var _ = Describe("JSON Commands", Label("json"), func() {
Expect(cmd3.Val()[1]).To(Equal(`[[100,200,300,200],[100,200,300,200]]`))
})
It("should JSONMget with $", Label("json.mget", "json"), func() {
It("should JSONMget with $", Label("json.mget", "json", "NonRedisEnterprise"), func() {
res, err := client.JSONSet(ctx, "doc1", "$", `{"a": 1, "b": 2, "nested": {"a": 3}, "c": "", "nested2": {"a": ""}}`).Result()
Expect(err).NotTo(HaveOccurred())
Expect(res).To(Equal("OK"))

View File

@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"path/filepath"
"strconv"
"sync"
"testing"
"time"
@ -64,6 +65,8 @@ var cluster = &clusterScenario{
clients: make(map[string]*redis.Client, 6),
}
var RECluster = false
func registerProcess(port string, p *redisProcess) {
if processes == nil {
processes = make(map[string]*redisProcess)
@ -78,6 +81,9 @@ var _ = BeforeSuite(func() {
redisAddr = ":" + redisPort
}
var err error
RECluster, _ = strconv.ParseBool(os.Getenv("RE_CLUSTER"))
if !RECluster {
redisMain, err = startRedis(redisPort)
Expect(err).NotTo(HaveOccurred())
@ -112,14 +118,20 @@ var _ = BeforeSuite(func() {
Expect(err).NotTo(HaveOccurred())
Expect(startCluster(ctx, cluster)).NotTo(HaveOccurred())
} else {
redisPort = rediStackPort
redisAddr = rediStackAddr
}
})
var _ = AfterSuite(func() {
if !RECluster {
Expect(cluster.Close()).NotTo(HaveOccurred())
for _, p := range processes {
Expect(p.Close()).NotTo(HaveOccurred())
}
}
processes = nil
})
@ -131,6 +143,23 @@ func TestGinkgoSuite(t *testing.T) {
//------------------------------------------------------------------------------
func redisOptions() *redis.Options {
if RECluster {
return &redis.Options{
Addr: redisAddr,
DB: 0,
DialTimeout: 10 * time.Second,
ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second,
ContextTimeoutEnabled: true,
MaxRetries: -1,
PoolSize: 10,
PoolTimeout: 30 * time.Second,
ConnMaxIdleTime: time.Minute,
}
}
return &redis.Options{
Addr: redisAddr,
DB: 15,

View File

@ -71,7 +71,7 @@ var _ = Describe("pipelining", func() {
Expect(cmds).To(HaveLen(1))
})
It("handles large pipelines", func() {
It("handles large pipelines", Label("NonRedisEnterprise"), func() {
for callCount := 1; callCount < 16; callCount++ {
for i := 1; i <= callCount; i++ {
pipe.SetNX(ctx, strconv.Itoa(i)+"_key", strconv.Itoa(i)+"_value", 0)

View File

@ -460,7 +460,7 @@ var _ = Describe("Probabilistic commands", Label("probabilistic"), func() {
Expect(info).To(BeAssignableToTypeOf(redis.CMSInfo{}))
})
It("should CMSMerge, CMSMergeWithWeight and CMSQuery", Label("cms", "cmsmerge", "cmsquery"), func() {
It("should CMSMerge, CMSMergeWithWeight and CMSQuery", Label("cms", "cmsmerge", "cmsquery", "NonRedisEnterprise"), func() {
err := client.CMSMerge(ctx, "destCms1", "testcms2", "testcms3").Err()
Expect(err).To(HaveOccurred())
Expect(err).To(MatchError("CMS: key does not exist"))
@ -697,7 +697,7 @@ var _ = Describe("Probabilistic commands", Label("probabilistic"), func() {
Expect(info.Compression).To(BeEquivalentTo(int64(2000)))
})
It("should TDigestMerge", Label("tdigest", "tmerge"), func() {
It("should TDigestMerge", Label("tdigest", "tmerge", "NonRedisEnterprise"), func() {
err := client.TDigestCreate(ctx, "tdigest1").Err()
Expect(err).NotTo(HaveOccurred())
err = client.TDigestAdd(ctx, "tdigest1", 10, 20, 30, 40, 50, 60, 70, 80, 90, 100).Err()

View File

@ -137,7 +137,7 @@ var _ = Describe("races", func() {
})
})
It("should select db", func() {
It("should select db", Label("NonRedisEnterprise"), func() {
err := client.Set(ctx, "db", 1, 0).Err()
Expect(err).NotTo(HaveOccurred())
@ -243,7 +243,7 @@ var _ = Describe("races", func() {
})
})
var _ = Describe("cluster races", func() {
var _ = Describe("cluster races", Label("NonRedisEnterprise"), func() {
var client *redis.ClusterClient
var C, N int

View File

@ -65,7 +65,11 @@ var _ = Describe("Client", func() {
})
It("should Stringer", func() {
if RECluster {
Expect(client.String()).To(Equal(fmt.Sprintf("Redis<:%s db:0>", redisPort)))
} else {
Expect(client.String()).To(Equal(fmt.Sprintf("Redis<:%s db:15>", redisPort)))
}
})
It("supports context", func() {
@ -76,7 +80,7 @@ var _ = Describe("Client", func() {
Expect(err).To(MatchError("context canceled"))
})
It("supports WithTimeout", func() {
It("supports WithTimeout", Label("NonRedisEnterprise"), func() {
err := client.ClientPause(ctx, time.Second).Err()
Expect(err).NotTo(HaveOccurred())
@ -151,7 +155,7 @@ var _ = Describe("Client", func() {
Expect(pubsub.Close()).NotTo(HaveOccurred())
})
It("should select DB", func() {
It("should select DB", Label("NonRedisEnterprise"), func() {
db2 := redis.NewClient(&redis.Options{
Addr: redisAddr,
DB: 2,
@ -503,7 +507,7 @@ var _ = Describe("Conn", func() {
Expect(err).NotTo(HaveOccurred())
})
It("TxPipeline", func() {
It("TxPipeline", Label("NonRedisEnterprise"), func() {
tx := client.Conn().TxPipeline()
tx.SwapDB(ctx, 0, 2)
tx.SwapDB(ctx, 1, 0)

View File

@ -15,7 +15,7 @@ var _ = Describe("RedisTimeseries commands", Label("timeseries"), func() {
var client *redis.Client
BeforeEach(func() {
client = redis.NewClient(&redis.Options{Addr: ":6379"})
client = redis.NewClient(&redis.Options{Addr: rediStackAddr})
Expect(client.FlushDB(ctx).Err()).NotTo(HaveOccurred())
})
@ -290,15 +290,17 @@ var _ = Describe("RedisTimeseries commands", Label("timeseries"), func() {
Expect(result.Value).To(BeEquivalentTo(151))
})
It("should TSGet Latest", Label("timeseries", "tsgetlatest"), func() {
It("should TSGet Latest", Label("timeseries", "tsgetlatest", "NonRedisEnterprise"), func() {
resultGet, err := client.TSCreate(ctx, "tsgl-1").Result()
Expect(err).NotTo(HaveOccurred())
Expect(resultGet).To(BeEquivalentTo("OK"))
resultGet, err = client.TSCreate(ctx, "tsgl-2").Result()
Expect(err).NotTo(HaveOccurred())
Expect(resultGet).To(BeEquivalentTo("OK"))
resultGet, err = client.TSCreateRule(ctx, "tsgl-1", "tsgl-2", redis.Sum, 10).Result()
Expect(err).NotTo(HaveOccurred())
Expect(resultGet).To(BeEquivalentTo("OK"))
_, err = client.TSAdd(ctx, "tsgl-1", 1, 1).Result()
Expect(err).NotTo(HaveOccurred())
@ -344,7 +346,7 @@ var _ = Describe("RedisTimeseries commands", Label("timeseries"), func() {
Expect(result).To(BeEquivalentTo([]int64{1, 2, 3}))
})
It("should TSMGet and TSMGetWithArgs", Label("timeseries", "tsmget", "tsmgetWithArgs"), func() {
It("should TSMGet and TSMGetWithArgs", Label("timeseries", "tsmget", "tsmgetWithArgs", "NonRedisEnterprise"), func() {
opt := &redis.TSOptions{Labels: map[string]string{"Test": "This"}}
resultCreate, err := client.TSCreateWithArgs(ctx, "a", opt).Result()
Expect(err).NotTo(HaveOccurred())
@ -429,7 +431,7 @@ var _ = Describe("RedisTimeseries commands", Label("timeseries"), func() {
Expect(resultRange[0]).To(BeEquivalentTo(redis.TSTimestampValue{Timestamp: 22, Value: 1}))
})
It("should TSRange, TSRangeWithArgs", Label("timeseries", "tsrange", "tsrangeWithArgs"), func() {
It("should TSRange, TSRangeWithArgs", Label("timeseries", "tsrange", "tsrangeWithArgs", "NonRedisEnterprise"), func() {
for i := 0; i < 100; i++ {
_, err := client.TSAdd(ctx, "a", i, float64(i%7)).Result()
Expect(err).NotTo(HaveOccurred())
@ -541,7 +543,7 @@ var _ = Describe("RedisTimeseries commands", Label("timeseries"), func() {
Expect(len(resultRange)).To(BeEquivalentTo(7))
})
It("should TSRevRange, TSRevRangeWithArgs", Label("timeseries", "tsrevrange", "tsrevrangeWithArgs"), func() {
It("should TSRevRange, TSRevRangeWithArgs", Label("timeseries", "tsrevrange", "tsrevrangeWithArgs", "NonRedisEnterprise"), func() {
for i := 0; i < 100; i++ {
_, err := client.TSAdd(ctx, "a", i, float64(i%7)).Result()
Expect(err).NotTo(HaveOccurred())
@ -755,7 +757,7 @@ var _ = Describe("RedisTimeseries commands", Label("timeseries"), func() {
Expect(result["a"][2]).To(BeEquivalentTo([]interface{}{[]interface{}{int64(0), 5.0}, []interface{}{int64(5), 6.0}}))
})
It("should TSMRangeWithArgs Latest", Label("timeseries", "tsmrangeWithArgs", "tsmrangelatest"), func() {
It("should TSMRangeWithArgs Latest", Label("timeseries", "tsmrangeWithArgs", "tsmrangelatest", "NonRedisEnterprise"), func() {
resultCreate, err := client.TSCreate(ctx, "a").Result()
Expect(err).NotTo(HaveOccurred())
Expect(resultCreate).To(BeEquivalentTo("OK"))
@ -888,7 +890,7 @@ var _ = Describe("RedisTimeseries commands", Label("timeseries"), func() {
Expect(result["a"][2]).To(BeEquivalentTo([]interface{}{[]interface{}{int64(1), 10.0}, []interface{}{int64(0), 1.0}}))
})
It("should TSMRevRangeWithArgs Latest", Label("timeseries", "tsmrevrangeWithArgs", "tsmrevrangelatest"), func() {
It("should TSMRevRangeWithArgs Latest", Label("timeseries", "tsmrevrangeWithArgs", "tsmrevrangelatest", "NonRedisEnterprise"), func() {
resultCreate, err := client.TSCreate(ctx, "a").Result()
Expect(err).NotTo(HaveOccurred())
Expect(resultCreate).To(BeEquivalentTo("OK"))

View File

@ -64,7 +64,7 @@ var _ = Describe("Tx", func() {
Expect(n).To(Equal(int64(100)))
})
It("should discard", func() {
It("should discard", Label("NonRedisEnterprise"), func() {
err := client.Watch(ctx, func(tx *redis.Tx) error {
cmds, err := tx.TxPipelined(ctx, func(pipe redis.Pipeliner) error {
pipe.Set(ctx, "key1", "hello1", 0)

View File

@ -32,7 +32,7 @@ var _ = Describe("UniversalClient", func() {
Expect(client.Ping(ctx).Err()).NotTo(HaveOccurred())
})
It("should connect to clusters", func() {
It("should connect to clusters", Label("NonRedisEnterprise"), func() {
client = redis.NewUniversalClient(&redis.UniversalOptions{
Addrs: cluster.addrs(),
})