LindaSummer commented on code in PR #3296:
URL: https://github.com/apache/kvrocks/pull/3296#discussion_r2631217771


##########
tests/gocase/unit/type/tdigest/tdigest_test.go:
##########
@@ -54,17 +55,42 @@ type tdigestInfo struct {
 }
 
 func toTdigestInfo(t *testing.T, value interface{}) tdigestInfo {
-       require.IsType(t, map[interface{}]interface{}{}, value)
-       v := value.(map[interface{}]interface{})
-       return tdigestInfo{
-               Compression:       v["Compression"].(int64),
-               Capacity:          v["Capacity"].(int64),
-               MergedNodes:       v["Merged nodes"].(int64),
-               UnmergedNodes:     v["Unmerged nodes"].(int64),
-               MergedWeight:      v["Merged weight"].(int64),
-               UnmergedWeight:    v["Unmerged weight"].(int64),
-               Observations:      v["Observations"].(int64),
-               TotalCompressions: v["Total compressions"].(int64),
+       // Handle both RESP2 (map) and RESP3 (array) formats
+       switch v := value.(type) {
+       case map[interface{}]interface{}:

Review Comment:
   This seems a little tricky, we'd better pass a parameter explicitly. Or we 
could provide two versions and let the test case choose which version should 
use.



-- 
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