servicetest

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 14 Imported by: 0

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 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 System

type System struct {
	TaskControlService backend.TaskControlService

	// 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 taskmodel.TaskService

	// Toggles behavior between KV and archive storage because FinishRun() deletes runs after completion
	CallFinishRun bool
}

System as in "system under test" encapsulates the required parts of a influxdb.TaskAdapter

Jump to

Keyboard shortcuts

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