acceptance

package
v1.228.0-test.39 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package acceptance implements repository-internal acceptance-test orchestration.

Index

Constants

View Source
const (
	TestsPackage       = "github.com/cloudposse/atmos/tests"
	CmdPackage         = "github.com/cloudposse/atmos/cmd"
	ExecPackage        = "github.com/cloudposse/atmos/internal/exec"
	TestHelpersPackage = "github.com/cloudposse/atmos/tests/testhelpers"

	CLICommandsTest = "TestCLICommands"
	RegistryTest    = "TestTerraformRegistryCache"
)
View Source
const (
	// DefaultShardPolls bounds how many times CheckShardResults re-lists the
	// shards while any of them still lacks a conclusion.
	DefaultShardPolls = 20
	// DefaultShardPollInterval is the wait between those listings.
	DefaultShardPollInterval = 15 * time.Second
)

Variables

This section is empty.

Functions

func CheckShardResults

func CheckShardResults(ctx context.Context, client rerun.RESTClient, w io.Writer, p *ShardResultsParams) error

CheckShardResults judges the acceptance shards of one OS target in a workflow-run attempt: it lists the attempt's jobs, keeps the ones named "Acceptance Tests (<target>, shard N/M)", and fails unless every one of them concluded "success".

The jobs API is eventually consistent: it has returned an empty conclusion for a shard that had completed seven minutes earlier, and the shell version of this check reported that shard as "did not succeed". So an empty conclusion means "not settled yet", not "failed": the listing is repeated (Polls times, Interval apart) until every shard has a conclusion, and only then judged. A listing that never settles fails with the last listing printed; a shard count other than ShardCount fails at once, since every job of an attempt exists from the start and a mismatch means the workflow changed shape.

func CollectCoverage

func CollectCoverage(ctx context.Context, options *CoverageOptions, packages, testArgs []string) error

func FindRepoRoot

func FindRepoRoot(start string) (string, error)

func MergeCoverage

func MergeCoverage(ctx context.Context, repoRoot, dataOut, textOut string, inputs []string) error

func MergeCoverageShards

func MergeCoverageShards(ctx context.Context, options CoverageShardOptions) error

func Precompile

func Precompile(ctx context.Context, repoRoot string, target Target, outputDir string) error

func RunShard

func RunShard(ctx context.Context, options *RunOptions) error

func SplitCommandLine

func SplitCommandLine(value string) ([]string, error)

func TargetFromCheckName

func TargetFromCheckName(check string) (string, error)

TargetFromCheckName derives the OS target ("linux") from the legacy required-check name ("Acceptance Tests (linux)"). The workflow's `test-required` job takes its matrix from those literal names rather than a separate field so verify.go's workflowRequiredCheckPattern keeps matching.

func Verify

func Verify(ctx context.Context, repoRoot string, target Target, shardCount int, binaryDir string) error

Verify checks that the repository's packages, tests, and workflow matrix are assigned exactly once.

Types

type CoverageOptions

type CoverageOptions struct {
	RepoRoot string
	Dir      string
	DataOut  string
	TextOut  string
	Timeout  string
}

CoverageOptions configures native Go coverage collection.

type CoverageShardOptions

type CoverageShardOptions struct {
	RepoRoot  string
	Count     int
	ShardsDir string
	DataOut   string
	TextOut   string
}

CoverageShardOptions configures merging downloaded native coverage artifacts.

type Mode

type Mode string

Mode selects ordinary test execution or native coverage collection.

const (
	ModeTest     Mode = "test"
	ModeCoverage Mode = "coverage"
)

func ParseMode

func ParseMode(value string) (Mode, error)

type RunOptions

type RunOptions struct {
	RepoRoot       string
	Mode           Mode
	Target         Target
	Shard          Shard
	BuildDir       string
	CoverageRoot   string
	GoTestTimeout  string
	CmdTestBinary  string
	TestsBinary    string
	ExecTestBinary string
}

func DefaultRunOptions

func DefaultRunOptions(repoRoot string, mode Mode, target Target, shard Shard) RunOptions

type Shard

type Shard struct {
	Index int
	Count int
}

func ParseShard

func ParseShard(indexValue, countValue string) (Shard, error)

type ShardResult

type ShardResult struct {
	Name       string
	Conclusion string
}

ShardResult is one shard job's name and conclusion. Conclusion is "" while the GitHub jobs API has not written it yet.

type ShardResultsParams

type ShardResultsParams struct {
	Run rerun.RunRef
	// Target is the OS token in the shard job names ("linux", "macos", "windows").
	Target string
	// ShardCount is how many shard jobs the workflow declares (TEST_SHARD_COUNT).
	ShardCount int
	// Polls and Interval default to DefaultShardPolls and DefaultShardPollInterval.
	Polls    int
	Interval time.Duration
	// Wait is how the poll loop sleeps; nil means a context-aware time.After.
	// Tests inject a recorder.
	Wait func(context.Context, time.Duration) error
}

ShardResultsParams describes which shard jobs CheckShardResults judges and how long it waits for their conclusions to settle.

type Target

type Target string

Target identifies the operating system whose acceptance plan is being built.

const (
	TargetLinux   Target = "linux"
	TargetMacOS   Target = "macos"
	TargetWindows Target = "windows"
)

func ParseTarget

func ParseTarget(value string) (Target, error)

Jump to

Keyboard shortcuts

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