install

package
v0.39.0 Latest Latest
Warning

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

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

Documentation

Overview

repopool_cfmint_previews.go implements the RepoPoolCFMintPreviews driver. It deploys a temporary Cloudflare Worker preview mint for behaviour tests and constructs a unified Driver that owns allocation, deallocation, ensure, and teardown.

The preview mint is self-contained: all configuration (PEMs, allowlists, provenance) is passed at deploy time. Teardown abandons the preview alias.

repopool_external_mint.go implements the RepoPoolExternalMint driver. It uses a pre-configured mint URL without deploying anything. This is the original install path retained for test configurations that use a pre-existing mint endpoint.

Index

Constants

View Source
const (
	// PerRepoTriageWorkflow is the workflow path for per-repo triage.
	PerRepoTriageWorkflow = "fullsend.yaml"

	// PerRepoAgentWorkflow is the reusable workflow for the triage agent.
	PerRepoAgentWorkflow = "reusable-triage.yml"

	// PerRepoAgentArtifact is the upload-artifact name for triage output.
	PerRepoAgentArtifact = "fullsend-triage"

	// DefaultPoolSize is the number of test-repo-NN repos in a pool org.
	// Drivers use this as the default capacity when no override is set.
	DefaultPoolSize = 12
)

Variables

This section is empty.

Functions

func CFMintDeployArgs added in v0.37.0

func CFMintDeployArgs(alias, workerName string, cfg cfmintConfig) []string

CFMintDeployArgs builds the CLI arguments for `fullsend mint deploy --platform=cloudflare`. Exported so unit tests can verify arg construction without shelling out.

--allowed-orgs and --workflow-host-repos are always passed (even when empty) so the CLI sees them as explicitly changed. The CLI uses "flag changed" semantics: omitted flags preserve existing Worker bindings, while explicitly-empty values clear them. For per-repo mode the caller should set AllowedOrgs to "" to avoid dual-enrollment.

func CFMintTeardownArgs added in v0.37.0

func CFMintTeardownArgs(previewAlias, workerName string) []string

CFMintTeardownArgs builds the CLI arguments for `fullsend mint delete --platform=cloudflare`. Exported so unit tests can verify arg construction without shelling out.

func CFMintWorkerName added in v0.37.0

func CFMintWorkerName(suiteName string) string

CFMintWorkerName derives the CF Worker script name from a suite name. The name clearly indicates it is the e2e/BT worker for that suite.

func GenerateCFMintPreviewAlias added in v0.37.0

func GenerateCFMintPreviewAlias() (string, error)

GenerateCFMintPreviewAlias creates a unique preview alias for a BT run. Format: bt-<8-hex-chars> (e.g., bt-a1b2c3d4). The alias satisfies the CF preview alias validation: 2-63 lowercase alphanumeric or hyphens.

func ParseCFMintURLFromOutput added in v0.37.0

func ParseCFMintURLFromOutput(output string) string

ParseCFMintURLFromOutput extracts the mint URL printed by `fullsend mint deploy`. The CLI prints a line like:

Worker deployed at https://<alias>-<worker>.<subdomain>.workers.dev

This is the canonical way to obtain the preview URL from a deploy invocation; callers should not re-derive it because the correct workers.dev subdomain is only known at deploy time.

func ValidatePerRepoPostInstall added in v0.36.0

func ValidatePerRepoPostInstall(ctx context.Context, client forge.Client, org, repo string) error

ValidatePerRepoPostInstall checks that a per-repo install left the expected files and configuration in the target repo.

Types

type CLIRunnerFunc added in v0.33.0

type CLIRunnerFunc func(binary, token string, args ...string) (string, error)

CLIRunnerFunc is the signature for running a fullsend CLI command. The default implementation is e2etest.TryRunCLI. Inject a custom function in tests to avoid shelling out.

type Driver

type Driver interface {
	// AllocateRepo leases a slot and makes that repo ready (create if
	// missing, install if needed). Blocks until a slot is free or ctx
	// is cancelled. Returns the repo name only (org is fixed for the
	// driver / World).
	AllocateRepo(ctx context.Context) (repoName string, err error)

	// DeallocateRepo returns a previously allocated repo. Errors on
	// unknown name or double-release.
	DeallocateRepo(ctx context.Context, repoName string) error

	// Finalize always tears down suite-scoped resources (e.g. preview
	// mint). If leases are still outstanding, it reclaims them (logging
	// the names), completes teardown, and returns an error so leaked
	// After-hooks fail CI without stranding resources.
	Finalize(ctx context.Context) error

	// Capacity is the max concurrent outstanding allocations (the
	// driver's real parallelism ceiling). Suite may default concurrency
	// to Capacity() or honor GODOG_CONCURRENCY. If concurrency exceeds
	// Capacity(), excess workers block in AllocateRepo — the suite
	// emits an advisory warning but does not fail.
	Capacity() int
}

Driver owns mint/environment lifecycle and test-repo allocation for behaviour tests. The suite constructs exactly one Driver via a Factory and threads it through World; scenarios call AllocateRepo to lease a ready repo and DeallocateRepo to return it. Finalize tears down suite-scoped resources and reclaims any outstanding leases.

Implementations must be safe for concurrent use by multiple godog scenarios (GODOG_CONCURRENCY > 1).

func NewRepoPoolCFMintPreviews added in v0.37.0

func NewRepoPoolCFMintPreviews(
	org string,
	client forge.Client,
	token, binary, gcpProjectID string,
	logf func(string, ...any),
) (Driver, error)

NewRepoPoolCFMintPreviews is a Factory that deploys a CF preview mint and returns a unified Driver owning allocation, deallocation, ensure, and teardown.

Driver-specific config is read from env: PEM dir from TEST_*_PEM env vars (materialized internally), suite name from BEHAVIOUR_SUITE_NAME (default "bt"), and app set from BEHAVIOUR_APP_SET (default "fullsend-test"). Pool size defaults to DefaultPoolSize. WIF and workflow-host repo lists are computed from the org and pool size.

func NewRepoPoolExternalMint added in v0.37.0

func NewRepoPoolExternalMint(
	org string,
	client forge.Client,
	token, binary, gcpProjectID string,
	logf func(string, ...any),
) (Driver, error)

NewRepoPoolExternalMint is a Factory that returns a unified Driver backed by a pre-configured mint URL. The driver uses the existing mint without deploying anything; teardown is a no-op.

The mint URL is read from FULLSEND_MINT_URL. Pool size defaults to DefaultPoolSize (overridable via BEHAVIOUR_POOL_SIZE).

type Factory added in v0.37.0

type Factory func(
	org string,
	client forge.Client,
	token, binary, gcpProjectID string,
	logf func(string, ...any),
) (Driver, error)

Factory constructs a unified Driver for a given org. The factory performs suite setup (e.g. preview mint deploy) before returning so setup failures fail the suite before scenarios run.

All driver-specific inputs (PEMs, allowlists, mint URL, pool size) are read from env or computed from the org inside the factory. Runtime dependencies (forge client, token, CLI binary, GCP project, logger) are passed as parameters.

type SettleFunc added in v0.33.0

type SettleFunc func(ctx context.Context, client forge.Client, org, repo, workflowFile string, logf func(string, ...any)) error

SettleFunc is called after a repo is freshly created or installed to wait until GitHub Actions recognises the workflow file. The default implementation polls GetWorkflow; tests inject a no-op.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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