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

Function TestClusterClient_LockWithTimeout

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

Source from the content-addressed store, hash-verified

432}
433
434func TestClusterClient_LockWithTimeout(t *testing.T) {
435 cluster := newTestOlricCluster(t)
436 db := cluster.addMember(t)
437
438 ctx := context.Background()
439 c, err := NewClusterClient([]string{db.name})
440 require.NoError(t, err)
441 defer func() {
442 require.NoError(t, c.Close(ctx))
443 }()
444
445 dm, err := c.NewDMap("mydmap")
446 require.NoError(t, err)
447
448 lx, err := dm.LockWithTimeout(ctx, "lock.foo.key", time.Hour, time.Second)
449 require.NoError(t, err)
450
451 err = lx.Unlock(ctx)
452 require.NoError(t, err)
453}
454
455func TestClusterClient_LockWithTimeout_ErrNoSuchLock(t *testing.T) {
456 cluster := newTestOlricCluster(t)

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected