Documentation ¶
Overview ¶
Package servicetest provides tests to ensure that implementations of platform/task/backend.Store and platform/task/backend.LogReader meet the requirements of influxdb.TaskService.
Consumers of this package must import query/builtin. This package does not import it directly, to avoid requiring it too early.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestTaskService ¶
func TestTaskService(t *testing.T, fn BackendComponentFactory, testCategory ...string)
TestTaskService should be called by consumers of the servicetest package. This will call fn once to create a single influxdb.TaskService used across all subtests in TestTaskService.
Types ¶
type AuthorizationService ¶
type BackendComponentFactory ¶
type BackendComponentFactory func(t *testing.T) (*System, context.CancelFunc)
BackendComponentFactory is supplied by consumers of the adaptertest package, to provide the values required to constitute a PlatformAdapter. The provided context.CancelFunc is called after the test, and it is the implementer's responsibility to clean up after that is called.
If creating the System fails, the implementer should call t.Fatal.
type OrganizationService ¶
type System ¶
type System struct { TaskControlService backend.TaskControlService // Used in the Creds function to create valid organizations, users, tokens, etc. OrganizationService OrganizationService UserService UserService UserResourceMappingService UserResourceMappingService AuthorizationService AuthorizationService // Set this context, to be used in tests, so that any spawned goroutines watching Ctx.Done() // will clean up after themselves. Ctx context.Context // TaskService is the task service we would like to test TaskService influxdb.TaskService // Override for accessing credentials for an individual test. // Callers can leave this nil and the test will create its own random IDs for each test. // However, if the system needs to verify credentials, // the caller should set this value and return valid IDs and a valid token. // It is safe if this returns the same values every time it is called. CredsFunc func(*testing.T) (TestCreds, error) }
System as in "system under test" encapsulates the required parts of a influxdb.TaskAdapter
type TestCreds ¶
TestCreds encapsulates credentials needed for a system to properly work with tasks.
func (TestCreds) Authorizer ¶
func (tc TestCreds) Authorizer() influxdb.Authorizer
Authorizer returns an authorizer for the credentials in the struct