Documentation ¶
Index ¶
- Constants
- func CheckError(err error)
- func CheckErrorWithCode(err error, exitcode int)
- func DnsFriendly(str string, postfix string) string
- func EnsureCleanState(t *testing.T)
- func FailOnErr(v interface{}, err error) interface{}
- func Fatal(exitcode int, args ...interface{})
- func Fatalf(exitcode int, format string, args ...interface{})
- func GetEnvWithDefault(envName, defaultValue string) string
- func IsGitHubAPISkippedTest(t *testing.T) bool
- func MustToUnstructured(obj interface{}) *unstructured.Unstructured
- func PrettyPrintJson(obj interface{}) string
- func Run(workDir, name string, args ...string) (string, error)
- func RunWithStdin(stdin, workDir, name string, args ...string) (string, error)
- func SetProjectSpec(fixtureClient *E2EFixtureK8sClient, project string, ...)
- func TestNamespace() string
- func ToUnstructured(obj interface{}) (*unstructured.Unstructured, error)
- type E2EFixtureK8sClient
- type ExternalNamespace
Constants ¶
const ( // ErrorCommandSpecific is reserved for command specific indications ErrorCommandSpecific = 1 // ErrorConnectionFailure is returned on connection failure to API endpoint ErrorConnectionFailure = 11 // ErrorAPIResponse is returned on unexpected API response, i.e. authorization failure ErrorAPIResponse = 12 // ErrorResourceDoesNotExist is returned when the requested resource does not exist ErrorResourceDoesNotExist = 13 // ErrorGeneric is returned for generic error ErrorGeneric = 20 )
const ( // ArgoCDNamespace is the namespace into which Argo CD and ApplicationSet controller are deployed, // and in which Application resources should be created. ArgoCDNamespace = "argocd-e2e" // ArgoCDExternalNamespace is an external namespace to test additional namespaces ArgoCDExternalNamespace ExternalNamespace = "argocd-e2e-external" // ArgoCDExternalNamespace2 is an external namespace to test additional namespaces ArgoCDExternalNamespace2 ExternalNamespace = "argocd-e2e-external-2" // ApplicationsResourcesNamespace is the namespace into which temporary resources (such as Deployments/Pods/etc) // can be deployed, such as using it as the target namespace in an Application resource. // Note: this is NOT the namespace the ApplicationSet controller is deployed to; see ArgoCDNamespace. ApplicationsResourcesNamespace = "applicationset-e2e" TmpDir = "/tmp/applicationset-e2e" TestingLabel = "e2e.argoproj.io" )
Variables ¶
This section is empty.
Functions ¶
func CheckError ¶
func CheckError(err error)
CheckError logs a fatal message and exits with ErrorGeneric if err is not nil
func CheckErrorWithCode ¶
CheckErrorWithCode is a convenience function to exit if an error is non-nil and exit if it was
func DnsFriendly ¶
returns dns friends string which is no longer than 63 characters and has specified postfix at the end
func EnsureCleanState ¶
EnsureCleanSlate ensures that the Kubernetes resources on the cluster are in a 'clean' state, before a test is run.
func FailOnErr ¶
func FailOnErr(v interface{}, err error) interface{}
FailOnErr panics if there is an error. It returns the first value so you can use it if you cast it: text := FailOrErr(Foo)).(string)
func Fatal ¶
func Fatal(exitcode int, args ...interface{})
Fatal is a wrapper for logrus.Fatal() to exit with custom code
func GetEnvWithDefault ¶ added in v2.7.0
func IsGitHubAPISkippedTest ¶
IsGitHubSkippedTest returns true if the test should be skipped because it requires a GitHub API Token and one has not been provided. Unfortunately, GitHub Actions cannot use repository secrets, so we need to skip these tests for PRs.
Tests that call this function require a GITHUB_TOKEN to be present, otherwise they will fail, due to GitHub's rate limiting on anonymous API requests.
Note: This only applies to tests that use the GitHub API (different from GitHub's Git service)
func MustToUnstructured ¶
func MustToUnstructured(obj interface{}) *unstructured.Unstructured
func PrettyPrintJson ¶
func PrettyPrintJson(obj interface{}) string
PrettyPrintJson is a utility function for debugging purposes
func SetProjectSpec ¶ added in v2.10.0
func SetProjectSpec(fixtureClient *E2EFixtureK8sClient, project string, spec v1alpha1.AppProjectSpec)
func TestNamespace ¶ added in v2.7.0
func TestNamespace() string
TestNamespace returns the namespace where Argo CD E2E test instance will be running in.
func ToUnstructured ¶
func ToUnstructured(obj interface{}) (*unstructured.Unstructured, error)
ToUnstructured converts a concrete K8s API type to an unstructured object
Types ¶
type E2EFixtureK8sClient ¶
type E2EFixtureK8sClient struct { KubeClientset kubernetes.Interface DynamicClientset dynamic.Interface AppClientset appclientset.Interface AppSetClientset dynamic.ResourceInterface ExternalAppSetClientsets map[ExternalNamespace]dynamic.ResourceInterface }
E2EFixtureK8sClient contains Kubernetes clients initialized from local k8s configuration
func GetE2EFixtureK8sClient ¶
func GetE2EFixtureK8sClient() *E2EFixtureK8sClient
GetE2EFixtureK8sClient initializes the Kubernetes clients (if needed), and returns the most recently initalized value. Note: this requires a local Kubernetes configuration (for example, while running the E2E tests).
type ExternalNamespace ¶ added in v2.10.0
type ExternalNamespace string