MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / TestStringStructure_Get

Function TestStringStructure_Get

structure/string_test.go:23–44  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21}
22
23func TestStringStructure_Get(t *testing.T) {
24 str, _ := initdb()
25 defer str.db.Clean()
26
27 err = str.Set("1", randkv.RandomValue(100), 0)
28 assert.Nil(t, err)
29 err = str.Set("1", randkv.RandomValue(100), 2)
30 assert.Nil(t, err)
31
32 value1, err := str.Get("1")
33 assert.Nil(t, err)
34 assert.NotNil(t, value1)
35
36 time.Sleep(3 * time.Second)
37
38 value2, err := str.Get("1")
39 assert.Equal(t, err, _const.ErrKeyIsExpired)
40 assert.Nil(t, value2)
41
42 _, err = str.Get("3")
43 assert.Equal(t, err, _const.ErrKeyNotFound)
44}
45
46func TestStringStructure_Del(t *testing.T) {
47 str, _ := initdb()

Callers

nothing calls this directly

Calls 5

RandomValueFunction · 0.92
initdbFunction · 0.85
SetMethod · 0.65
GetMethod · 0.65
CleanMethod · 0.45

Tested by

no test coverage detected