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

Function TestDB_Close_ErrorHandling

db_test.go:1315–1331  ·  view source on GitHub ↗

TestDB_Close_ErrorHandling tests error handling during component shutdown

(t *testing.T)

Source from the content-addressed store, hash-verified

1313
1314// TestDB_Close_ErrorHandling tests error handling during component shutdown
1315func TestDB_Close_ErrorHandling(t *testing.T) {
1316 opts := DefaultOptions
1317 opts.Dir = filepath.Join(t.TempDir(), "test-close-errors")
1318 defer func() { _ = os.RemoveAll(opts.Dir) }()
1319
1320 db, err := Open(opts)
1321 require.NoError(t, err)
1322 require.NotNil(t, db)
1323
1324 // Close should handle errors gracefully and continue shutting down other components
1325 err = db.Close()
1326 require.NoError(t, err)
1327
1328 // Even if there were errors, database should be in closed state
1329 require.True(t, db.IsClose())
1330 require.True(t, db.statusMgr.isClosed())
1331}
1332
1333func TestDB_ErrThenReadWrite(t *testing.T) {
1334 runNutsDBTest(t, nil, func(t *testing.T, db *DB) {

Callers

nothing calls this directly

Calls 4

OpenFunction · 0.85
IsCloseMethod · 0.80
CloseMethod · 0.65
isClosedMethod · 0.45

Tested by

no test coverage detected