test

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package test provide a spell incantation for the "test" command of the Go toolchain.

Index

Constants

View Source
const (
	// DefaultIntegrationTestTag is the default name of tag for integration tests.
	DefaultIntegrationTestTag = "integration"

	// DefaultBlockProfileOutputFileName is the default file name for the Goroutine blocking profile file.
	DefaultBlockProfileOutputFileName = "block_profile.out"

	// DefaultCoverageOutputFileName is the default file name for the test coverage profile file.
	DefaultCoverageOutputFileName = "cover_profile.out"

	// DefaultCPUProfileOutputFileName is the default file name for the CPU profile file.
	DefaultCPUProfileOutputFileName = "cpu_profile.out"

	// DefaultMemoryProfileOutputFileName is the default file name for the memory profile file.
	DefaultMemoryProfileOutputFileName = "mem_profile.out"

	// DefaultMutexProfileOutputFileName is the default file name for the mutex profile file.
	DefaultMutexProfileOutputFileName = "mutex_profile.out"

	// DefaultOutputDirName is the default output directory name for test artifacts like profiles and reports.
	DefaultOutputDirName = "test"

	// DefaultTraceProfileOutputFileName is the default file name for the execution trace profile file.
	DefaultTraceProfileOutputFileName = "trace_profile.out"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

Option is a spell incantation option for the Go toolchain "test" command.

func WithBlockProfile

func WithBlockProfile(withBlockProfile bool) Option

WithBlockProfile indicates whether the tests should be run with a Goroutine blocking profiling.

See `go help test` and the `go` command documentations for more details:

func WithBlockProfileOutputFileName

func WithBlockProfileOutputFileName(blockProfileOutputFileName string) Option

WithBlockProfileOutputFileName sets the file name for the Goroutine blocking profile file.

See `go help test` and the `go` command documentations for more details:

func WithCPUProfile

func WithCPUProfile(withCPUProfile bool) Option

WithCPUProfile indicates whether the tests should be run with CPU profiling.

See `go help test` and the `go` command documentations for more details:

func WithCPUProfileOutputFileName

func WithCPUProfileOutputFileName(cpuProfileOutputFileName string) Option

WithCPUProfileOutputFileName sets the file name for the CPU profile file.

See `go help test` and the `go` command documentations for more details:

func WithCoverageProfile

func WithCoverageProfile(withCoverageProfile bool) Option

WithCoverageProfile indicates whether the tests should be run with coverage profiling.

See `go help test` and the `go` command documentations for more details:

func WithCoverageProfileOutputFileName

func WithCoverageProfileOutputFileName(coverageProfileOutputFileName string) Option

WithCoverageProfileOutputFileName sets the file name for the test coverage profile file.

See `go help test` and the `go` command documentations for more details:

func WithFlags

func WithFlags(flags ...string) Option

WithFlags sets additional flags that are passed to the Go "test" command along with the shared Go flags.

See `go help test` and the `go` command documentations for more details:

func WithGoOptions

func WithGoOptions(goOpts ...spellGo.Option) Option

WithGoOptions sets shared Go toolchain command options.

func WithMemProfile

func WithMemProfile(withMemProfile bool) Option

WithMemProfile indicates whether the tests should be run with memory profiling.

See `go help test` and the `go` command documentations for more details:

func WithMemoryProfileOutputFileName

func WithMemoryProfileOutputFileName(memoryProfileOutputFileName string) Option

WithMemoryProfileOutputFileName sets the file name for the memory profile file.

See `go help test` and the `go` command documentations for more details:

func WithMutexProfile

func WithMutexProfile(withMutexProfile bool) Option

WithMutexProfile indicates whether the tests should be run with mutex profiling.

See `go help test` and the `go` command documentations for more details:

func WithMutexProfileOutputFileName

func WithMutexProfileOutputFileName(mutexProfileOutputFileName string) Option

WithMutexProfileOutputFileName sets the file name for the mutex profile file.

See `go help test` and the `go` command documentations for more details:

func WithOutputDir

func WithOutputDir(outputDir string) Option

WithOutputDir sets the output directory, relative to the project root, for reports like coverage or benchmark profiles.

See `go help test` and the `go` command documentations for more details:

func WithPkgs

func WithPkgs(pkgs ...string) Option

WithPkgs sets the list of packages to test.

See `go help test` and the `go` command documentations for more details:

func WithTraceProfile

func WithTraceProfile(withTraceProfile bool) Option

WithTraceProfile indicates whether the tests should be run with trace profiling.

See `go help test` and the `go` command documentations for more details:

func WithTraceProfileOutputFileName

func WithTraceProfileOutputFileName(traceProfileOutputFileName string) Option

WithTraceProfileOutputFileName sets the file name for the execution trace profile file.

See `go help test` and the `go` command documentations for more details:

func WithVerboseOutput

func WithVerboseOutput(withVerboseOutput bool) Option

WithVerboseOutput indicates whether the test output should be verbose.

See `go help test` and the `go` command documentations for more details:

func WithoutCache

func WithoutCache(withoutCache bool) Option

WithoutCache indicates whether the tests should be run without test caching that is enabled by Go by default.

See `go help test` and the `go` command documentations for more details:

type Options

type Options struct {
	*spellGo.Options

	// BlockProfileOutputFileName is the file name for the Goroutine blocking profile file.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	BlockProfileOutputFileName string

	// CoverageProfileOutputFileName is the file name for the test coverage profile file.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	CoverageProfileOutputFileName string

	// CPUProfileOutputFileName is the file name for the CPU profile file.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	CPUProfileOutputFileName string

	// DisableCache indicates whether the tests should be run without test caching that is enabled by Go by default.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	DisableCache bool

	// EnableBlockProfile indicates whether the tests should be run with a Goroutine blocking profiling.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	EnableBlockProfile bool

	// EnableCoverageProfile indicates whether the tests should be run with coverage profiling.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	EnableCoverageProfile bool

	// EnableCPUProfile indicates whether the tests should be run with CPU profiling.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	EnableCPUProfile bool

	// EnableMemProfile indicates whether the tests should be run with memory profiling.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	EnableMemProfile bool

	// EnableMutexProfile indicates whether the tests should be run with mutex profiling.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	EnableMutexProfile bool

	// EnableTraceProfile indicates whether the tests should be run with trace profiling.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	EnableTraceProfile bool

	// EnableVerboseOutput indicates whether the test output should be verbose.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	EnableVerboseOutput bool

	// Flags are additional flags that are passed to the Go `test` command along with the base Go flags.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	//   - https://golang.org/cmd/go/#hdr-Compile_packages_and_dependencies
	Flags []string

	// MemoryProfileOutputFileName is the file name for the memory profile file.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	MemoryProfileOutputFileName string

	// MutexProfileOutputFileName is the file name for the mutex profile file.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	MutexProfileOutputFileName string

	// OutputDir is the output directory, relative to the project root, for reports like
	// coverage or benchmark profiles.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	OutputDir string

	// Pkgs is a list of packages to test.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	Pkgs []string

	// TraceProfileOutputFileName is the file name for the execution trace profile file.
	//
	// See `go help test` and the `go` command documentations for more details:
	//   - https://golang.org/cmd/go/#hdr-Testing_flags
	TraceProfileOutputFileName string
	// contains filtered or unexported fields
}

Options are spell incantation options for the Go toolchain "test" command.

func NewOptions

func NewOptions(opts ...Option) *Options

NewOptions creates new spell incantation options for the Go toolchain "test" command.

type Spell

type Spell struct {
	// contains filtered or unexported fields
}

Spell is a spell incantation for the "test" command of the Go toolchain.

func New

func New(wand wand.Wand, ac app.Config, opts ...Option) *Spell

New creates a new spell incantation for the "test" command of the Go toolchain.

func (*Spell) Env

func (s *Spell) Env() map[string]string

Env returns spell incantation specific environment variables.

func (*Spell) Formula

func (s *Spell) Formula() []string

Formula returns the spell incantation formula. Note that configured flags are applied after the "GOFLAGS" environment variable and could overwrite already defined flags. In addition, the output directory for test artifacts like profiles and reports must exist or must be be created before, otherwise the "test" Go toolchain command will fail to run.

See `go help environment`, `go help env` and the `go` command documentations for more details:

func (*Spell) Kind

func (s *Spell) Kind() spell.Kind

Kind returns the spell incantation kind.

func (*Spell) Options

func (s *Spell) Options() interface{}

Options returns the spell incantation options.

Jump to

Keyboard shortcuts

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