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

Function TestEmbeddedClient_DMap_Lock_ErrNoSuchLock

embedded_client_test.go:396–415  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

394}
395
396func TestEmbeddedClient_DMap_Lock_ErrNoSuchLock(t *testing.T) {
397 cluster := newTestOlricCluster(t)
398 db := cluster.addMember(t)
399
400 e := db.NewEmbeddedClient()
401 dm, err := e.NewDMap("mydmap")
402 require.NoError(t, err)
403
404 ctx := context.Background()
405 key := "lock.key.test"
406
407 lx, err := dm.Lock(ctx, key, time.Second)
408 require.NoError(t, err)
409
410 err = lx.Unlock(ctx)
411 require.NoError(t, err)
412
413 err = lx.Unlock(ctx)
414 require.ErrorIs(t, err, ErrNoSuchLock)
415}
416
417func TestEmbeddedClient_DMap_LockWithTimeout(t *testing.T) {
418 cluster := newTestOlricCluster(t)

Callers

nothing calls this directly

Calls 6

NewDMapMethod · 0.95
LockMethod · 0.95
newTestOlricClusterFunction · 0.85
addMemberMethod · 0.80
NewEmbeddedClientMethod · 0.80
UnlockMethod · 0.65

Tested by

no test coverage detected