Documentation
¶
Overview ¶
Package dbtest contains tests for DBs. Implementation under test is pluggable.
Index ¶
- func TestDelete(t *testing.T, oldValue, newValue Value, ...)
- func TestGet(t *testing.T, oldValue, newValue Value, ...)
- func TestHistory(t *testing.T, oldValue, newValue Value, ...)
- func TestList(t *testing.T, oldValue, newValue Value, ...)
- func TestSet(t *testing.T, dbFn func(kvs []*VersionedKV, clock Clock) (DB, error))
- func WriteOutputHistory(t *testing.T, db DB, keys []string, testName string)
- type TestClock
- type TestOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestDelete ¶
func TestDelete(t *testing.T, oldValue, newValue Value, dbFn func(kvs []*VersionedKV, clock Clock) (db DB, closeFn func(), err error))
TestDelete tests the Delete function. dbFn must return a DB under test with the VersionedKV's stored in the database and set transaction times provided by the clock. It must also return a function to close the DB after the test is complete.
func TestGet ¶
func TestGet(t *testing.T, oldValue, newValue Value, dbFn func(kvs []*VersionedKV) (db DB, closeFn func(), err error))
TestGet tests the Get function. dbFn must return a DB under test with the VersionedKV's stored in the database and a function to close the DB after the test is complete.
func TestHistory ¶
func TestHistory(t *testing.T, oldValue, newValue Value, dbFn func(kvs []*VersionedKV) (db DB, closeFn func(), err error))
TestHistory tests the History function. dbFn must return a DB under test with the VersionedKV's stored in the database and a function to close the DB after the test is complete.
func TestList ¶
func TestList(t *testing.T, oldValue, newValue Value, dbFn func(kvs []*VersionedKV) (db DB, closeFn func(), err error))
TestList tests the List function. dbFn must return a DB under test with the VersionedKV's stored in the database and a function to close the DB after the test is complete.
Types ¶
type TestClock ¶
type TestClock struct {
// contains filtered or unexported fields
}
TestClock is a clock returns user-set times for testing. It enforces that new times being set must be monotonically increasing as a safeguard for correct tests.
type TestOutput ¶ added in v0.2.4
type TestOutput struct { TestName string Passed bool // true is test passed Histories map[string][]*VersionedKV // key -> history }
TestOutput is the format for saving test data for debugging and visualization.