testplugin

package
v1.54.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AllTagName  = "all"
	NoneTagName = "none"
)
View Source
const GoJUnitReport = "gojunitreport"

Variables

This section is empty.

Functions

func PkgsForTags

func PkgsForTags(projectDir string, tags []string, param TestParam) ([]string, error)

func PkgsToTest added in v1.49.0

func PkgsToTest(projectDir string, tags []string, partition *Partition, param TestParam, stdout io.Writer) ([]string, error)

PkgsToTest returns the list of packages to test based on tags, exclusions, and partitioning. Returns an error if partition parsing fails or no packages are found (unless partitioning results in empty set).

func RunTestCmd

func RunTestCmd(projectDir string, testArgs, tags []string, junitOutput string, partition *Partition, param TestParam, stdout io.Writer) (rErr error)

Types

type Partition added in v1.49.0

type Partition struct {
	Index int // 0-indexed partition number
	Total int // total number of partitions
}

Partition represents a partition configuration for splitting packages.

func ParsePartition added in v1.49.0

func ParsePartition(s string) (*Partition, error)

ParsePartition parses a partition string in the format "X,N" where X is the 0-indexed partition number and N is the total number of partitions. Returns nil if the input is empty (no partitioning).

func (*Partition) Apply added in v1.49.0

func (p *Partition) Apply(pkgs []string) []string

Apply applies the partition to the given slice of packages, returning only the packages that belong to this partition. Packages are sorted before partitioning to ensure deterministic results. Returns the original slice if partition is nil.

func (Partition) String added in v1.49.0

func (p Partition) String() string

String returns a human-readable string representation of the partition.

type TestParam

type TestParam struct {
	// Tags group tests into different sets. The key is the name of the tag and the value is a matcher.NamesPathsCfg
	// that specifies the rules for matching the tests that are part of the tag. Any test that matches the provided
	// matcher is considered part of the tag.
	Tags map[string]matcher.Matcher

	// Exclude specifies the files that should be excluded from tests.
	Exclude matcher.Matcher
}

func (*TestParam) Validate

func (p *TestParam) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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