MCPcopy
hub / github.com/olric-data/olric / TestClusterClient_Put_PXAT

Function TestClusterClient_Put_PXAT

cluster_client_test.go:595–616  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

593}
594
595func TestClusterClient_Put_PXAT(t *testing.T) {
596 cluster := newTestOlricCluster(t)
597 db := cluster.addMember(t)
598
599 ctx := context.Background()
600 c, err := NewClusterClient([]string{db.name})
601 require.NoError(t, err)
602 defer func() {
603 require.NoError(t, c.Close(ctx))
604 }()
605
606 dm, err := c.NewDMap("mydmap")
607 require.NoError(t, err)
608
609 err = dm.Put(ctx, "mykey", "myvalue", PXAT(time.Duration(time.Now().Add(time.Millisecond).UnixNano())))
610 require.NoError(t, err)
611
612 <-time.After(time.Millisecond)
613
614 _, err = dm.Get(ctx, "mykey")
615 require.ErrorIs(t, err, ErrKeyNotFound)
616}
617
618func TestClusterClient_Put_NX(t *testing.T) {
619 cluster := newTestOlricCluster(t)

Callers

nothing calls this directly

Calls 10

CloseMethod · 0.95
NewDMapMethod · 0.95
PutMethod · 0.95
GetMethod · 0.95
newTestOlricClusterFunction · 0.85
NewClusterClientFunction · 0.85
PXATFunction · 0.85
addMemberMethod · 0.80
DurationMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected