@@ -20,8 +20,10 @@ import (
2020 "testing"
2121 "time"
2222
23- "github.com/olric-data/olric/internal/testutil "
23+ "github.com/redis/go-redis/v9 "
2424 "github.com/stretchr/testify/require"
25+
26+ "github.com/olric-data/olric/internal/testutil"
2527)
2628
2729func TestDMapPipeline_Put (t * testing.T ) {
@@ -107,6 +109,25 @@ func TestDMapPipeline_Get(t *testing.T) {
107109 }
108110}
109111
112+ func TestFutureGet_Result_NilPipelineValue (t * testing.T ) {
113+ cmd := redis .NewCmd (context .Background (), "dm.get" , "mydmap" , "missing" , "RW" )
114+ cmd .SetVal (nil )
115+
116+ ctx , cancel := context .WithCancel (context .Background ())
117+ cancel ()
118+ future := & FutureGet {
119+ dp : & DMapPipeline {
120+ result : map [uint64 ][]redis.Cmder {0 : {cmd }},
121+ },
122+ ctx : ctx ,
123+ closedCtx : context .Background (),
124+ }
125+
126+ res , err := future .Result ()
127+ require .Nil (t , res )
128+ require .ErrorIs (t , err , ErrKeyNotFound )
129+ }
130+
110131func TestDMapPipeline_Delete (t * testing.T ) {
111132 cluster := newTestOlricCluster (t )
112133 db := cluster .addMember (t )
@@ -293,6 +314,25 @@ func TestDMapPipeline_GetPut(t *testing.T) {
293314 }
294315}
295316
317+ func TestFutureGetPut_Result_NilPipelineValue (t * testing.T ) {
318+ cmd := redis .NewCmd (context .Background (), "dm.getput" , "mydmap" , "key" , "value" , "RW" )
319+ cmd .SetVal (nil )
320+
321+ ctx , cancel := context .WithCancel (context .Background ())
322+ cancel ()
323+ future := & FutureGetPut {
324+ dp : & DMapPipeline {
325+ result : map [uint64 ][]redis.Cmder {0 : {cmd }},
326+ },
327+ ctx : ctx ,
328+ closedCtx : context .Background (),
329+ }
330+
331+ res , err := future .Result ()
332+ require .NoError (t , err )
333+ require .Nil (t , res )
334+ }
335+
296336func TestDMapPipeline_IncrByFloat (t * testing.T ) {
297337 cluster := newTestOlricCluster (t )
298338 db := cluster .addMember (t )
0 commit comments