Documentation
¶
Overview ¶
Package acceptance implements repository-internal acceptance-test orchestration.
Index ¶
- Constants
- func CheckShardResults(ctx context.Context, client rerun.RESTClient, w io.Writer, ...) error
- func CollectCoverage(ctx context.Context, options *CoverageOptions, packages, testArgs []string) error
- func FindRepoRoot(start string) (string, error)
- func MergeCoverage(ctx context.Context, repoRoot, dataOut, textOut string, inputs []string) error
- func MergeCoverageShards(ctx context.Context, options CoverageShardOptions) error
- func Precompile(ctx context.Context, repoRoot string, target Target, outputDir string) error
- func RunShard(ctx context.Context, options *RunOptions) error
- func SplitCommandLine(value string) ([]string, error)
- func TargetFromCheckName(check string) (string, error)
- func Verify(ctx context.Context, repoRoot string, target Target, shardCount int, ...) error
- type CoverageOptions
- type CoverageShardOptions
- type Mode
- type RunOptions
- type Shard
- type ShardResult
- type ShardResultsParams
- type Target
Constants ¶
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" )
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 MergeCoverage ¶
func MergeCoverageShards ¶
func MergeCoverageShards(ctx context.Context, options CoverageShardOptions) error
func Precompile ¶
func SplitCommandLine ¶
func TargetFromCheckName ¶
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.
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 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 ¶
func ParseShard ¶
type ShardResult ¶
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.