MCPcopy
hub / github.com/gofiber/fiber / Test_Storage_Memory_GetWithContext

Function Test_Storage_Memory_GetWithContext

internal/storage/memory/memory_test.go:86–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

84}
85
86func Test_Storage_Memory_GetWithContext(t *testing.T) {
87 t.Parallel()
88 var (
89 testStore = New()
90 key = "john"
91 val = []byte("doe")
92 )
93
94 err := testStore.Set(key, val, 0)
95 require.NoError(t, err)
96
97 ctx, cancel := context.WithCancel(context.Background())
98 cancel()
99
100 result, err := testStore.GetWithContext(ctx, key)
101 require.ErrorIs(t, err, context.Canceled)
102 require.Nil(t, result)
103
104 keys, err := testStore.Keys()
105 require.NoError(t, err)
106 require.Len(t, keys, 1)
107}
108
109func Test_Storage_Memory_Set_Expiration(t *testing.T) {
110 t.Parallel()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.70
SetMethod · 0.65
GetWithContextMethod · 0.65
LenMethod · 0.65
KeysMethod · 0.45

Tested by

no test coverage detected