Documentation
¶
Index ¶
- func Bulk(t *testing.T, addr string, docs []string)
- func BulkBuffer(t *testing.T, addr string, b *bytes.Buffer)
- func DocsToStrings(docs []ExampleDoc) []string
- func FetchHTTP(t *testing.T, addr string, ids []string) []*seqproxyapi.Document
- func GenBuffer(docs []string) *bytes.Buffer
- func SearchHTTP(t *testing.T, addr string, request *seqproxyapi.SearchRequest) *seqproxyapi.SearchResponse
- type ExampleDoc
- type Ingestor
- type InlineJSON
- type SearchOption
- func NoFetch() SearchOption
- func WithAggQuery(aggQueries ...any) SearchOption
- func WithInterval(interval time.Duration) SearchOption
- func WithOffset(offset int) SearchOption
- func WithOffsetId(offsetId string) SearchOption
- func WithOrder(o seq.DocsOrder) SearchOption
- func WithTimeRange(from, to time.Time) SearchOption
- func WithTotal(f bool) SearchOption
- type Stores
- type TestingEnv
- func (t *TestingEnv) Fetch(ids []seq.ID) ([][]byte, error)
- func (t *TestingEnv) Ingestor() *Ingestor
- func (t *TestingEnv) IngestorAddr() string
- func (t *TestingEnv) IngestorBulkAddr() string
- func (t *TestingEnv) IngestorFetchAddr() string
- func (t *TestingEnv) IngestorSearchAddr() string
- func (t *TestingEnv) SealAll()
- func (t *TestingEnv) Search(q string, size int, options ...SearchOption) (*seq.QPR, [][]byte, time.Duration, error)
- func (t *TestingEnv) StopAll()
- func (t *TestingEnv) StopIngestor()
- func (t *TestingEnv) StopStore()
- func (t *TestingEnv) Store(hot bool) *storeapi.Store
- func (t *TestingEnv) WaitIdle()
- type TestingEnvConfig
- func (cfg *TestingEnvConfig) GetColdFactor() int
- func (cfg *TestingEnvConfig) GetColdStoresConfs() []storeapi.StoreConfig
- func (cfg *TestingEnvConfig) GetFracManagerConfig(replicaID string) fracmanager.Config
- func (cfg *TestingEnvConfig) GetHotFactor() int
- func (cfg *TestingEnvConfig) GetHotStoresConfs() []storeapi.StoreConfig
- func (cfg *TestingEnvConfig) GetStoreConfig(replicaID string, cold bool) storeapi.StoreConfig
- func (cfg *TestingEnvConfig) MakeStores(confs []storeapi.StoreConfig, replicas int, s3cli *seqs3.Client) (Stores, [][]string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DocsToStrings ¶
func DocsToStrings(docs []ExampleDoc) []string
func SearchHTTP ¶
func SearchHTTP(t *testing.T, addr string, request *seqproxyapi.SearchRequest) *seqproxyapi.SearchResponse
Types ¶
type ExampleDoc ¶
type ExampleDoc struct {
Service string `json:"service,omitempty"`
Message string `json:"message,omitempty"`
TraceID string `json:"traceID,omitempty"`
Source string `json:"source,omitempty"`
Zone string `json:"zone,omitempty"`
RequiestObject InlineJSON `json:"requestObject,omitempty"`
Level int `json:"level,omitempty"`
Timestamp time.Time `json:"timestamp,omitempty"`
}
ExampleDoc is useful for testing and benchmarking instead of hardcoding json docs in code, you can hardcode struct which will be turned in json
type Ingestor ¶
func MakeIngestors ¶
func MakeIngestors(cfg *TestingEnvConfig, hot, cold [][]string) []*Ingestor
type InlineJSON ¶
type InlineJSON string
InlineJSON is a string representing valid json similar as json.RawMessage, but it's a string
func (*InlineJSON) MarshalJSON ¶
func (j *InlineJSON) MarshalJSON() ([]byte, error)
func (*InlineJSON) UnmarshalJSON ¶
func (j *InlineJSON) UnmarshalJSON(v []byte) error
type SearchOption ¶
type SearchOption func(sr *search.SearchRequest)
func NoFetch ¶
func NoFetch() SearchOption
func WithAggQuery ¶
func WithAggQuery(aggQueries ...any) SearchOption
WithAggQuery adds aggregation query to search request. Aggregations parameters are passed as consequent strings of aggregation fields and filters: aggField1, aggFilter1, aggField2, aggFilter2, ..., aggFieldN, aggFilterN.
For example, if two aggregations without filters are needed, this function should be called with args: "agg1", "", "agg2".
If called with single empty string, no aggregation query is added.
func WithInterval ¶
func WithInterval(interval time.Duration) SearchOption
func WithOffset ¶
func WithOffset(offset int) SearchOption
func WithOffsetId ¶ added in v0.66.0
func WithOffsetId(offsetId string) SearchOption
func WithOrder ¶
func WithOrder(o seq.DocsOrder) SearchOption
func WithTimeRange ¶
func WithTimeRange(from, to time.Time) SearchOption
func WithTotal ¶
func WithTotal(f bool) SearchOption
type Stores ¶
func MakeStores ¶
func MakeStores(cfg *TestingEnvConfig, replicas int, cold bool) (Stores, [][]string)
func (Stores) CountInstances ¶
type TestingEnv ¶
type TestingEnv struct {
Ingestors []*Ingestor
HotStores Stores
ColdStores Stores
Config *TestingEnvConfig
// contains filtered or unexported fields
}
func NewTestingEnv ¶
func NewTestingEnv(cfg *TestingEnvConfig) *TestingEnv
func (*TestingEnv) Ingestor ¶
func (t *TestingEnv) Ingestor() *Ingestor
Ingestor returns "random" ingestor managed by TestingEnv but guarantees that each store will return at least once
func (*TestingEnv) IngestorAddr ¶
func (t *TestingEnv) IngestorAddr() string
func (*TestingEnv) IngestorBulkAddr ¶
func (t *TestingEnv) IngestorBulkAddr() string
IngestorBulkAddr returns "random" ingestor HTTP address but guarantees that each store will return at least once
func (*TestingEnv) IngestorFetchAddr ¶
func (t *TestingEnv) IngestorFetchAddr() string
func (*TestingEnv) IngestorSearchAddr ¶
func (t *TestingEnv) IngestorSearchAddr() string
IngestorSearchAddr returns "random" ingestor HTTP address but guarantees that each store will return at least once
func (*TestingEnv) SealAll ¶
func (t *TestingEnv) SealAll()
func (*TestingEnv) Search ¶
func (t *TestingEnv) Search(q string, size int, options ...SearchOption) (*seq.QPR, [][]byte, time.Duration, error)
func (*TestingEnv) StopAll ¶
func (t *TestingEnv) StopAll()
func (*TestingEnv) StopIngestor ¶
func (t *TestingEnv) StopIngestor()
func (*TestingEnv) StopStore ¶
func (t *TestingEnv) StopStore()
func (*TestingEnv) Store ¶
func (t *TestingEnv) Store(hot bool) *storeapi.Store
Store returns random store managed by TestingEnv but guarantees that each store will return at least once
func (*TestingEnv) WaitIdle ¶
func (t *TestingEnv) WaitIdle()
type TestingEnvConfig ¶
type TestingEnvConfig struct {
Name string
DataDir string
IngestorCount int
ColdShards int // number of replicaSets (aka shards)
ColdFactor int // number of replicas in each replicaSet
HotShards int // number of replicaSets (aka shards)
HotFactor int // number of replicas in each replicaSet
HotModeEnabled bool
QueryRateLimit *float64
FracManagerConfig *fracmanager.Config
Mapping seq.Mapping
IndexAllFields bool
S3Cli *seqs3.Client
}
func (*TestingEnvConfig) GetColdFactor ¶
func (cfg *TestingEnvConfig) GetColdFactor() int
func (*TestingEnvConfig) GetColdStoresConfs ¶
func (cfg *TestingEnvConfig) GetColdStoresConfs() []storeapi.StoreConfig
func (*TestingEnvConfig) GetFracManagerConfig ¶
func (cfg *TestingEnvConfig) GetFracManagerConfig(replicaID string) fracmanager.Config
func (*TestingEnvConfig) GetHotFactor ¶
func (cfg *TestingEnvConfig) GetHotFactor() int
func (*TestingEnvConfig) GetHotStoresConfs ¶
func (cfg *TestingEnvConfig) GetHotStoresConfs() []storeapi.StoreConfig
func (*TestingEnvConfig) GetStoreConfig ¶
func (cfg *TestingEnvConfig) GetStoreConfig(replicaID string, cold bool) storeapi.StoreConfig
func (*TestingEnvConfig) MakeStores ¶
func (cfg *TestingEnvConfig) MakeStores( confs []storeapi.StoreConfig, replicas int, s3cli *seqs3.Client, ) (Stores, [][]string)