test_helpers

package
v0.0.0-...-fdc8e6b Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func AddSortedString

func AddSortedString(insertFunc func(string, time.Duration), iterationCount int) []string

func DebugInsert

func DebugInsert(cache cache.Cache) func(string, time.Duration)

Using the cache.Cache Insert function, create a dynamic []byte value for the AddSortedString

func DebugInsertTTL

func DebugInsertTTL(cache cache.Cache) func(string, time.Duration)

Using the cache.Cache InsertTTL function, create a dynamic []byte value for the AddSortedString

func InsertAndRetrieve

func InsertAndRetrieve(cacheTester CacheTester)

func InsertTTLAndExpiry

func InsertTTLAndExpiry(cacheTester CacheTester)

func InsertTTLAndFlush

func InsertTTLAndFlush(cacheTester CacheTester)

func InsertTTLAndRemove

func InsertTTLAndRemove(cacheTester CacheTester)

func InsertTTLAndRetrieve

func InsertTTLAndRetrieve(cacheTester CacheTester)

func InsertTTLAndTTLCheck

func InsertTTLAndTTLCheck(cacheTester CacheTester)

func LRUInsertTTLAndRetrieve

func LRUInsertTTLAndRetrieve(cacheTester CacheTester) []string

LRU size should be same as Iterations

func TimeUTC

func TimeUTC() time.Time

Mocked time (which isn't epoch as that's special)

Types

type CacheTester

type CacheTester struct {
	Tester        *testing.T
	Cache         cache.Cache
	RemoveExpired func()
	Clock         *MockClock
	Iterations    int
}

func (*CacheTester) RetrieveDeletedKey

func (ct *CacheTester) RetrieveDeletedKey(i int, key string)

func (*CacheTester) RetrieveKey

func (ct *CacheTester) RetrieveKey(i int, key string)

type MockClock

type MockClock struct {
	// contains filtered or unexported fields
}

func MockedUTC

func MockedUTC() *MockClock

func (*MockClock) Add

func (m *MockClock) Add(t time.Duration)

func (*MockClock) Now

func (m *MockClock) Now() time.Time

Jump to

Keyboard shortcuts

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