Documentation ¶
Index ¶
- Constants
- func NewInfluxdCommand(ctx context.Context, subCommands ...*cobra.Command) *cobra.Command
- type Engine
- type Launcher
- func (m *Launcher) AuthorizationService() platform.AuthorizationService
- func (m *Launcher) BucketService() platform.BucketService
- func (m *Launcher) Cancel()
- func (m *Launcher) Engine() Engine
- func (m *Launcher) KeyValueService() *kv.Service
- func (m *Launcher) Log() *zap.Logger
- func (m *Launcher) NatsURL() string
- func (m *Launcher) OrganizationService() platform.OrganizationService
- func (m *Launcher) QueryController() *control.Controller
- func (m *Launcher) Registry() *prom.Registry
- func (m *Launcher) ReportingDisabled() bool
- func (m *Launcher) Run(ctx context.Context, args ...string) error
- func (m *Launcher) Running() bool
- func (m *Launcher) SecretService() platform.SecretService
- func (m *Launcher) Shutdown(ctx context.Context)
- func (m *Launcher) TaskControlService() taskbackend.TaskControlService
- func (m *Launcher) TaskService() platform.TaskService
- func (m *Launcher) URL() string
- func (m *Launcher) UserResourceMappingService() platform.UserResourceMappingService
- func (m *Launcher) UserService() platform.UserService
- type QueryResult
- type QueryResults
- type TemporaryEngine
- func (t *TemporaryEngine) Close() error
- func (t *TemporaryEngine) CreateBackup(ctx context.Context) (int, []string, error)
- func (t *TemporaryEngine) CreateBucket(ctx context.Context, b *influxdb.Bucket) error
- func (t *TemporaryEngine) DeleteBucket(ctx context.Context, orgID, bucketID influxdb.ID) error
- func (t *TemporaryEngine) DeleteBucketRangePredicate(ctx context.Context, orgID, bucketID influxdb.ID, min, max int64, ...) error
- func (t *TemporaryEngine) FetchBackupFile(ctx context.Context, backupID int, backupFile string, w io.Writer) error
- func (t *TemporaryEngine) Flush(ctx context.Context)
- func (t *TemporaryEngine) InternalBackupPath(backupID int) string
- func (t *TemporaryEngine) MetaClient() storage.MetaClient
- func (t *TemporaryEngine) Open(ctx context.Context) error
- func (t *TemporaryEngine) PrometheusCollectors() []prometheus.Collector
- func (t *TemporaryEngine) SeriesCardinality(orgID, bucketID influxdb.ID) int64
- func (t *TemporaryEngine) TSDBStore() storage.TSDBStore
- func (t *TemporaryEngine) UpdateBucketRetentionPeriod(ctx context.Context, bucketID influxdb.ID, d time.Duration) error
- func (t *TemporaryEngine) WithLogger(log *zap.Logger)
- func (t *TemporaryEngine) WritePoints(ctx context.Context, orgID influxdb.ID, bucketID influxdb.ID, ...) error
- type TestLauncher
- func (tl *TestLauncher) AuthorizationService(tb testing.TB) *http.AuthorizationService
- func (tl *TestLauncher) BucketService(tb testing.TB) *http.BucketService
- func (tl *TestLauncher) CheckService() platform.CheckService
- func (tl *TestLauncher) DashboardService(tb testing.TB) *http.DashboardService
- func (tl *TestLauncher) ExecuteQuery(q string) (*QueryResults, error)
- func (tl *TestLauncher) FluxQueryOrFail(tb testing.TB, org *platform.Organization, token string, query string) string
- func (tl *TestLauncher) FluxQueryService() *http.FluxQueryService
- func (tl *TestLauncher) FluxService() *http.FluxService
- func (tl *TestLauncher) HTTPClient(tb testing.TB) *httpc.Client
- func (tl *TestLauncher) LabelService(tb testing.TB) *http.LabelService
- func (tl *TestLauncher) Metrics(tb testing.TB) (metrics map[string]*dto.MetricFamily)
- func (tl *TestLauncher) MustExecuteQuery(query string) *QueryResults
- func (tl *TestLauncher) MustNewHTTPRequest(method, rawurl, body string) *nethttp.Request
- func (tl *TestLauncher) NewHTTPRequest(method, rawurl, token string, body string) (*nethttp.Request, error)
- func (tl *TestLauncher) NewHTTPRequestOrFail(tb testing.TB, method, rawurl, token string, body string) *nethttp.Request
- func (tl *TestLauncher) NotificationEndpointService(tb testing.TB) *http.NotificationEndpointService
- func (tl *TestLauncher) NotificationRuleService() platform.NotificationRuleStore
- func (tl *TestLauncher) NumReads(tb testing.TB, op string) uint64
- func (tl *TestLauncher) OnBoard(req *platform.OnboardingRequest) (*platform.OnboardingResults, error)
- func (tl *TestLauncher) OnBoardOrFail(tb testing.TB, req *platform.OnboardingRequest) *platform.OnboardingResults
- func (tl *TestLauncher) OrgService(tb testing.TB) platform.OrganizationService
- func (tl *TestLauncher) PkgerService(tb testing.TB) pkger.SVC
- func (tl *TestLauncher) QueryAndConsume(ctx context.Context, req *query.Request, fn func(r flux.Result) error) error
- func (tl *TestLauncher) QueryAndNopConsume(ctx context.Context, req *query.Request) error
- func (tl *TestLauncher) QueryFlux(tb testing.TB, org *platform.Organization, token, query string) string
- func (tl *TestLauncher) Run(ctx context.Context, args ...string) error
- func (tl *TestLauncher) Setup() error
- func (tl *TestLauncher) SetupOrFail(tb testing.TB)
- func (tl *TestLauncher) Shutdown(ctx context.Context) error
- func (tl *TestLauncher) ShutdownOrFail(tb testing.TB, ctx context.Context)
- func (tl *TestLauncher) TaskService(tb testing.TB) *http.TaskService
- func (tl *TestLauncher) TaskServiceKV() platform.TaskService
- func (tl *TestLauncher) TelegrafService(tb testing.TB) *http.TelegrafService
- func (tl *TestLauncher) VariableService(tb testing.TB) *http.VariableService
- func (tl *TestLauncher) WriteOrFail(tb testing.TB, to *platform.OnboardingResults, data string)
- func (tl *TestLauncher) WritePoints(data string) error
- func (tl *TestLauncher) WritePointsOrFail(tb testing.TB, data string)
Constants ¶
const ( // BoltStore stores all REST resources in boltdb. BoltStore = "bolt" // MemoryStore stores all REST resources in memory (useful for testing). MemoryStore = "memory" // LogTracing enables tracing via zap logs LogTracing = "log" // JaegerTracing enables tracing via the Jaeger client library JaegerTracing = "jaeger" // Max Integer MaxInt = 1<<uint(strconv.IntSize-1) - 1 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Engine ¶
type Engine interface { influxdb.DeleteService storage.PointsWriter storage.EngineSchema prom.PrometheusCollector influxdb.BackupService SeriesCardinality(orgID, bucketID influxdb.ID) int64 TSDBStore() storage.TSDBStore MetaClient() storage.MetaClient WithLogger(log *zap.Logger) Open(context.Context) error Close() error }
Engine defines the time-series storage engine. Wraps *storage.Engine to facilitate testing.
type Launcher ¶
type Launcher struct { StorageConfig storage.Config // InfluxQL query engine CoordinatorConfig iqlcoordinator.Config Stdin io.Reader Stdout io.Writer Stderr io.Writer // contains filtered or unexported fields }
Launcher represents the main program execution.
func NewLauncher ¶
func NewLauncher() *Launcher
NewLauncher returns a new instance of Launcher connected to standard in/out/err.
func (*Launcher) AuthorizationService ¶
func (m *Launcher) AuthorizationService() platform.AuthorizationService
AuthorizationService returns the internal authorization service.
func (*Launcher) BucketService ¶
func (m *Launcher) BucketService() platform.BucketService
BucketService returns the internal bucket service.
func (*Launcher) Cancel ¶
func (m *Launcher) Cancel()
Cancel executes the context cancel on the program. Used for testing.
func (*Launcher) Engine ¶
Engine returns a reference to the storage engine. It should only be called for end-to-end testing purposes.
func (*Launcher) KeyValueService ¶
KeyValueService returns the internal key-value service.
func (*Launcher) OrganizationService ¶
func (m *Launcher) OrganizationService() platform.OrganizationService
OrganizationService returns the internal organization service.
func (*Launcher) QueryController ¶
func (m *Launcher) QueryController() *control.Controller
QueryController returns the internal query service.
func (*Launcher) ReportingDisabled ¶
ReportingDisabled is true if opted out of usage stats.
func (*Launcher) SecretService ¶
func (m *Launcher) SecretService() platform.SecretService
SecretService returns the internal secret service.
func (*Launcher) Shutdown ¶
Shutdown shuts down the HTTP server and waits for all services to clean up.
func (*Launcher) TaskControlService ¶
func (m *Launcher) TaskControlService() taskbackend.TaskControlService
TaskControlService returns the internal store service.
func (*Launcher) TaskService ¶
func (m *Launcher) TaskService() platform.TaskService
TaskService returns the internal task service.
func (*Launcher) UserResourceMappingService ¶
func (m *Launcher) UserResourceMappingService() platform.UserResourceMappingService
UserResourceMappingService returns the internal user resource mapping service.
func (*Launcher) UserService ¶
func (m *Launcher) UserService() platform.UserService
UserService returns the internal user service.
type QueryResult ¶
type QueryResult struct {
// contains filtered or unexported fields
}
QueryResult wraps a single flux.Result with some helper methods.
func (*QueryResult) HasTablesWithCols ¶
func (r *QueryResult) HasTablesWithCols(want []int)
HasTableWithCols checks if the desired number of tables and columns exist, ignoring any system columns.
If the result is not as expected then the testing.T fails.
func (*QueryResult) TablesN ¶
func (r *QueryResult) TablesN() int
TablesN returns the number of tables for the result.
type QueryResults ¶
QueryResults wraps a set of query results with some helper methods.
func (*QueryResults) Done ¶
func (r *QueryResults) Done()
func (*QueryResults) First ¶
func (r *QueryResults) First(t *testing.T) *QueryResult
First returns the first QueryResult. When there are not exactly 1 table First will fail.
func (*QueryResults) HasTableCount ¶
func (r *QueryResults) HasTableCount(t *testing.T, n int)
HasTableCount asserts that there are n tables in the result.
func (*QueryResults) Names ¶
func (r *QueryResults) Names() []string
Names returns the sorted set of result names for the query results.
func (*QueryResults) SortedNames ¶
func (r *QueryResults) SortedNames() []string
SortedNames returns the sorted set of table names for the query results.
type TemporaryEngine ¶
type TemporaryEngine struct {
// contains filtered or unexported fields
}
TemporaryEngine creates a time-series storage engine backed by a temporary directory that is removed on Close.
func NewTemporaryEngine ¶
func NewTemporaryEngine(c storage.Config, options ...storage.Option) *TemporaryEngine
NewTemporaryEngine creates a new engine that places the storage engine files into a temporary directory; used for testing.
func (*TemporaryEngine) Close ¶
func (t *TemporaryEngine) Close() error
Close will remove the directory containing the time-series files.
func (*TemporaryEngine) CreateBackup ¶
func (*TemporaryEngine) CreateBucket ¶
func (t *TemporaryEngine) CreateBucket(ctx context.Context, b *influxdb.Bucket) error
func (*TemporaryEngine) DeleteBucket ¶
func (t *TemporaryEngine) DeleteBucket(ctx context.Context, orgID, bucketID influxdb.ID) error
DeleteBucket deletes a bucket from the time-series data.
func (*TemporaryEngine) DeleteBucketRangePredicate ¶
func (t *TemporaryEngine) DeleteBucketRangePredicate(ctx context.Context, orgID, bucketID influxdb.ID, min, max int64, pred influxdb.Predicate) error
DeleteBucketRangePredicate will delete a bucket from the range and predicate.
func (*TemporaryEngine) FetchBackupFile ¶
func (*TemporaryEngine) Flush ¶
func (t *TemporaryEngine) Flush(ctx context.Context)
Flush will remove the time-series files and re-open the engine.
func (*TemporaryEngine) InternalBackupPath ¶
func (t *TemporaryEngine) InternalBackupPath(backupID int) string
func (*TemporaryEngine) MetaClient ¶
func (t *TemporaryEngine) MetaClient() storage.MetaClient
func (*TemporaryEngine) Open ¶
func (t *TemporaryEngine) Open(ctx context.Context) error
Open creates a temporary directory and opens the engine.
func (*TemporaryEngine) PrometheusCollectors ¶
func (t *TemporaryEngine) PrometheusCollectors() []prometheus.Collector
PrometheusCollectors returns all the prometheus collectors associated with the engine and its components.
func (*TemporaryEngine) SeriesCardinality ¶
func (t *TemporaryEngine) SeriesCardinality(orgID, bucketID influxdb.ID) int64
SeriesCardinality returns the number of series in the engine.
func (*TemporaryEngine) TSDBStore ¶
func (t *TemporaryEngine) TSDBStore() storage.TSDBStore
func (*TemporaryEngine) UpdateBucketRetentionPeriod ¶
func (*TemporaryEngine) WithLogger ¶
func (t *TemporaryEngine) WithLogger(log *zap.Logger)
WithLogger sets the logger on the engine. It must be called before Open.
func (*TemporaryEngine) WritePoints ¶
func (t *TemporaryEngine) WritePoints(ctx context.Context, orgID influxdb.ID, bucketID influxdb.ID, points []models.Point) error
WritePoints stores points into the storage engine.
type TestLauncher ¶
type TestLauncher struct { *Launcher // Root temporary directory for all data. Path string // Initialized after calling the Setup() helper. User *platform.User Org *platform.Organization Bucket *platform.Bucket Auth *platform.Authorization // Standard in/out/err buffers. Stdin bytes.Buffer Stdout bytes.Buffer Stderr bytes.Buffer // contains filtered or unexported fields }
TestLauncher is a test wrapper for launcher.Launcher.
func NewTestLauncher ¶
func NewTestLauncher(flagger feature.Flagger) *TestLauncher
NewTestLauncher returns a new instance of TestLauncher.
func NewTestLauncherServer ¶
func NewTestLauncherServer(flagger feature.Flagger) *TestLauncher
NewTestLauncherServer returns a new instance of TestLauncher configured as real server (disk store, no e2e flag).
func RunTestLauncherOrFail ¶
func RunTestLauncherOrFail(tb testing.TB, ctx context.Context, flagger feature.Flagger, args ...string) *TestLauncher
RunTestLauncherOrFail initializes and starts the server.
func (*TestLauncher) AuthorizationService ¶
func (tl *TestLauncher) AuthorizationService(tb testing.TB) *http.AuthorizationService
func (*TestLauncher) BucketService ¶
func (tl *TestLauncher) BucketService(tb testing.TB) *http.BucketService
func (*TestLauncher) CheckService ¶
func (tl *TestLauncher) CheckService() platform.CheckService
func (*TestLauncher) DashboardService ¶
func (tl *TestLauncher) DashboardService(tb testing.TB) *http.DashboardService
func (*TestLauncher) ExecuteQuery ¶
func (tl *TestLauncher) ExecuteQuery(q string) (*QueryResults, error)
ExecuteQuery executes the provided query against the ith query node. Callers of ExecuteQuery must call Done on the returned QueryResults.
func (*TestLauncher) FluxQueryOrFail ¶
func (tl *TestLauncher) FluxQueryOrFail(tb testing.TB, org *platform.Organization, token string, query string) string
FluxQueryOrFail performs a query to the specified organization and returns the results or fails if there is an error.
func (*TestLauncher) FluxQueryService ¶
func (tl *TestLauncher) FluxQueryService() *http.FluxQueryService
func (*TestLauncher) FluxService ¶
func (tl *TestLauncher) FluxService() *http.FluxService
func (*TestLauncher) HTTPClient ¶
func (tl *TestLauncher) HTTPClient(tb testing.TB) *httpc.Client
func (*TestLauncher) LabelService ¶
func (tl *TestLauncher) LabelService(tb testing.TB) *http.LabelService
func (*TestLauncher) Metrics ¶
func (tl *TestLauncher) Metrics(tb testing.TB) (metrics map[string]*dto.MetricFamily)
func (*TestLauncher) MustExecuteQuery ¶
func (tl *TestLauncher) MustExecuteQuery(query string) *QueryResults
MustExecuteQuery executes the provided query panicking if an error is encountered. Callers of MustExecuteQuery must call Done on the returned QueryResults.
func (*TestLauncher) MustNewHTTPRequest ¶
func (tl *TestLauncher) MustNewHTTPRequest(method, rawurl, body string) *nethttp.Request
MustNewHTTPRequest returns a new nethttp.Request with base URL and auth attached. Fail on error.
func (*TestLauncher) NewHTTPRequest ¶
func (tl *TestLauncher) NewHTTPRequest(method, rawurl, token string, body string) (*nethttp.Request, error)
NewHTTPRequest returns a new nethttp.Request with base URL and auth attached.
func (*TestLauncher) NewHTTPRequestOrFail ¶
func (tl *TestLauncher) NewHTTPRequestOrFail(tb testing.TB, method, rawurl, token string, body string) *nethttp.Request
NewHTTPRequestOrFail returns a new nethttp.Request with base URL and auth attached. Fail on error.
func (*TestLauncher) NotificationEndpointService ¶
func (tl *TestLauncher) NotificationEndpointService(tb testing.TB) *http.NotificationEndpointService
func (*TestLauncher) NotificationRuleService ¶
func (tl *TestLauncher) NotificationRuleService() platform.NotificationRuleStore
func (*TestLauncher) OnBoard ¶
func (tl *TestLauncher) OnBoard(req *platform.OnboardingRequest) (*platform.OnboardingResults, error)
OnBoard attempts an on-boarding request. The on-boarding status is also reset to allow multiple user/org/buckets to be created.
func (*TestLauncher) OnBoardOrFail ¶
func (tl *TestLauncher) OnBoardOrFail(tb testing.TB, req *platform.OnboardingRequest) *platform.OnboardingResults
OnBoardOrFail attempts an on-boarding request or fails on error. The on-boarding status is also reset to allow multiple user/org/buckets to be created.
func (*TestLauncher) OrgService ¶
func (tl *TestLauncher) OrgService(tb testing.TB) platform.OrganizationService
func (*TestLauncher) PkgerService ¶
func (tl *TestLauncher) PkgerService(tb testing.TB) pkger.SVC
func (*TestLauncher) QueryAndConsume ¶
func (tl *TestLauncher) QueryAndConsume(ctx context.Context, req *query.Request, fn func(r flux.Result) error) error
QueryAndConsume queries InfluxDB using the request provided. It uses a function to consume the results obtained. It returns the first error encountered when requesting the query, consuming the results, or executing the query.
func (*TestLauncher) QueryAndNopConsume ¶
QueryAndNopConsume does the same as QueryAndConsume but consumes results with a nop function.
func (*TestLauncher) QueryFlux ¶
func (tl *TestLauncher) QueryFlux(tb testing.TB, org *platform.Organization, token, query string) string
QueryFlux returns the csv response from a flux query. It also removes all the \r to make it easier to write tests.
func (*TestLauncher) Run ¶
func (tl *TestLauncher) Run(ctx context.Context, args ...string) error
Run executes the program with additional arguments to set paths and ports. Passed arguments will overwrite/add to the default ones.
func (*TestLauncher) Setup ¶
func (tl *TestLauncher) Setup() error
Setup creates a new user, bucket, org, and auth token.
func (*TestLauncher) SetupOrFail ¶
func (tl *TestLauncher) SetupOrFail(tb testing.TB)
SetupOrFail creates a new user, bucket, org, and auth token. Fail on error.
func (*TestLauncher) Shutdown ¶
func (tl *TestLauncher) Shutdown(ctx context.Context) error
Shutdown stops the program and cleans up temporary paths.
func (*TestLauncher) ShutdownOrFail ¶
func (tl *TestLauncher) ShutdownOrFail(tb testing.TB, ctx context.Context)
ShutdownOrFail stops the program and cleans up temporary paths. Fail on error.
func (*TestLauncher) TaskService ¶
func (tl *TestLauncher) TaskService(tb testing.TB) *http.TaskService
func (*TestLauncher) TaskServiceKV ¶
func (tl *TestLauncher) TaskServiceKV() platform.TaskService
func (*TestLauncher) TelegrafService ¶
func (tl *TestLauncher) TelegrafService(tb testing.TB) *http.TelegrafService
func (*TestLauncher) VariableService ¶
func (tl *TestLauncher) VariableService(tb testing.TB) *http.VariableService
func (*TestLauncher) WriteOrFail ¶
func (tl *TestLauncher) WriteOrFail(tb testing.TB, to *platform.OnboardingResults, data string)
WriteOrFail attempts a write to the organization and bucket identified by to or fails if there is an error.
func (*TestLauncher) WritePoints ¶
func (tl *TestLauncher) WritePoints(data string) error
WritePoints attempts a write to the organization and bucket used during setup.
func (*TestLauncher) WritePointsOrFail ¶
func (tl *TestLauncher) WritePointsOrFail(tb testing.TB, data string)
WritePointsOrFail attempts a write to the organization and bucket used during setup or fails if there is an error.