MCPcopy Create free account
hub / github.com/devfeel/dotweb / TestRuntimeStore_SessionAccess

Function TestRuntimeStore_SessionAccess

session/store_runtime_test.go:159–185  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

157}
158
159func TestRuntimeStore_SessionAccess(t *testing.T) {
160 // Use a separate store for this test to avoid race conditions
161 testStore := NewRuntimeStore(NewDefaultRuntimeConfig())
162 testValue := make(map[interface{}]interface{})
163 testValue["foo"] = "bar"
164
165 testStore.SessionUpdate(NewSessionState(testStore, "test_access_session", testValue))
166
167 // Get initial state
168 state, _ := testStore.SessionRead("test_access_session")
169 if state == nil {
170 t.Fatal("Failed to read session")
171 }
172
173 // SessionAccess should update timeAccessed
174 // Note: We don't directly access timeAccessed to avoid race conditions
175 // Instead we verify the operation completes without error
176 err := testStore.SessionAccess("test_access_session")
177 if err != nil {
178 t.Errorf("SessionAccess failed: %v", err)
179 }
180
181 // Verify session still exists after access
182 if !testStore.SessionExist("test_access_session") {
183 t.Error("Session should still exist after access")
184 }
185}
186
187/**
188性能测试 | 基准测试

Callers

nothing calls this directly

Calls 8

SessionUpdateMethod · 0.95
SessionReadMethod · 0.95
SessionAccessMethod · 0.95
SessionExistMethod · 0.95
NewRuntimeStoreFunction · 0.85
NewDefaultRuntimeConfigFunction · 0.85
NewSessionStateFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected