testproxy

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2018 License: MIT Imports: 9 Imported by: 2

README

Go test proxy

This package provides a way to proxy remote Go test results to the local Go test.

Check an example of local and remote tests.

Requires Go installed on the host.

Why?

Sometimes it's useful to compile a test binary for a different platform using Go test on the host, and then execute it in some emulator or isolated environment (VM/Docker).

This library provides a way to write Go test that sets up an environment, compiles the remote test, executes it on remote and streams sub-test results back to the host.

License

MIT

Documentation

Overview

Package testproxy provides a set of tools to replay Go tests results from remote systems to the local Go test.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Replay

func Replay(t *testing.T, r io.Reader)

Replay test events from JSON stream r on the current test suite.

func Run

func Run(t testing.TB, r Runner) io.ReadCloser

Run the Go test using runner and return a JSON event stream.

func RunAndReplay

func RunAndReplay(t *testing.T, r Runner)

RunAndReplay runs the Go test using runner and replays all test results on t.

func RunTestBinary

func RunTestBinary(t *testing.T, bin *exec.Cmd)

RunTestBinary runs the compiled Go test binary and replays all test results on t.

Types

type Runner

type Runner interface {
	// RunAndWait runs a Go test in verbose mode and streams its stdout and stderr to provided writers.
	RunAndWait(stdout, stderr io.Writer) error
}

Runner represents a possibly remote go test.

func NewTestBinary

func NewTestBinary(bin *exec.Cmd) Runner

NewTestBinary creates a test runner from a given test binary.

Jump to

Keyboard shortcuts

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