Documentation
¶
Index ¶
- Constants
- func DnsFriendly(str string, postfix string) string
- func EnsureCleanState(t *testing.T)
- func GetEnvWithDefault(envName, defaultValue string) string
- func IsGitHubAPISkippedTest(t *testing.T) bool
- func MustToUnstructured(obj any) *unstructured.Unstructured
- func PrettyPrintJson(obj any) string
- func SetProjectSpec(t *testing.T, fixtureClient *E2EFixtureK8sClient, project string, ...)
- func TestNamespace() string
- func ToUnstructured(obj any) (*unstructured.Unstructured, error)
- type E2EFixtureK8sClient
- type ExternalNamespace
Constants ¶
const ( // E2ENamespace is the namespace into which Hanzo CD and ApplicationSet controller are deployed, // and in which Application resources should be created. E2ENamespace = "cd-e2e" // CDExternalNamespace is an external namespace to test additional namespaces CDExternalNamespace ExternalNamespace = "cd-e2e-external" // CDExternalNamespace2 is an external namespace to test additional namespaces CDExternalNamespace2 ExternalNamespace = "cd-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 E2ENamespace. ApplicationsResourcesNamespace = "applicationset-e2e" TestingLabel = "e2e.apps.hanzo.ai" )
Variables ¶
This section is empty.
Functions ¶
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 GetEnvWithDefault ¶
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 any) *unstructured.Unstructured
func PrettyPrintJson ¶
PrettyPrintJson is a utility function for debugging purposes
func SetProjectSpec ¶
func SetProjectSpec(t *testing.T, fixtureClient *E2EFixtureK8sClient, project string, spec v1alpha1.AppProjectSpec)
func TestNamespace ¶
func TestNamespace() string
TestNamespace returns the namespace where Hanzo CD E2E test instance will be running in.
func ToUnstructured ¶
func ToUnstructured(obj any) (*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(t *testing.T) *E2EFixtureK8sClient
GetE2EFixtureK8sClient initializes the Kubernetes clients (if needed), and returns the most recently initialized value. Note: this requires a local Kubernetes configuration (for example, while running the E2E tests).
type ExternalNamespace ¶
type ExternalNamespace string