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

Function TestClusterClient_Lock_Unlock

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

Source from the content-addressed store, hash-verified

364}
365
366func TestClusterClient_Lock_Unlock(t *testing.T) {
367 cluster := newTestOlricCluster(t)
368 db := cluster.addMember(t)
369
370 ctx := context.Background()
371 c, err := NewClusterClient([]string{db.name})
372 require.NoError(t, err)
373 defer func() {
374 require.NoError(t, c.Close(ctx))
375 }()
376
377 dm, err := c.NewDMap("mydmap")
378 require.NoError(t, err)
379
380 lx, err := dm.Lock(ctx, "lock.foo.key", time.Second)
381 require.NoError(t, err)
382
383 err = lx.Unlock(ctx)
384 require.NoError(t, err)
385}
386
387func TestClusterClient_Lock_Lease(t *testing.T) {
388 cluster := newTestOlricCluster(t)

Callers

nothing calls this directly

Calls 7

CloseMethod · 0.95
NewDMapMethod · 0.95
LockMethod · 0.95
newTestOlricClusterFunction · 0.85
NewClusterClientFunction · 0.85
addMemberMethod · 0.80
UnlockMethod · 0.65

Tested by

no test coverage detected