types

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 2 modules, 9 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ApplicationFound    = ApplicationStatus("found")
	ApplicationPartial  = ApplicationStatus("partial")
	ApplicationNotFound = ApplicationStatus("not-found")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationStatus

type ApplicationStatus string

type Cluster

type Cluster struct {
	Name       string        `json:"name"`
	Client     client.Client `json:"-"`
	Kubeconfig string        `json:"kubeconfig"`
}

Clsuter can be a hub cluster or a managed cluster.

type Context

type Context interface {
	Logger() *zap.SugaredLogger
	Env() *Env
	Config() *config.Config
	Context() context.Context
}

Context keeps the Logger, Env, Config, and Context shared by all code in the e2e package.

type Deployer

type Deployer interface {
	Deploy(TestContext) error
	Undeploy(TestContext) error
	GetName() string
	// GetNamespace return the namespace for the ramen resources, or empty string if not using a special namespace.
	GetNamespace(TestContext) string
	// IsDiscovered returns true for OCM discovered application, false for OCM managed applications.
	IsDiscovered() bool

	// DeleteResources removes all resources that were deployed as part of the workload, except namespaces.
	DeleteResources(TestContext) error
	// WaitForResourcesDelete waits for all workload resources to be deleted, except namespaces.
	WaitForResourcesDelete(TestContext) error

	// DeleteNamespaces deletes the application namespaces on managed clusters.  Must be called only after the DRPC is
	// fully deleted. For more info see https://github.com/RamenDR/ramen/issues/2642
	DeleteNamespaces(TestContext) error
	// WaitForNamespacesDelete waits for the application namespaces to be deleted on managed clusters.
	WaitForNamespacesDelete(TestContext) error

	// GetRecipe returns the recipe if the deployer is configured to use one.
	// Returns nil if the deployer is not configured to use a recipe.
	GetRecipe(TestContext) (*recipe.Recipe, error)

	// GetConfig returns the deployer configuration used by the deployer
	GetConfig() *config.Deployer
}

Deployer interface has methods to deploy a workload to a cluster

type Env

type Env struct {
	Hub        *Cluster `json:"hub"`
	PassiveHub *Cluster `json:"passive-hub,omitempty"`
	C1         *Cluster `json:"c1"`
	C2         *Cluster `json:"c2"`
}

func (*Env) GetCluster

func (e *Env) GetCluster(clusterName string) (*Cluster, error)

GetCluster returns the cluster from the env that matches clusterName. If not found, it returns an empty Cluster and an error.

func (*Env) ManagedClusters

func (e *Env) ManagedClusters() []*Cluster

ManagedClusters returns the list of managed clusters from the env.

type TestContext

type TestContext interface {
	Context
	Deployer() Deployer
	Workload() Workload
	Name() string

	// Namespace for OCM and Ramen resources (Subscription, ApplicationSet, DRPC, VRG) on the hub and managed clusters.
	// Depending on the deployer, it may be the same as AppNamespace().
	ManagementNamespace() string

	// Namespace for application resources on the managed clusters.
	AppNamespace() string
}

TestContext is a more specific Context for a single test; a combination of Deployer, Workload, and namespaces. A test has a unique Name and Logger, and it shares the global Env, Config and Context.

type Workload

type Workload interface {
	// Can differ based on the workload, hence part of the Workload interface
	Kustomize() string

	GetName() string
	GetAppName() string
	GetPath() string
	GetBranch() string
	// GetSelectResource returns the hook.selectResource of workload used. It can be either "deployment"
	//  or "pod" or "statefulset" or any resource with the format "<apigroup>/<apiversion>/<kindplural>"
	GetSelectResource() string
	// GetLabelSelector returns the labelSelector to used for selecting the resources.
	// This value is made use during preparation of hooks used in recipe.
	GetLabelSelector() *metav1.LabelSelector
	// GetChecks returns the check hook to be executed based on workload and given namespace.
	GetChecks(string) []*recipe.Check
	// GetOperations returns the exec hook to be executed based on workload and given namespace.
	GetOperations(string) []*recipe.Operation
	Health(ctx TestContext, cluster *Cluster) error
	Status(ctx TestContext) ([]WorkloadStatus, error)
}

nolint:interfacebloat

type WorkloadStatus

type WorkloadStatus struct {
	ClusterName string
	Status      ApplicationStatus
}

WorkloadStatus holds the status of an application on a specific cluster

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL