MCPcopy
hub / github.com/dgraph-io/badger / runBadgerTest

Function runBadgerTest

db_test.go:115–137  ·  view source on GitHub ↗

Opens a badger db and runs a a test on it.

(t *testing.T, opts *Options, test func(t *testing.T, db *DB))

Source from the content-addressed store, hash-verified

113
114// Opens a badger db and runs a a test on it.
115func runBadgerTest(t *testing.T, opts *Options, test func(t *testing.T, db *DB)) {
116 dir, err := ioutil.TempDir("", "badger-test")
117 require.NoError(t, err)
118 defer removeDir(dir)
119 if opts == nil {
120 opts = new(Options)
121 *opts = getTestOptions(dir)
122 } else {
123 opts.Dir = dir
124 opts.ValueDir = dir
125 }
126
127 if opts.InMemory {
128 opts.Dir = ""
129 opts.ValueDir = ""
130 }
131 db, err := Open(*opts)
132 require.NoError(t, err)
133 defer func() {
134 require.NoError(t, db.Close())
135 }()
136 test(t, db)
137}
138
139func TestWrite(t *testing.T) {
140 runBadgerTest(t, nil, func(t *testing.T, db *DB) {

Callers 15

TestWriteBatchFunction · 0.85
TestEmptyWriteBatchFunction · 0.85
TestIteratePrefixFunction · 0.85
TestWriteBatchManagedFunction · 0.85
TestWriteBatchDuplicateFunction · 0.85
TestWriteFunction · 0.85
TestUpdateAndViewFunction · 0.85
TestConcurrentWriteFunction · 0.85
TestGetFunction · 0.85
TestGetAfterDeleteFunction · 0.85
TestTxnTooBigFunction · 0.85

Calls 4

removeDirFunction · 0.85
getTestOptionsFunction · 0.85
OpenFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…