MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / TestTransactionManager_RejectTxWhenNotRunning

Function TestTransactionManager_RejectTxWhenNotRunning

tx_manager_test.go:183–200  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

181}
182
183func TestTransactionManager_RejectTxWhenNotRunning(t *testing.T) {
184 db := &DB{}
185 sm := NewStatusManager(DefaultStatusManagerConfig())
186 defer func() { _ = sm.Close() }()
187
188 if err := sm.Start(); err != nil {
189 t.Fatalf("Failed to start StatusManager: %v", err)
190 }
191
192 tm := newTxManager(db, sm)
193
194 tx := &Tx{id: 1, db: db}
195 if err := tm.RegisterTx(tx); err != nil {
196 t.Errorf("RegisterTx should work even when TransactionManager is not running (only checks StatusManager), got: %v", err)
197 }
198
199 tm.UnregisterTx(tx.id)
200}
201
202func TestTransactionManager_WaitForActiveTxs(t *testing.T) {
203 db := &DB{}

Callers

nothing calls this directly

Calls 7

CloseMethod · 0.95
StartMethod · 0.95
NewStatusManagerFunction · 0.85
newTxManagerFunction · 0.85
RegisterTxMethod · 0.80
UnregisterTxMethod · 0.80

Tested by

no test coverage detected