(t *testing.T, test func(t *testing.T, db *DB))
| 102 | } |
| 103 | |
| 104 | func runNutsDBTestWithWatch(t *testing.T, test func(t *testing.T, db *DB)) { |
| 105 | option := DefaultOptions |
| 106 | option.EnableWatch = true |
| 107 | |
| 108 | //actively close the watch manager, to cancel the watcher |
| 109 | testWithCloseWatchManager := func(t *testing.T, db *DB) { |
| 110 | test(t, db) |
| 111 | if !db.IsClose() && db.watchMgr != nil && !db.watchMgr.isClosed() { |
| 112 | require.NoError(t, db.watchMgr.close()) |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | runNutsDBTest(t, &option, testWithCloseWatchManager) |
| 117 | } |
| 118 | |
| 119 | func txPut(t *testing.T, db *DB, bucket string, key, value []byte, ttl uint32, expectErr error, finalExpectErr error) { |
| 120 | err := db.Update(func(tx *Tx) error { |
no test coverage detected