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

Function TestEmbeddedClient_DMap_LockWithTimeout_Timeout

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

Source from the content-addressed store, hash-verified

433}
434
435func TestEmbeddedClient_DMap_LockWithTimeout_Timeout(t *testing.T) {
436 cluster := newTestOlricCluster(t)
437 db := cluster.addMember(t)
438
439 e := db.NewEmbeddedClient()
440 dm, err := e.NewDMap("mydmap")
441 require.NoError(t, err)
442
443 ctx := context.Background()
444 key := "lock.key.test"
445
446 lx, err := dm.LockWithTimeout(ctx, key, time.Millisecond, time.Second)
447 require.NoError(t, err)
448
449 <-time.After(2 * time.Millisecond)
450
451 err = lx.Unlock(ctx)
452 require.ErrorIs(t, err, ErrNoSuchLock)
453}
454
455func TestEmbeddedClient_DMap_LockWithTimeout_ErrLockNotAcquired(t *testing.T) {
456 cluster := newTestOlricCluster(t)

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected