Documentation
¶
Index ¶
- Constants
- Variables
- func AcquireOrg(ctx context.Context, cfg EnvConfig, runID string, pool []string, ...) (string, string, error)
- func CleanupStaleResources(ctx context.Context, client forge.Client, token, org string, t *testing.T)
- func MintEnrollProjectID(cfg EnvConfig) string
- func ModuleRoot(t *testing.T) string
- func NewLiveClient(token string) *gh.LiveClient
- func OrgPool() []string
- func ReleaseLock(ctx context.Context, client forge.Client, org, runID string, t *testing.T)
- func RequireGitHubToken() error
- func RunCLI(t *testing.T, binary, token string, args ...string) string
- func RunCLIFromDir(t *testing.T, binary, token, dir string, args ...string) string
- func TeardownPerRepoInstall(ctx context.Context, client forge.Client, token, org, repo string, ...)
- func TokenForOrg(ctx context.Context, cfg EnvConfig, org string) (string, error)
- func TryRunCLI(binary, token string, args ...string) (string, error)
- func TryRunCLIWithT(t *testing.T, binary, token string, args ...string) (string, error)
- type EnvConfig
Constants ¶
const ( // LockRepo is the name of the per-org lock repository. The behaviour // install driver's shared-lock bridge (#8620) coordinates through the // same repository so legacy runners keep seeing its locks as held. LockRepo = lockRepo // StaleLockTimeout is the creation age after which legacy runners // reclaim a lock without checking its holder. StaleLockTimeout = staleLockTimeout )
const DefaultHostedMintGCPProject = "it-gcp-konflux-dev-fullsend"
DefaultHostedMintGCPProject is the GCP project hosting the public mint service. See docs/guides/infrastructure/mint-administration.md.
const DefaultPoolOrgInstallMintURL = "https://fullsend-mint-gljhbkcloq-uc.a.run.app"
DefaultPoolOrgInstallMintURL is the hosted dev mint that the retired admin e2e install tests wrote into pool orgs as FULLSEND_MINT_URL. Distinct from resolveMintURL() / defaultMintURL, which CI uses for cross-org e2e org locking. MintEnrollProjectID still maps this URL to DefaultHostedMintGCPProject, because the mint is hosted there.
const (
// TestRepo is the pre-existing repo in pool orgs used for enrollment testing.
TestRepo = "test-repo"
)
Variables ¶
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.
var ErrNoLocalGitHubToken = errors.New("no local GitHub token (gh auth login)")
ErrNoLocalGitHubToken is returned by RequireGitHubToken when the process runs outside GitHub Actions and no local GitHub token is available. Callers can detect it 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 ¶
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 ¶
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 ¶
ReleaseLock deletes the org lock repo when the run still holds it.
func RequireGitHubToken ¶ added in v0.57.0
func RequireGitHubToken() error
RequireGitHubToken reports whether GitHub API access is available: inside GitHub Actions tokens are minted, locally the developer needs their own token. It returns an error wrapping ErrNoLocalGitHubToken otherwise. Drivers that need GitHub access call it, so that runs against other forges are not gated on a GitHub token.
func RunCLIFromDir ¶
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 TokenForOrg ¶ added in v0.50.0
TokenForOrg returns an API token for operating on org: in GitHub Actions a cross-org e2e installation token minted for that org, locally the developer's own token. Behaviour suites lease repo slots across pool orgs and resolve one token per org through it, without taking the org's exclusive e2e-lock.
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 ¶
LoadEnvConfig reads and validates required env vars for behaviour tests. Unlike the e2e tests' loader it does not require a GitHub token: install drivers that need one check it themselves with RequireGitHubToken.