suites

package
v0.62.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

README

Suits

Base

Base suite for every tests. It gives you your own test folder s.DataDir, that will not intersect with another tests, also clears it before and after test automatically

It also can have env, but it isn't required: you can pass nil env and it will work

Bench

Base suite for benchs. Sadly, testify doesn't have bench support, so there is our own implementation. See the code for how to include it correctly

Single

Suite for simple tests with one ingestor and one store with default configs

In the beginning of the test you already have ingestor and store started, and you can get them as s.Store/s.Ingestor

There are also some convinient functions as

  • s.Bulk: convinient way to bulk
  • s.Search/s.SearchDocs: convinient way to search
  • s.AssertDocsEqual/s.AssertSearch: asserts, that foundDocs equal to docs from originalDocs with indexes indexes (see tests for examples)
  • s.RunFracEnvs: runs function several times:
    • Active: just runs (implying that there is active fraction)
    • Sealed: seals, and then runs
    • Restarted: restarts store and then runs. This also seals, because we seal on restart
  • s.RestartStore/s.RestartIngestor: (re)starts store/ingestor
  • Feel free to add your own

Documentation

Index

Constants

This section is empty.

Variables

Functions

func RunBench

func RunBench(b *testing.B, s Bencher)

func SingleEnvs

func SingleEnvs() []*setup.TestingEnvConfig

Types

type Base

type Base struct {
	suite.Suite

	SuiteName string
	DataDir   string

	// can be nil, if tests don't require env
	Config *setup.TestingEnvConfig
}

func NewBase

func NewBase(config *setup.TestingEnvConfig) *Base

func (*Base) AfterTest

func (s *Base) AfterTest(_, _ string)

func (*Base) BeforeTest

func (s *Base) BeforeTest(suiteName, testName string)

func (*Base) RecreateDataDir

func (s *Base) RecreateDataDir()

func (*Base) TearDownSuite

func (s *Base) TearDownSuite()

type Bench

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

func (*Bench) B

func (s *Bench) B() *testing.B

func (*Bench) RunBench

func (s *Bench) RunBench(name string, bench func())

func (*Bench) SetB

func (s *Bench) SetB(b *testing.B)

type Bencher

type Bencher interface {
	B() *testing.B
	SetB(b *testing.B)
}

type FractionEnv

type FractionEnv int
const (
	ActiveEnv FractionEnv = iota
	SealedEnv
	RestartedEnv
)

type Single

type Single struct {
	Base
	Env *setup.TestingEnv
}

Single suite for testing with 1 ingestor and 1 store

func NewSingle

func NewSingle(cfg *setup.TestingEnvConfig) *Single

func (*Single) AfterTest

func (s *Single) AfterTest(suiteName, testName string)

func (*Single) AssertDocsEqual

func (s *Single) AssertDocsEqual(originalDocs []string, indexes []int, foundDocs []string)

func (*Single) AssertSearch

func (s *Single) AssertSearch(query string, originalDocs []string, indexes []int)

func (*Single) BeforeTest

func (s *Single) BeforeTest(suiteName, testName string)

func (*Single) Bulk

func (s *Single) Bulk(docs []string)

func (*Single) Ingestor

func (s *Single) Ingestor() *setup.Ingestor

func (*Single) Restart

func (s *Single) Restart()

func (*Single) RestartIngestor

func (s *Single) RestartIngestor()

func (*Single) RunFracEnvs

func (s *Single) RunFracEnvs(envs map[FractionEnv]bool, stopOnFail bool, f func())

func (*Single) SearchDocs

func (s *Single) SearchDocs(query string, size int, order seq.DocsOrder) []string

func (*Single) Store

func (s *Single) Store() *storeapi.Store

Jump to

Keyboard shortcuts

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