Documentation ¶
Index ¶
- Variables
- type Environment
- func (e *Environment) CleanupResources(ctx context.Context, state *State) error
- func (e *Environment) InitResources(ctx context.Context, resourcesPath string) (*State, error)
- func (e *Environment) Start() (client.Client, error)
- func (e *Environment) Stop() error
- func (e *Environment) WaitForObjectToBeDeleted(ctx context.Context, c client.Client, obj client.Object, timeout time.Duration) error
- type State
- func (s *State) AddObject(object client.Object)
- func (s *State) GetAvailabilityCollection(name string) *lssv1alpha1.AvailabilityCollection
- func (s *State) GetConfig(name string) *lssv1alpha1.ServiceTargetConfig
- func (s *State) GetConfigMap(name string) *corev1.ConfigMap
- func (s *State) GetContext(name string) *lsv1alpha1.Context
- func (s *State) GetDeployItem(name string) *lsv1alpha1.DeployItem
- func (s *State) GetDeployment(name string) *lssv1alpha1.LandscaperDeployment
- func (s *State) GetExecution(name string) *lsv1alpha1.Execution
- func (s *State) GetInstallation(name string) *lsv1alpha1.Installation
- func (s *State) GetInstance(name string) *lssv1alpha1.Instance
- func (s *State) GetLsHealthCheck(name string) *lsv1alpha1.LsHealthCheck
- func (s *State) GetLsHealthCheckInNamespace(name string, namespace string) *lsv1alpha1.LsHealthCheck
- func (s *State) GetNamespaceRegistration(name string) *lssv1alpha1.NamespaceRegistration
- func (s *State) GetSecret(name string) *corev1.Secret
- func (s *State) GetSubjectList(name string) *lssv1alpha1.SubjectList
- func (s *State) GetTarget(name string) *lsv1alpha1.Target
- func (s *State) GetTargetSync(name string) *lsv1alpha1.TargetSync
Constants ¶
This section is empty.
Variables ¶
var ( // LandscaperServiceScheme is the scheme used for testing. LandscaperServiceScheme = runtime.NewScheme() // DeploymentGVK is the GVK for landscaper deployments. DeploymentGVK schema.GroupVersionKind // InstanceGVK is the GVK for instances. InstanceGVK schema.GroupVersionKind // ConfigGVK is the GVK for service target configs. ConfigGVK schema.GroupVersionKind // SecretGVK is the GVK for secrets. SecretGVK schema.GroupVersionKind // ConfigMapGVK is the GVK for config maps. ConfigMapGVK schema.GroupVersionKind // InstallationGVK is the GVK for installations. InstallationGVK schema.GroupVersionKind // ExecutionGVK is the GVK for executions. ExecutionGVK schema.GroupVersionKind // DeployItemGVK is the GVK for deploy items. DeployItemGVK schema.GroupVersionKind // TargetSyncGVK is the GVK for target syncs. TargetSyncGVK schema.GroupVersionKind // TargetGVK is the GVK for targets. TargetGVK schema.GroupVersionKind // ContextGVK is the GVK for contexts. ContextGVK schema.GroupVersionKind // AvailabilityCollectionGVK is the GVK for AvailabilityCollection. AvailabilityCollectionGVK schema.GroupVersionKind // LsHealthCheckGVK is the GVK for LsHealthCheck. LsHealthCheckGVK schema.GroupVersionKind // NamespaceRegistrationGVK is the GVK for SubjectList. NamespaceRegistrationGVK schema.GroupVersionKind // SubjectListGVK is the GVK for SubjectList. SubjectListGVK schema.GroupVersionKind )
Functions ¶
This section is empty.
Types ¶
type Environment ¶
type Environment struct { // Env is the kubernetes envtest test environment. Env *envtest.Environment // Client is the kubernetes client Client client.Client }
Environment is the test environment
func NewEnvironment ¶
func NewEnvironment(projectRoot string) (*Environment, error)
NewEnvironment creates a new test environment.
func (*Environment) CleanupResources ¶
func (e *Environment) CleanupResources(ctx context.Context, state *State) error
CleanupResources removes all resources that have been created by function InitResources.
func (*Environment) InitResources ¶
InitResources initializes the test environment with the resources stored in the given path.
type State ¶
type State struct { // Namespace is the kubernetes namespace where objects are located for testing. Namespace string // Deployments contains all landscaper deployments in this test environment. Deployments map[string]*lssv1alpha1.LandscaperDeployment // Instances contains all instances in this test environment. Instances map[string]*lssv1alpha1.Instance // Configs contains all service target configs in this test environment. Configs map[string]*lssv1alpha1.ServiceTargetConfig // Secrets contains all secrets in this test environment. Secrets map[string]*corev1.Secret // ConfigMaps contains all config maps in this test environment. ConfigMaps map[string]*corev1.ConfigMap // Installations contains all installations in this test environment. Installations map[string]*lsv1alpha1.Installation // Executions contains all executions in this test environment. Executions map[string]*lsv1alpha1.Execution // DeployItems contains all DeployItems in this test environment. DeployItems map[string]*lsv1alpha1.DeployItem // TargetSync contains all targetsyncs in this test environment. TargetSync map[string]*lsv1alpha1.TargetSync // Targets contains all targets in this test environment. Targets map[string]*lsv1alpha1.Target // Contexts contains all contexts in this test environment Contexts map[string]*lsv1alpha1.Context // AvailabilityCollections contains all availabilityCollections in this test environment AvailabilityCollections map[string]*lssv1alpha1.AvailabilityCollection // LsHealthChecks contains all LsHealthCheck in this test environment LsHealthChecks map[string]*lsv1alpha1.LsHealthCheck // NamespaceRegistrations contains all NamespaceRegistration in this test environment NamespaceRegistrations map[string]*lssv1alpha1.NamespaceRegistration // SubjectLists contains all SubjectList in this test environment SubjectLists map[string]*lssv1alpha1.SubjectList }
State holds the information used within a single test.
func (*State) GetAvailabilityCollection ¶
func (s *State) GetAvailabilityCollection(name string) *lssv1alpha1.AvailabilityCollection
GetAvailabilityCollection retrieves a AvailabilityCollection by the given name
func (*State) GetConfig ¶
func (s *State) GetConfig(name string) *lssv1alpha1.ServiceTargetConfig
GetConfig retrieves a landscaper target config by the given name.
func (*State) GetConfigMap ¶
GetConfigMap retrieves a config map by the given name.
func (*State) GetContext ¶
func (s *State) GetContext(name string) *lsv1alpha1.Context
GetContext retrieves a context by the given name.
func (*State) GetDeployItem ¶
func (s *State) GetDeployItem(name string) *lsv1alpha1.DeployItem
func (*State) GetDeployment ¶
func (s *State) GetDeployment(name string) *lssv1alpha1.LandscaperDeployment
GetDeployment retrieves a landscaper deployment by the given name.
func (*State) GetExecution ¶
func (s *State) GetExecution(name string) *lsv1alpha1.Execution
func (*State) GetInstallation ¶
func (s *State) GetInstallation(name string) *lsv1alpha1.Installation
GetInstallation retrieves an installation by the given name.
func (*State) GetInstance ¶
func (s *State) GetInstance(name string) *lssv1alpha1.Instance
GetInstance retrieves an instance by the given name.
func (*State) GetLsHealthCheck ¶
func (s *State) GetLsHealthCheck(name string) *lsv1alpha1.LsHealthCheck
GetLsHealthCheck retrieves a LsHealthCheck by the given name
func (*State) GetLsHealthCheckInNamespace ¶
func (s *State) GetLsHealthCheckInNamespace(name string, namespace string) *lsv1alpha1.LsHealthCheck
GetLsHealthCheckInNamespace retrieves a LsHealthCheck by the given name in the given namespace
func (*State) GetNamespaceRegistration ¶
func (s *State) GetNamespaceRegistration(name string) *lssv1alpha1.NamespaceRegistration
GetNamespaceRegistration retrieves a NamespaceRegistration by the given name in the given namespace
func (*State) GetSubjectList ¶
func (s *State) GetSubjectList(name string) *lssv1alpha1.SubjectList
GetSubjectListInNamespace retrieves a SubjectList by the given name in the given namespace
func (*State) GetTarget ¶
func (s *State) GetTarget(name string) *lsv1alpha1.Target
GetTarget retrieves a target by the given name.
func (*State) GetTargetSync ¶
func (s *State) GetTargetSync(name string) *lsv1alpha1.TargetSync