Documentation
¶
Overview ¶
nolint:gosec
Index ¶
- Constants
- Variables
- func ArgoCDCreateHandler() decoder.HandlerFunc
- func ArgoCDDeleteHandler() decoder.HandlerFunc
- func CreateRemoteBranch(ctx context.Context, repoURL, token, branch, fromBranch string) error
- func GetFreight(ctx context.Context, project, freightID string) (*generated.Freight, error)
- func InitEnv(m *testing.M)
- func KargoCreateHandler() decoder.HandlerFunc
- func KargoDeleteHandler() decoder.HandlerFunc
- func MergePullRequest(ctx context.Context, repoURL, token string, prNumber int, ...) error
- func MutateAsUnstructured(obj k8s.Object, mutateFunc func(obj runtime.Unstructured) error) error
- func MutateAsUnstructuredOptionFor(kind, name string, mutateFunc func(obj runtime.Unstructured) error) decoder.DecodeOption
- func MutateOptionFor(kind, name string, mutateFunc func(obj k8s.Object) error) decoder.DecodeOption
- func NewSetupArgoCDFixtures(options ...decoder.DecodeOption) features.Func
- func NewSetupKargoFixtures(options ...decoder.DecodeOption) features.Func
- func NewTeardownArgoCDFixtures(options ...decoder.DecodeOption) features.Func
- func NewTeardownKargoFixtures(options ...decoder.DecodeOption) features.Func
- func PromoteAndWaitForPhase(ctx context.Context, t *testing.T, project, stage, freightName string, ...) (*kargoapi.Promotion, error)
- func PromoteWithPRMerge(ctx context.Context, t *testing.T, project, stage, freightName string, ...) (*kargoapi.Promotion, error)
- func PromotionStepOutput(promotion *kargoapi.Promotion, stepAlias, key string) (string, bool)
- func RefreshStage(ctx context.Context, _ *testing.T, project, stage string) error
- func RequireArgoCDCLI(ctx context.Context, t *testing.T, _ *envconf.Config) context.Context
- func RequireContextValue(key envfuncs.ContextKey) features.Func
- func RequireEnvValue(path []string) features.Func
- func RequireKargoCli(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context
- func SetupArgoCDFixtures(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context
- func SetupArgoCDFixturesWithOptions(ctx context.Context, t *testing.T, _ *envconf.Config, ...) context.Context
- func SetupArgoCDFixturesWithRepoURL(appSetName string) features.Func
- func SetupArgocdClient(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context
- func SetupKargoApiClient(ctx context.Context, t *testing.T, _ *envconf.Config) context.Context
- func SetupKargoClients(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context
- func SetupKargoFixtures(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context
- func SetupKargoFixturesWithOptions(ctx context.Context, t *testing.T, _ *envconf.Config, ...) context.Context
- func SetupKargoWatchClient(ctx context.Context, t *testing.T, _ *envconf.Config) context.Context
- func SkipIfNoEnvValue(path []string) features.Func
- func StartPromotion(ctx context.Context, t *testing.T, project, stage, freightName string, ...) string
- func TeardownArgoCDFixtures(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context
- func TeardownArgoCDFixturesWithOptions(ctx context.Context, t *testing.T, _ *envconf.Config, ...) context.Context
- func TeardownKargoFixtures(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context
- func TeardownKargoFixturesWithOptions(ctx context.Context, t *testing.T, _ *envconf.Config, ...) context.Context
- func TestData(testData fs.FS) features.Func
- func TryPromoteToStage(ctx context.Context, project, stage, freightName string) (int, error)
- func UpdateApplicationSetRepoURL(name, repoURL string) decoder.DecodeOption
- func UpdateApplicationSetTargetRevision(name, targetRevision string) decoder.DecodeOption
- func UpdateGitCredentialsSecret(name, repoURL, username, password string) decoder.DecodeOption
- func UpdatePromotionTasksVar(name, key, val string) decoder.DecodeOption
- func UpdateStagePromotionVar(stageName, key, val string) decoder.DecodeOption
- func UpdateWarehouseGitRepoURL(name, repoURL string) decoder.DecodeOption
- func WaitForFreight(ctx context.Context, project, freightID string, timeout time.Duration, ...) (*kargoapi.Freight, error)
- func WaitForFreightToBeVerified(ctx context.Context, t *testing.T, project, freightID, stage string, ...) *kargoapi.Freight
- func WaitForLatestFreight(ctx context.Context, project, origin string, timeout time.Duration) (string, error)
- func WaitForPromotionPhase(ctx context.Context, t *testing.T, project, name string, ...) (*kargoapi.Promotion, error)
- func WaitForPullRequestID(ctx context.Context, t *testing.T, project, name, stepAlias string, ...) int
- func WaitForStageVerified(ctx context.Context, t *testing.T, project, stage string, ...) *kargoapi.Stage
- type ArgocdE2EClient
- func (client ArgocdE2EClient) Create(obj k8s.Object) error
- func (client ArgocdE2EClient) CreateAppSet(obj runtime.Unstructured) error
- func (client ArgocdE2EClient) CreateResource(obj runtime.Unstructured, resourceType string, args ...string) error
- func (client ArgocdE2EClient) Delete(kind, name string) error
- func (client ArgocdE2EClient) DeleteResource(resourceType, name string) error
- type GitCreds
Constants ¶
const ArgoCDClientKey envfuncs.ContextKey = "argocd_client"
const KargoCLIKey envfuncs.ContextKey = "kargo_cli"
const KargoCLIWatchKey envfuncs.ContextKey = "kargo_watch"
const TestDataKey envfuncs.ContextKey = "test_data"
const TestDataPath = "testdata"
Variables ¶
var (
TestEnv env.Environment
)
var TestFeatures []features.Feature
Functions ¶
func ArgoCDCreateHandler ¶
func ArgoCDCreateHandler() decoder.HandlerFunc
func ArgoCDDeleteHandler ¶
func ArgoCDDeleteHandler() decoder.HandlerFunc
func CreateRemoteBranch ¶
CreateRemoteBranch creates branch in the GitHub repository, pointing it at the current head of fromBranch, using the go-github API. Branch ref management is not covered by the gitprovider abstraction, and the e2e suites target a GitHub fork, so this uses go-github directly.
func GetFreight ¶
func KargoCreateHandler ¶
func KargoCreateHandler() decoder.HandlerFunc
func KargoDeleteHandler ¶
func KargoDeleteHandler() decoder.HandlerFunc
func MergePullRequest ¶
func MergePullRequest( ctx context.Context, repoURL, token string, prNumber int, timeout time.Duration, ) error
MergePullRequest merges the numbered pull request in the given GitHub repository using token for authentication. It retries while the provider reports the pull request as not yet mergeable (mergeability still computing or a transient head change), up to timeout. It is intended to unblock git-wait-for-pr promotion steps, which otherwise never complete in an unattended run.
func MutateAsUnstructured ¶
func MutateAsUnstructuredOptionFor ¶
func MutateAsUnstructuredOptionFor( kind, name string, mutateFunc func(obj runtime.Unstructured) error, ) decoder.DecodeOption
func MutateOptionFor ¶
func NewSetupArgoCDFixtures ¶
func NewSetupArgoCDFixtures(options ...decoder.DecodeOption) features.Func
func NewSetupKargoFixtures ¶
func NewSetupKargoFixtures(options ...decoder.DecodeOption) features.Func
func NewTeardownArgoCDFixtures ¶
func NewTeardownArgoCDFixtures(options ...decoder.DecodeOption) features.Func
func NewTeardownKargoFixtures ¶
func NewTeardownKargoFixtures(options ...decoder.DecodeOption) features.Func
func PromoteAndWaitForPhase ¶
func PromoteAndWaitForPhase( ctx context.Context, t *testing.T, project, stage, freightName string, phase kargoapi.PromotionPhase, timeout time.Duration, ) (*kargoapi.Promotion, error)
PromoteAndWaitForPhase starts a promotion of freightName to stage and waits until the promotion reaches phase, which may be a running or a terminal phase. It asserts the observed phase equals phase.
func PromoteWithPRMerge ¶
func PromoteWithPRMerge( ctx context.Context, t *testing.T, project, stage, freightName string, repoURL, token, prStepAlias string, timeout time.Duration, ) (*kargoapi.Promotion, error)
PromoteWithPRMerge promotes freightName to a stage whose promotion opens a pull request and blocks on git-wait-for-pr. It waits for the promotion to be Running, reads the pull request number recorded by the git-open-pr step (identified by prStepAlias), merges that pull request via the GitHub API using token, then waits for the promotion to succeed.
func PromotionStepOutput ¶
PromotionStepOutput returns the string value stored by the step with the given alias under key in the promotion's shared state (i.e. the value a step referenced as outputs[stepAlias].key).
func RefreshStage ¶
func RequireArgoCDCLI ¶
func RequireContextValue ¶
func RequireContextValue(key envfuncs.ContextKey) features.Func
func RequireEnvValue ¶
func RequireKargoCli ¶
func SetupArgoCDFixtures ¶
func SetupArgoCDFixturesWithRepoURL ¶
SetupArgoCDFixturesWithRepoURL returns a features.Func that sets up the Argo CD fixtures with the named ApplicationSet's source repoURL substituted for the demo GitOps repository URL configured in the test environment. This mirrors the repo substitution applied to Kargo fixtures.
func SetupArgocdClient ¶
func SetupKargoApiClient ¶
func SetupKargoClients ¶
func SetupKargoFixtures ¶
func SetupKargoWatchClient ¶
func SkipIfNoEnvValue ¶
func StartPromotion ¶
func StartPromotion( ctx context.Context, t *testing.T, project, stage, freightName string, timeout time.Duration, ) string
StartPromotion issues a promote request for freightName to stage and returns the name of the created Promotion.
A Stage transiently rejects a promotion with 400 Bad Request while the freight is still being qualified in an upstream stage, so the request is retried on 400 until it is accepted or timeout elapses. Any other error is fatal immediately.
func TeardownArgoCDFixtures ¶
func TeardownKargoFixtures ¶
func TryPromoteToStage ¶
TryPromoteToStage issues a single promote request for freightName to stage without retrying, returning the HTTP status code and error. It is used to assert whether a promotion is currently permitted (e.g. before a required soak time has elapsed), where an unavailable freight yields 400 Bad Request.
func UpdateApplicationSetRepoURL ¶
func UpdateApplicationSetRepoURL(name, repoURL string) decoder.DecodeOption
UpdateApplicationSetRepoURL returns a DecodeOption that rewrites the repoURL of the source(s) in the named ApplicationSet's Application template. This lets tests point Argo CD Applications at a fork of the demo GitOps repository, mirroring the repo substitution applied to Kargo fixtures via UpdateWarehouseGitRepoURL.
func UpdateApplicationSetTargetRevision ¶
func UpdateApplicationSetTargetRevision(name, targetRevision string) decoder.DecodeOption
UpdateApplicationSetTargetRevision returns a DecodeOption that rewrites the targetRevision of the source(s) in the named ApplicationSet's Application template. This lets tests point Argo CD Applications at a branch created dynamically per test run.
func UpdateGitCredentialsSecret ¶
func UpdateGitCredentialsSecret(name, repoURL, username, password string) decoder.DecodeOption
UpdateGitCredentialsSecret returns a DecodeOption that rewrites the repoURL, username and password of the named git credentials Secret. Core types decode into their typed representation, so this operates on a *corev1.Secret.
func UpdatePromotionTasksVar ¶
func UpdatePromotionTasksVar(name, key, val string) decoder.DecodeOption
func UpdateStagePromotionVar ¶
func UpdateStagePromotionVar(stageName, key, val string) decoder.DecodeOption
UpdateStagePromotionVar returns a DecodeOption that rewrites the value of the promotion variable named key in the named Stage's promotionTemplate. An empty stageName matches every Stage.
func UpdateWarehouseGitRepoURL ¶
func UpdateWarehouseGitRepoURL(name, repoURL string) decoder.DecodeOption
func WaitForFreight ¶
func WaitForLatestFreight ¶
func WaitForPromotionPhase ¶
func WaitForPromotionPhase( ctx context.Context, t *testing.T, project, name string, phase kargoapi.PromotionPhase, timeout time.Duration, ) (*kargoapi.Promotion, error)
WaitForPromotionPhase watches the named promotion until it reaches phase or any terminal phase, whichever comes first, then asserts the observed phase equals phase. Passing a terminal phase makes it wait for completion.
func WaitForPullRequestID ¶
func WaitForPullRequestID( ctx context.Context, t *testing.T, project, name, stepAlias string, timeout time.Duration, ) int
WaitForPullRequestID watches the named promotion until the git-open-pr step with the given alias records a pull request id (its pr.id output), returning it. It fails the test if the promotion reaches a terminal phase first or the timeout elapses.
func WaitForStageVerified ¶
func WaitForStageVerified( ctx context.Context, t *testing.T, project, stage string, timeout time.Duration, ) *kargoapi.Stage
WaitForStageVerified watches the named Stage until its most recent Freight selection has been verified successfully, returning the Stage. It fails the test if verification reaches a terminal, non-successful phase or the timeout elapses.
Types ¶
type ArgocdE2EClient ¶
func (ArgocdE2EClient) CreateAppSet ¶
func (client ArgocdE2EClient) CreateAppSet(obj runtime.Unstructured) error
func (ArgocdE2EClient) CreateResource ¶
func (client ArgocdE2EClient) CreateResource(obj runtime.Unstructured, resourceType string, args ...string) error
func (ArgocdE2EClient) Delete ¶
func (client ArgocdE2EClient) Delete(kind, name string) error
func (ArgocdE2EClient) DeleteResource ¶
func (client ArgocdE2EClient) DeleteResource(resourceType, name string) error
type GitCreds ¶
GitCreds holds the git credentials substituted into git-driven suite fixtures.
func RequireGitCreds ¶
RequireGitCreds returns credentials for the demo GitOps repository fork, sourced from the test environment (kargo_demo_gitops_repo + git_pat). The username is derived from the repository owner; GitHub authenticates via the PAT regardless of the username. It fails the test if either value is missing.