Documentation ¶
Index ¶
- Constants
- func ApplyIdent(s string, indent int) string
- func DumpConfigMap(logger utils.Logger, cm *corev1.ConfigMap) error
- func DumpDeployItems(logger utils.Logger, deployItem *lsv1alpha1.DeployItem) error
- func DumpDeployment(logger utils.Logger, deployment *appsv1.Deployment) error
- func DumpExecution(logger utils.Logger, exec *lsv1alpha1.Execution) error
- func DumpInstallation(logger utils.Logger, inst *lsv1alpha1.Installation) error
- func FormatAsYAML(obj interface{}, indent int) string
- func FormatContainerStatus(status corev1.ContainerStatus, logs string, indent int) string
- func FormatContainerStatuses(ctx context.Context, pod *corev1.Pod, indent int, ...) string
- func FormatContainers(containers []corev1.Container, indent int) string
- func FormatContainersStatus(containers []corev1.ContainerStatus, indent string) string
- func FormatLastError(err *lsv1alpha1.Error, indent string) string
- func FormatList(list []string, indent int) string
- func FormatPod(ctx context.Context, pod *corev1.Pod, kubeClientSet kubernetes.Interface, ...) string
- func GetContainerLogs(ctx context.Context, kubeClientSet kubernetes.Interface, ...) ([]byte, error)
- func StringIndent(indent int) string
- type Cleanup
- type CleanupActionHandle
- type CleanupFunc
- type Dumper
- func (d *Dumper) AddNamespaces(namespaces ...string)
- func (d *Dumper) ClearNamespaces()
- func (d *Dumper) Dump(ctx context.Context) error
- func (d *Dumper) DumpConfigMapsInNamespace(ctx context.Context, namespace string) error
- func (d *Dumper) DumpDeployItemsInNamespace(ctx context.Context, namespace string) error
- func (d *Dumper) DumpDeploymentsInNamespace(ctx context.Context, ns string) error
- func (d *Dumper) DumpExecutionInNamespace(ctx context.Context, namespace string) error
- func (d *Dumper) DumpLandscaperResources(ctx context.Context) error
- func (d *Dumper) FormatPodsWithSelector(ctx context.Context, indent int, opts ...client.ListOption) string
- type Framework
- func (f *Framework) CleanupBeforeTestNamespaces(ctx context.Context) error
- func (f *Framework) IsRegistryEnabled() bool
- func (f *Framework) Log() utils2.Logger
- func (f *Framework) NewState(ctx context.Context) (*envtest.State, CleanupFunc, error)
- func (f *Framework) Register() *State
- func (f *Framework) TestLog() utils2.Logger
- func (f *Framework) WaitForSystemComponents(ctx context.Context) error
- type Options
- type State
Constants ¶
const OpenSourceRepositoryContext = "europe-docker.pkg.dev/sap-gcp-cp-k8s-stable-hub/landscaper"
OpenSourceRepositoryContext is the base url of the repository context for the gardener open source components. There all landscaper blueprints/components are available.
Variables ¶
This section is empty.
Functions ¶
func ApplyIdent ¶
ApplyIdent applies the indentation to a string
func DumpConfigMap ¶
DumpConfigMap dumps information about the configmap
func DumpDeployItems ¶
func DumpDeployItems(logger utils.Logger, deployItem *lsv1alpha1.DeployItem) error
DumpDeployItems dumps information about the deploy items
func DumpDeployment ¶
func DumpDeployment(logger utils.Logger, deployment *appsv1.Deployment) error
DumpDeployment dumps information about the deployment
func DumpExecution ¶
func DumpExecution(logger utils.Logger, exec *lsv1alpha1.Execution) error
DumpExecution dumps information about the execution
func DumpInstallation ¶
func DumpInstallation(logger utils.Logger, inst *lsv1alpha1.Installation) error
DumpInstallation dumps information about the installation
func FormatAsYAML ¶
FormatAsYAML formats a object as yaml
func FormatContainerStatus ¶
func FormatContainerStatus(status corev1.ContainerStatus, logs string, indent int) string
FormatContainerStatus returns a formatted container status.
func FormatContainerStatuses ¶
func FormatContainerStatuses(ctx context.Context, pod *corev1.Pod, indent int, kubeClientSet kubernetes.Interface, start, end time.Time) string
FormatContainerStatuses formats the container statuses of a pod.
func FormatContainers ¶
FormatContainers returns a pretty printed representation of a list of containers
func FormatContainersStatus ¶
func FormatContainersStatus(containers []corev1.ContainerStatus, indent string) string
FormatContainers returns a pretty printed representation of a list of containers
func FormatLastError ¶
func FormatLastError(err *lsv1alpha1.Error, indent string) string
FormatLastError formats a error in a human readable format.
func FormatList ¶
FormatList creates a human readable list with the given indent.
func FormatPod ¶
func FormatPod(ctx context.Context, pod *corev1.Pod, kubeClientSet kubernetes.Interface, indent int, start, end time.Time) string
FormatPod returns information about the pod. It also fetches the pods logs if a client is provided.
func GetContainerLogs ¶
func GetContainerLogs(ctx context.Context, kubeClientSet kubernetes.Interface, podName, podNamespace, containerName string, start, end time.Time) ([]byte, error)
GetContainerLogs returns the logs of a container.
func StringIndent ¶
StringIndent creates the indentation for a number
Types ¶
type Cleanup ¶
type Cleanup struct {
// contains filtered or unexported fields
}
Cleanup contains a list of Cleanup hocks
func (*Cleanup) Add ¶
func (c *Cleanup) Add(fn func()) CleanupActionHandle
Add adds a Cleanup action function
func (*Cleanup) Remove ¶
func (c *Cleanup) Remove(handle CleanupActionHandle)
Remove removes a Cleanup action with the given handle from the list.
type CleanupActionHandle ¶
type CleanupActionHandle *int
type CleanupFunc ¶
type Dumper ¶
type Dumper struct {
// contains filtered or unexported fields
}
Dumper is a struct to dump logs and useful information about known object for a state
func NewDumper ¶
func NewDumper(logger utils.Logger, kubeClient client.Client, kubeClientSet kubernetes.Interface, lsNamespace string, namespaces ...string) *Dumper
NewDumper create a new dumper
func (*Dumper) AddNamespaces ¶
AddNamespaces adds additional namespaces that should be dumped.
func (*Dumper) ClearNamespaces ¶
func (d *Dumper) ClearNamespaces()
ClearNamespaces removes all current namespaces
func (*Dumper) Dump ¶
Dump searches for known objects in the given namespaces and dumps useful information about their state. Currently information about the main landscaper resources in dumped: - Installations - DeployItems todo: dump additional resources
func (*Dumper) DumpConfigMapsInNamespace ¶
DumpConfigMapsInNamespace dumps all configmaps in a namespace
func (*Dumper) DumpDeployItemsInNamespace ¶
DumpDeployItemsInNamespace dumps information about all deploy items int he given namespace
func (*Dumper) DumpDeploymentsInNamespace ¶
DumpDeploymentsInNamespace dumps all deployment resources in a namespace.
func (*Dumper) DumpExecutionInNamespace ¶
DumpExecutionInNamespace dumps all executions in a namespace
func (*Dumper) DumpLandscaperResources ¶
DumpLandscaperResources dumps all landscaper resources in the ls namespace.
func (*Dumper) FormatPodsWithSelector ¶
func (d *Dumper) FormatPodsWithSelector(ctx context.Context, indent int, opts ...client.ListOption) string
FormatPodsWithSelector returns formatted pods that match a selector.
type Framework ¶
type Framework struct { // RootPath is the filepath to the root of the landscaper repository RootPath string // RestConfig is the kubernetes rest config for the test cluster RestConfig *rest.Config // Client is the kubernetes client to interact with the test cluster Client client.Client TargetClient client.Client // ClientSet is the kubernetes clientset to interact with the test cluster. ClientSet kubernetes.Interface // Cleanups contains all cleanup handles that are executed in the after suite Cleanup *Cleanup // LsNamespace defines the namespace where the landscaper controlplane components are deployed. // All functionality like waiting for the components to be ready or log dump is not available // if left empty. LsNamespace string // LsVersion defines the version of landscaper components to be used for the integration test // Will use the latest version (see VERSION) if left empty LsVersion string // DisableCleanup skips the state cleanup step DisableCleanup bool // RunOnShoot tests are executed on shoot and not a k3s cluster (only for compatibility with old setup) RunOnShoot bool // OIDCIssuerURL is the issuer url of the resource cluster serving as a provider for oidc tokens. // Used in test cases in which deployers access the target cluster via oidc. OIDCIssuerURL string // RegistryConfig defines the oci registry config file. // It is expected that the configfile contains exactly one server. RegistryConfig *configfile.ConfigFile RegistryConfigPath string RegistryCAPath string // RegistryBasePath defines the base path for the configured registry. // The base path is used to construct references for artifacts. RegistryBasePath string // OCIClient is a oci client that can up and download artifacts from the configured registry OCIClient ociclient.Client // OCICache is the oci store of the local oci client OCICache cache.Cache TestsFailed bool // contains filtered or unexported fields }
Framework is the Landscaper test framework to execute tests. Also includes some helper functions.
func (*Framework) CleanupBeforeTestNamespaces ¶
func (*Framework) IsRegistryEnabled ¶
IsRegistryEnabled returns true if a docker registry is configured.
func (*Framework) NewState ¶
NewState creates a new state with a test namespace. It also returns a cleanup function that should be called when the test has finished.
func (*Framework) Register ¶
Register registers the frameworks function that is called by ginkgo before and after each test
type Options ¶
type Options struct { KubeconfigPath string RootPath string LsNamespace string LsVersion string DockerConfigPath string OIDCIssuerURLPath string DisableCleanup bool RunOnShoot bool DisableCleanupBefore bool SkipWaitingForSystemComponents bool // contains filtered or unexported fields }