Documentation ¶
Overview ¶
Package test provides a task for the Go toolchain "test" command.
Index ¶
- Constants
- type Option
- func WithBlockProfile(withBlockProfile bool) Option
- func WithBlockProfileOutputFileName(blockProfileOutputFileName string) Option
- func WithCPUProfile(withCPUProfile bool) Option
- func WithCPUProfileOutputFileName(cpuProfileOutputFileName string) Option
- func WithCoverageProfile(withCoverageProfile bool) Option
- func WithCoverageProfileOutputFileName(coverageProfileOutputFileName string) Option
- func WithFlags(flags ...string) Option
- func WithGoOptions(goOpts ...taskGo.Option) Option
- func WithMemoryProfile(withMemoryProfile bool) Option
- func WithMemoryProfileOutputFileName(memoryProfileOutputFileName string) Option
- func WithMutexProfile(withMutexProfile bool) Option
- func WithMutexProfileOutputFileName(mutexProfileOutputFileName string) Option
- func WithOutputDir(outputDir string) Option
- func WithPkgs(pkgs ...string) Option
- func WithTraceProfile(withTraceProfile bool) Option
- func WithTraceProfileOutputFileName(traceProfileOutputFileName string) Option
- func WithVerboseOutput(withVerboseOutput bool) Option
- func WithoutCache(withoutCache bool) Option
- type Options
- type Task
Constants ¶
const ( // DefaultIntegrationTestTag is the default tag name 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 task option.
func WithBlockProfile ¶
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 ¶
WithBlockProfileOutputFileName sets the file name for the Goroutine blocking profile file. Defaults to DefaultBlockProfileOutputFileName
See `go help test` and the `go` command documentations for more details:
func WithCPUProfile ¶
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 ¶
WithCPUProfileOutputFileName sets the file name for the CPU profile file. Defaults to DefaultCPUProfileOutputFileName.
See `go help test` and the `go` command documentations for more details:
func WithCoverageProfile ¶
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 ¶
WithCoverageProfileOutputFileName sets the file name for the test coverage profile file. Defaults to DefaultCoverageOutputFileName.
See `go help test` and the `go` command documentations for more details:
func WithFlags ¶
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 ¶
WithGoOptions sets shared Go toolchain task options.
func WithMemoryProfile ¶
WithMemoryProfile indicates whether the tests should be run with memory profiling.
See `go help test` and the `go` command documentations for more details:
func WithMemoryProfileOutputFileName ¶
WithMemoryProfileOutputFileName sets the file name for the memory profile file. Defaults to DefaultMemoryProfileOutputFileName.
See `go help test` and the `go` command documentations for more details:
func WithMutexProfile ¶
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 ¶
WithMutexProfileOutputFileName sets the file name for the mutex profile file. Defaults to DefaultMutexProfileOutputFileName.
See `go help test` and the `go` command documentations for more details:
func WithOutputDir ¶
WithOutputDir sets the output directory, relative to the project root, for reports like coverage or benchmark profiles. Defaults to DefaultOutputDirName.
See `go help test` and the `go` command documentations for more details:
func WithPkgs ¶
WithPkgs sets the list of packages to test.
See `go help test` and the `go` command documentations for more details:
func WithTraceProfile ¶
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 ¶
WithTraceProfileOutputFileName sets the file name for the execution trace profile file. Defaults to DefaultTraceProfileOutputFileName.
See `go help test` and the `go` command documentations for more details:
func WithVerboseOutput ¶
WithVerboseOutput indicates whether the test output should be verbose.
See `go help test` and the `go` command documentations for more details:
func WithoutCache ¶
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 { *taskGo.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 // EnableMemoryProfile 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 EnableMemoryProfile 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 parameter build options.
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
Task is a task for the Go toolchain "test" command.
func (*Task) BuildParams ¶
BuildParams builds the parameters. 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: