MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestQuery_FindAll_Break_Closed

Function TestQuery_FindAll_Break_Closed

internal/utils/kvstore/query_test.go:72–99  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

70}
71
72func TestQuery_FindAll_Break_Closed(t *testing.T) {
73 var table = testOpenStoreTable[*testCachedItem](t, "cache_items", &testCacheItemEncoder[*testCachedItem]{})
74
75 defer func() {
76 _ = testingStore.Close()
77 }()
78
79 var before = time.Now()
80 defer func() {
81 t.Log("cost:", time.Since(before).Seconds()*1000, "ms")
82 }()
83
84 var count int
85 err := table.
86 Query().
87 FindAll(func(tx *kvstore.Tx[*testCachedItem], item kvstore.Item[*testCachedItem]) (goNext bool, err error) {
88 t.Log("key:", item.Key, "value:", item.Value)
89 count++
90
91 if count > 2 {
92 // break test
93 _ = table.DB().Store().Close()
94 }
95
96 return count < 3, nil
97 })
98 t.Log("expected error:", err)
99}
100
101func TestQuery_FindAll_Desc(t *testing.T) {
102 var table = testOpenStoreTable[*testCachedItem](t, "cache_items", &testCacheItemEncoder[*testCachedItem]{})

Callers

nothing calls this directly

Calls 6

LogMethod · 0.80
FindAllMethod · 0.80
StoreMethod · 0.80
DBMethod · 0.80
CloseMethod · 0.65
QueryMethod · 0.45

Tested by

no test coverage detected