MCPcopy Create free account
hub / github.com/astercloud/aster / TestInMemoryStore_Close

Function TestInMemoryStore_Close

pkg/memory/logic/store_test.go:357–378  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

355}
356
357func TestInMemoryStore_Close(t *testing.T) {
358 store := NewInMemoryStore()
359
360 ctx := context.Background()
361 require.NoError(t, store.Save(ctx, &LogicMemory{
362 Namespace: "user:123",
363 Key: "test",
364 }))
365
366 // 关闭存储
367 require.NoError(t, store.Close())
368
369 // 所有操作应该返回 ErrStoreClosed
370 _, err := store.Get(ctx, "user:123", "test")
371 assert.ErrorIs(t, err, ErrStoreClosed)
372
373 err = store.Save(ctx, &LogicMemory{})
374 assert.ErrorIs(t, err, ErrStoreClosed)
375
376 _, err = store.List(ctx, "user:123")
377 assert.ErrorIs(t, err, ErrStoreClosed)
378}
379
380func TestInMemoryStore_InvalidNamespace(t *testing.T) {
381 store := NewInMemoryStore()

Callers

nothing calls this directly

Calls 5

SaveMethod · 0.95
CloseMethod · 0.95
GetMethod · 0.95
ListMethod · 0.95
NewInMemoryStoreFunction · 0.70

Tested by

no test coverage detected