e2etest

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultHostedMintGCPProject = "it-gcp-konflux-dev-fullsend"

DefaultHostedMintGCPProject is the GCP project hosting the public mint service. See docs/guides/infrastructure/mint-administration.md.

View Source
const (
	// TestRepo is the pre-existing repo in pool orgs used for enrollment testing.
	TestRepo = "test-repo"
)

Variables

View Source
var ErrAllOrgsRateLimited = errors.New("all pool orgs rate-limited")

ErrAllOrgsRateLimited is returned by AcquireOrg when every pool org was skipped due to GitHub API rate limiting. Callers can detect this with errors.Is and t.Skip instead of failing the test.

Functions

func AcquireOrg

func AcquireOrg(ctx context.Context, cfg EnvConfig, runID string, pool []string, timeout time.Duration, logf func(string, ...any)) (string, string, error)

AcquireOrg scans the pool for an unlocked org and acquires its lock.

func CleanupStaleResources

func CleanupStaleResources(ctx context.Context, client forge.Client, token, org string, t *testing.T)

CleanupStaleResources removes leftover resources from previous test runs. This is the "teardown-first" part of the dual cleanup strategy.

func MintEnrollProjectID

func MintEnrollProjectID(cfg EnvConfig) string

MintEnrollProjectID returns the GCP project for `fullsend mint enroll`. Inference may use a different project via E2E_GCP_PROJECT_ID; the hosted mint always lives in DefaultHostedMintGCPProject unless E2E_GCP_MINT_PROJECT_ID is set.

func ModuleRoot

func ModuleRoot(t *testing.T) string

ModuleRoot returns the directory of the module under test.

func NewLiveClient

func NewLiveClient(token string) *gh.LiveClient

NewLiveClient creates a GitHub API client from a token.

func OrgPool

func OrgPool() []string

OrgPool returns the halfsend org names used for parallel e2e runs.

func ReleaseLock

func ReleaseLock(ctx context.Context, client forge.Client, org, runID string, t *testing.T)

ReleaseLock deletes the org lock repo when the run still holds it.

func RunCLI

func RunCLI(t *testing.T, binary, token string, args ...string) string

RunCLI executes the fullsend CLI with the given args, passing GITHUB_TOKEN.

func RunCLIFromDir

func RunCLIFromDir(t *testing.T, binary, token, dir string, args ...string) string

RunCLIFromDir runs the CLI with cwd set to dir.

func TeardownPerRepoInstall

func TeardownPerRepoInstall(ctx context.Context, client forge.Client, token, org, repo string, logf func(string, ...any))

TeardownPerRepoInstall removes per-repo fullsend artifacts from a test repository.

func TryRunCLI

func TryRunCLI(binary, token string, args ...string) (string, error)

TryRunCLI is like RunCLI but returns an error instead of calling t.Fatalf.

func TryRunCLIWithT

func TryRunCLIWithT(t *testing.T, binary, token string, args ...string) (string, error)

TryRunCLIWithT is like TryRunCLI but logs failures via t and uses ModuleRoot as cwd.

Types

type EnvConfig

type EnvConfig struct {
	MintURL      string
	UseMint      bool
	GCPProjectID string
	WIFProvider  string
	LockTimeout  time.Duration
}

EnvConfig is the exported view of envConfig for behaviour tests.

func LoadEnvConfig

func LoadEnvConfig(t *testing.T) EnvConfig

LoadEnvConfig reads and validates required env vars for e2e and behaviour tests.

Jump to

Keyboard shortcuts

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