adaptertest

package
v0.0.0-...-f5b6858 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package adaptertest provides tests to ensure that implementations of platform/task/backend.Store and platform/task/backend.LogReader meet the requirements of platform.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)

TestTaskService should be called by consumers of the adaptertest package. This will call fn once to create a single platform.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 adaptertestpackage, 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 {
	S  backend.Store
	LR backend.LogReader
	LW backend.LogWriter

	// Set this context, to be used in tests, so that any spawned goroutines watching Ctx.Done()
	// will clean up after themselves.
	Ctx context.Context
	// contains filtered or unexported fields
}

System, as in "system under test", encapsulates the required parts of a platform.TaskAdapter (the underlying Store, LogReader, and LogWriter) for low-level operations.

Jump to

Keyboard shortcuts

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