controltest

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package controltest provides a controller for use in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	*control.Controller
}

Controller embeds a control.Controller. It overrides the Query method, to return queries that require Done to be called. It accomplishes this by associating a finalizer with the Query that panics, and then clears the finalizer when Done is called.

This approach is not foolproof: it is possible that garbage collection may not run during a test, and therefore the finalizer will not be invoked.

func New

func New(c *control.Controller) *Controller

New returns a new Controller encapsulating c.

func (*Controller) Query

func (c *Controller) Query(ctx context.Context, compiler flux.Compiler) (flux.Query, error)

Query returns the result of calling Query on the underlying control.Controller, wrapped to ensure that callers call Done on the resulting Query.

Jump to

Keyboard shortcuts

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