Documentation
¶
Index ¶
- Constants
- Variables
- func AddAnnotatedTag(t *testing.T, name string, message string)
- func AddFile(t *testing.T, path, contents string)
- func AddSignedFile(t *testing.T, path, contents string)
- func AddSignedTag(t *testing.T, name string)
- func AddTag(t *testing.T, name string)
- func AddTagWithForce(t *testing.T, name string)
- func AppNamespace() string
- func CreateSubmoduleRepos(t *testing.T, repoType string)
- func Declarative(t *testing.T, filename string, values any) (string, error)
- func Delete(t *testing.T, path string)
- func DnsFriendly(str string, postfix string) string
- func DoHttpJsonRequest(method string, path string, result any, data ...byte) error
- func DoHttpRequest(method string, path string, host string, data ...byte) (*http.Response, error)
- func GetApiResources(t *testing.T) string
- func GetApiServerAddress() string
- func GetEnvWithDefault(envName, defaultValue string) string
- func GetNotificationServerAddress() string
- func GetToken() string
- func IsLocal() bool
- func IsRemote() bool
- func LocalOrRemotePath(base string) string
- func LoginAs(username string) error
- func NormalizeOutput(text string) string
- func Patch(t *testing.T, path string, jsonPatch string)
- func RecordTestRun(t *testing.T)
- func RegisterKustomizeVersion(version, path string) error
- func RemoveSubmodule(t *testing.T)
- func RepoBaseURL(urlType RepoURLType) string
- func RepoURL(urlType RepoURLType) string
- func RestartAPIServer(t *testing.T)
- func RestartRepoServer(t *testing.T)
- func Run(workDir, name string, args ...string) (string, error)
- func RunCli(args ...string) (string, error)
- func RunCliWithRetry(maxRetries int, args ...string) (string, error)
- func RunCliWithStdin(stdin string, isKubeConextOnlyCli bool, args ...string) (string, error)
- func RunFunctionsInParallelAndCheckErrors(t *testing.T, functions []func() error)
- func RunPluginCli(stdin string, args ...string) (string, error)
- func RunWithStdin(stdin, workDir, name string, args ...string) (string, error)
- func RunWithStdinWithRedactor(stdin, workDir, name string, redactor func(string) string, args ...string) (string, error)
- func SetAccounts(accounts map[string][]string) error
- func SetEnableManifestGeneration(val map[v1alpha1.ApplicationSourceType]bool) error
- func SetImpersonationEnabled(impersonationEnabledFlag string) error
- func SetInstallationID(installationID string) error
- func SetParamInNotificationsConfigMap(key, value string) error
- func SetParamInSettingConfigMap(key, value string) error
- func SetPermissions(permissions []ACL, username string, roleName string) error
- func SetProjectSpec(project string, spec v1alpha1.AppProjectSpec) error
- func SetResourceFilter(filters settings.ResourcesFilter) error
- func SetResourceOverrides(overrides map[string]v1alpha1.ResourceOverride) error
- func SetResourceOverridesSplitKeys(overrides map[string]v1alpha1.ResourceOverride) error
- func SetTrackingLabel(trackingLabel string) error
- func SetTrackingMethod(trackingMethod string) error
- func SkipIfAlreadyRun(t *testing.T)
- func SkipOnEnv(t *testing.T, suffixes ...string)
- func TestNamespace() string
- func TmpDir() string
- func Tmpl(t *testing.T, text string, values any) string
- func WriteFile(t *testing.T, path, contents string)
- type ACL
- type RepoURLType
- type TestContext
- type TestOption
- type TestState
- func (s *TestState) DeploymentNamespace() string
- func (s *TestState) GetName() string
- func (s *TestState) ID() string
- func (s *TestState) SetName(name string)
- func (s *TestState) SetToken(token string)
- func (s *TestState) ShortID() string
- func (s *TestState) T() *testing.T
- func (s *TestState) Token() string
- type Version
- type Versions
Constants ¶
const ( DefaultTestUserPassword = "password" TestingLabel = "e2e.argoproj.io" ArgoCDNamespace = "argocd-e2e" ArgoCDAppNamespace = "argocd-e2e-external" GuestbookPath = "guestbook" ProjectName = "argo-project" // cmp plugin sock file path PluginSockFilePath = "/app/config/plugin" // finalizer to add to resources during tests. Make sure that the resource Kind of your object // is included in the test EnsureCleanState code TestFinalizer = TestingLabel + "/finalizer" // Account for batch events processing (set to 1ms in e2e tests) WhenThenSleepInterval = 5 * time.Millisecond )
const ( EnvAdminUsername = "ARGOCD_E2E_ADMIN_USERNAME" EnvAdminPassword = "ARGOCD_E2E_ADMIN_PASSWORD" EnvArgoCDServerName = "ARGOCD_E2E_SERVER_NAME" EnvArgoCDRedisHAProxyName = "ARGOCD_E2E_REDIS_HAPROXY_NAME" EnvArgoCDRedisName = "ARGOCD_E2E_REDIS_NAME" EnvArgoCDRepoServerName = "ARGOCD_E2E_REPO_SERVER_NAME" EnvArgoCDAppControllerName = "ARGOCD_E2E_APPLICATION_CONTROLLER_NAME" )
const ( RepoURLTypeFile = "file" RepoURLTypeHTTPS = "https" RepoURLTypeHTTPSOrg = "https-org" RepoURLTypeHTTPSClientCert = "https-cc" RepoURLTypeHTTPSSubmodule = "https-sub" RepoURLTypeHTTPSSubmoduleParent = "https-par" RepoURLTypeSSH = "ssh" RepoURLTypeSSHSubmodule = "ssh-sub" RepoURLTypeSSHSubmoduleParent = "ssh-par" RepoURLTypeHelm = "helm" RepoURLTypeHelmParent = "helm-par" RepoURLTypeHelmOCI = "helm-oci" RepoURLTypeOCI = "oci" GitUsername = "admin" GitPassword = "password" GitBearerToken = "test" GithubAppID = "2978632978" GithubAppInstallationID = "7893789433789" GpgGoodKeyID = "D56C4FCA57A46444" HelmOCIRegistryURL = "localhost:5000/myrepo" HelmAuthenticatedOCIRegistryURL = "localhost:5001/myrepo" OCIRegistryURL = "oci://localhost:5000/my-oci-repo" OCIHostURL = "oci://localhost:5000" AuthenticatedOCIHostURL = "oci://localhost:5001" )
const ( EnvRepoURLTypeSSH = "ARGOCD_E2E_REPO_SSH" EnvRepoURLTypeSSHSubmodule = "ARGOCD_E2E_REPO_SSH_SUBMODULE" EnvRepoURLTypeSSHSubmoduleParent = "ARGOCD_E2E_REPO_SSH_SUBMODULE_PARENT" EnvRepoURLTypeHTTPS = "ARGOCD_E2E_REPO_HTTPS" EnvRepoURLTypeHTTPSOrg = "ARGOCD_E2E_REPO_HTTPS_ORG" EnvRepoURLTypeHTTPSClientCert = "ARGOCD_E2E_REPO_HTTPS_CLIENT_CERT" EnvRepoURLTypeHTTPSSubmodule = "ARGOCD_E2E_REPO_HTTPS_SUBMODULE" EnvRepoURLTypeHTTPSSubmoduleParent = "ARGOCD_E2E_REPO_HTTPS_SUBMODULE_PARENT" EnvRepoURLTypeHelm = "ARGOCD_E2E_REPO_HELM" EnvRepoURLDefault = "ARGOCD_E2E_REPO_DEFAULT" )
Variables ¶
var ( KubeClientset kubernetes.Interface KubeConfig *rest.Config DynamicClientset dynamic.Interface AppClientset appclientset.Interface ArgoCDClientset apiclient.Client AdminPassword string )
Functions ¶
func AddAnnotatedTag ¶ added in v3.0.21
func AddSignedFile ¶
func AddSignedTag ¶
func AddTagWithForce ¶ added in v3.0.21
func AppNamespace ¶
func AppNamespace() string
func CreateSubmoduleRepos ¶
func Declarative ¶
create the resource by creating using "kubectl apply", with bonus templating
func DnsFriendly ¶
returns dns friends string which is no longer than 63 characters and has specified postfix at the end
func DoHttpJsonRequest ¶
DoHttpJsonRequest executes a http request against the Argo CD API server and unmarshals the response body as JSON
func DoHttpRequest ¶
DoHttpRequest executes a http request against the Argo CD API server
func GetApiResources ¶
func GetApiServerAddress ¶
func GetApiServerAddress() string
func GetEnvWithDefault ¶
func GetNotificationServerAddress ¶
func GetNotificationServerAddress() string
func IsLocal ¶
func IsLocal() bool
IsLocal returns when the tests are being run against a local workload
func IsRemote ¶
func IsRemote() bool
IsRemote returns true when the tests are being run against a workload that is running in a remote cluster.
func LocalOrRemotePath ¶
LocalOrRemotePath selects a path for a given application based on whether tests are running local or remote.
func NormalizeOutput ¶
utility method to deal with white-space
func RecordTestRun ¶
RecordTestRun records a test that has been run successfully to a text file, so that it can be automatically skipped if requested.
func RegisterKustomizeVersion ¶ added in v3.2.0
func RemoveSubmodule ¶
func RepoBaseURL ¶
func RepoBaseURL(urlType RepoURLType) string
func RepoURL ¶
func RepoURL(urlType RepoURLType) string
func RestartAPIServer ¶
RestartAPIServer performs a restart of the API server deployemt and waits until the rollout has completed.
func RestartRepoServer ¶
RestartRepoServer performs a restart of the repo server deployment and waits until the rollout has completed.
func RunCli ¶
RunCli executes an Argo CD CLI command with no stdin input and default server authentication.
func RunCliWithRetry ¶
RunCliWithRetry executes an Argo CD CLI command with retry logic.
func RunCliWithStdin ¶
RunCliWithStdin executes an Argo CD CLI command with optional stdin input and authentication.
func RunPluginCli ¶ added in v3.1.0
RunPluginCli executes an Argo CD CLI plugin with optional stdin input.
func RunWithStdinWithRedactor ¶ added in v3.2.0
func SetAccounts ¶
func SetEnableManifestGeneration ¶
func SetEnableManifestGeneration(val map[v1alpha1.ApplicationSourceType]bool) error
func SetImpersonationEnabled ¶
func SetInstallationID ¶
func SetPermissions ¶
func SetProjectSpec ¶
func SetProjectSpec(project string, spec v1alpha1.AppProjectSpec) error
func SetResourceFilter ¶
func SetResourceFilter(filters settings.ResourcesFilter) error
func SetResourceOverrides ¶
func SetResourceOverrides(overrides map[string]v1alpha1.ResourceOverride) error
func SetResourceOverridesSplitKeys ¶
func SetResourceOverridesSplitKeys(overrides map[string]v1alpha1.ResourceOverride) error
func SetTrackingLabel ¶
func SetTrackingMethod ¶
func SkipIfAlreadyRun ¶
SkipIfAlreadyRun skips a test if it has been already run by a previous test cycle and was recorded.
func SkipOnEnv ¶
SkipOnEnv allows to skip a test when a given environment variable is set. Environment variable names follow the ARGOCD_E2E_SKIP_<suffix> pattern, and must be set to the string value 'true' in order to skip a test.
func TestNamespace ¶
func TestNamespace() string
TestNamespace returns the namespace where Argo CD E2E test instance will be running in.
func TmpDir ¶
func TmpDir() string
TmpDir returns the base directory for e2e test data. It can be overridden via the ARGOCD_E2E_DIR environment variable.
Types ¶
type RepoURLType ¶
type RepoURLType string
type TestContext ¶ added in v3.3.1
type TestContext interface {
// SetName sets the DNS-friendly name for this context
SetName(name string)
// GetName returns the DNS-friendly name for this context
GetName() string
// DeploymentNamespace returns the namespace where test resources are deployed
DeploymentNamespace() string
// ID returns the unique identifier for this test run
ID() string
// ShortID returns the short unique identifier suffix for this test run
ShortID() string
// Token returns the authentication token for API calls
Token() string
// SetToken sets the authentication token
SetToken(token string)
// T returns the testing.T instance for this test
T() *testing.T
}
TestContext defines the interface for test-specific state that enables parallel test execution. All fixture Context types should implement this interface by embedding TestState.
type TestOption ¶
type TestOption func(option *testOption)
func WithTestData ¶
func WithTestData(testdata string) TestOption
type TestState ¶ added in v3.3.1
type TestState struct {
// contains filtered or unexported fields
}
TestState holds test-specific variables that were previously global. Embed this in Context structs to enable parallel test execution.
func EnsureCleanState ¶
func EnsureCleanState(t *testing.T, opts ...TestOption) *TestState
func NewTestState ¶ added in v3.3.1
NewTestState creates a new TestState with unique identifiers for this test run. This generates fresh id, name, and deploymentNamespace values.
func NewTestStateFromContext ¶ added in v3.3.1
func NewTestStateFromContext(ctx TestContext) *TestState
NewTestStateFromContext creates a TestState from an existing TestContext. This allows GivenWithSameState functions to work across different Context types.
func (*TestState) DeploymentNamespace ¶ added in v3.3.1
DeploymentNamespace returns the namespace where test resources are deployed
func (*TestState) ShortID ¶ added in v3.3.1
ShortID returns the short unique identifier suffix for this test run