torwig commented on code in PR #1502:
URL: 
https://github.com/apache/incubator-kvrocks/pull/1502#discussion_r1233867663


##########
tests/gocase/unit/type/zset/zset_test.go:
##########
@@ -956,6 +956,50 @@ func basicTests(t *testing.T, rdb *redis.Client, ctx 
context.Context, encoding s
                require.Equal(t, []redis.Z{{1, "a"}, {2, "b"}, {3, "c"}, {3, 
"d"}}, rdb.ZRangeWithScores(ctx, "zsetc", 0, -1).Val())
        })
 
+       t.Run(fmt.Sprintf("ZUNION basics - %s", encoding), func(t *testing.T) {
+               rdb.Del(ctx, "zseta", "zsetb", "zsetc")
+               rdb.ZAdd(ctx, "zseta", redis.Z{Score: 1, Member: "a"})
+               rdb.ZAdd(ctx, "zseta", redis.Z{Score: 2, Member: "b"})
+               rdb.ZAdd(ctx, "zseta", redis.Z{Score: 3, Member: "c"})
+               rdb.ZAdd(ctx, "zsetb", redis.Z{Score: 1, Member: "b"})
+               rdb.ZAdd(ctx, "zsetb", redis.Z{Score: 2, Member: "c"})
+               rdb.ZAdd(ctx, "zsetb", redis.Z{Score: 3, Member: "d"})
+
+               zsetInt := []redis.Z{
+                       {1, "a"},
+                       {3, "b"},
+                       {3, "d"},
+                       {5, "c"}}
+               require.Equal(t, zsetInt, rdb.ZUnionWithScores(ctx, 
redis.ZStore{Keys: []string{"zseta", "zsetb"}}).Val())
+       })
+
+       t.Run(fmt.Sprintf("ZUNION with weights - %s", encoding), func(t 
*testing.T) {
+               zsetInt := []redis.Z{

Review Comment:
   I wouldn't recommend relying on the order of test execution. Instead, delete 
the keys you need at the beginning of the test, populate those keys with values 
and then test required assertions. In this particular case, if you need sorted 
sets defined in another test, you can extract dedicated functions that will 
prepare the sorted sets for you. 
   On top of that, you can check the `createZset` functions in this file and 
use it at the beginning of each (if needed) test. This function does exactly 
what I described.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to