test

package module
v0.0.0-...-402a48f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package test contains functions for testing `gokv.Store` implementations.

The functions are called from the actual test functions of all `gokv.Store` implementations in https://gfx.cafe/open/gokv. If you create your own implementation, you can and probably should use these functions to test your implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InteractWithStore

func InteractWithStore(store gokv.Store, key string, t *testing.T, waitGroup *sync.WaitGroup)

InteractWithStore reads from and writes to the DB. Meant to be executed in a goroutine. Does NOT check if the DB works correctly (that's done elsewhere), only checks for errors that might occur due to concurrent access.

func TestConcurrentInteractions

func TestConcurrentInteractions(t *testing.T, goroutineCount int, store gokv.Store)

TestConcurrentInteractions launches a bunch of goroutines that concurrently work with the store.

func TestStore

func TestStore(store gokv.Store, t *testing.T)

TestStore tests if reading from, writing to and deleting from the store works properly. A struct is used as value. See TestTypes() for a test that is simpler but tests all types.

func TestTypes

func TestTypes(store gokv.Store, t *testing.T)

TestTypes tests if setting and getting values works with all Go types.

Types

type Foo

type Foo struct {
	Bar string
	// contains filtered or unexported fields
}

Foo is just some struct for common tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL