MCPcopy Create free account
hub / github.com/Shopify/goose / Test_lockMap_Wait

Function Test_lockMap_Wait

lockmap/map_test.go:85–99  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

83}
84
85func Test_lockMap_Wait(t *testing.T) {
86 m := newMap(sweepInterval)
87 promise, gotLock := m.WaitOrLock(1, ttl)
88 assert.True(t, gotLock)
89
90 stored := m.Wait(1)
91 assert.Equal(t, promise, stored)
92
93 <-time.After(ttl)
94
95 stored = m.Wait(1)
96 assert.Nil(t, stored)
97
98 assertResolved(promise)
99}
100
101func Test_lockMap_WaitOrLock(t *testing.T) {
102 m := newMap(sweepInterval)

Callers

nothing calls this directly

Calls 4

newMapFunction · 0.85
assertResolvedFunction · 0.85
WaitOrLockMethod · 0.65
WaitMethod · 0.65

Tested by

no test coverage detected