package btesting
import "go.etcd.io/bbolt/internal/btesting"
Index ¶
- Constants
- type DB
- func MustCreateDB(t testing.TB) *DB
- func MustCreateDBWithOption(t testing.TB, o *bolt.Options) *DB
- func MustOpenDBWithOption(t testing.TB, f string, o *bolt.Options) *DB
- func (db *DB) Close() error
- func (db *DB) CopyTempFile()
- func (db *DB) Fill(bucket []byte, numTx int, numKeysPerTx int, keyGen func(tx int, key int) []byte, valueGen func(tx int, key int) []byte) error
- func (db *DB) ForceDisableStrictMode()
- func (db *DB) MustCheck()
- func (db *DB) MustClose()
- func (db *DB) MustDeleteFile()
- func (db *DB) MustReopen()
- func (db *DB) Path() string
- func (db *DB) PostTestCleanup()
- func (db *DB) PrintStats()
- func (db *DB) SetOptions(o *bolt.Options)
Constants ¶
const ( // TestFreelistType is used as an env variable for test to indicate the backend type. TestFreelistType = "TEST_FREELIST_TYPE" // TestEnableStrictMode is used to enable strict check by default after opening each DB. TestEnableStrictMode = "TEST_ENABLE_STRICT_MODE" )
Types ¶
type DB ¶
DB is a test wrapper for bolt.DB.
func MustCreateDB ¶
MustCreateDB returns a new, open DB at a temporary location.
func MustCreateDBWithOption ¶
MustCreateDBWithOption returns a new, open DB at a temporary location with given options.
func MustOpenDBWithOption ¶
func (*DB) Close ¶
Close closes the database but does NOT delete the underlying file.
func (*DB) CopyTempFile ¶
func (db *DB) CopyTempFile()
CopyTempFile copies a database to a temporary file.
func (*DB) Fill ¶
func (db *DB) Fill(bucket []byte, numTx int, numKeysPerTx int, keyGen func(tx int, key int) []byte, valueGen func(tx int, key int) []byte) error
Fill - fills the DB using numTx transactions and numKeysPerTx.
func (*DB) ForceDisableStrictMode ¶
func (db *DB) ForceDisableStrictMode()
func (*DB) MustCheck ¶
func (db *DB) MustCheck()
MustCheck runs a consistency check on the database and panics if any errors are found.
func (*DB) MustClose ¶
func (db *DB) MustClose()
MustClose closes the database but does NOT delete the underlying file.
func (*DB) MustDeleteFile ¶
func (db *DB) MustDeleteFile()
func (*DB) MustReopen ¶
func (db *DB) MustReopen()
MustReopen reopen the database. Panic on error.
func (*DB) Path ¶
func (*DB) PostTestCleanup ¶
func (db *DB) PostTestCleanup()
func (*DB) PrintStats ¶
func (db *DB) PrintStats()
PrintStats prints the database stats
func (*DB) SetOptions ¶
Source Files ¶
btesting.go
- Version
- v1.4.0 (latest)
- Published
- Feb 5, 2025
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 3 hours ago –
Tools for package owners.