Documentation ¶
Overview ¶
Package framework provides a test framework to use in e2e testing.
Index ¶
- Constants
- func AddLabelsToNamespace(ctx context.Context, input AddLabelsToNamespaceInput)
- func ApplyFromTemplate(ctx context.Context, input ApplyFromTemplateInput) error
- func Byf(format string, a ...interface{})
- func ClusterctlGenerateFromTemplate(ctx context.Context, input ClusterctlGenerateFromTemplateInput)
- func CreateDockerRegistrySecret(ctx context.Context, input CreateDockerRegistrySecretInput)
- func CreateSecret(ctx context.Context, input CreateSecretInput)
- func DeployChartMuseum(ctx context.Context, input ChartMuseumInput) string
- func FleetCreateFleetFile(ctx context.Context, input FleetCreateFleetFileInput)
- func FleetCreateGitRepo(ctx context.Context, input FleetCreateGitRepoInput)
- func FleetDeleteGitRepo(ctx context.Context, input FleetDeleteGitRepoInput)
- func GetNodeAddress(ctx context.Context, input GetNodeAddressInput) string
- func GitCloneRepo(ctx context.Context, input GitCloneRepoInput) string
- func GitCommitAndPush(ctx context.Context, input GitCommitAndPushInput)
- func GiteaCreateRepo(ctx context.Context, input GiteaCreateRepoInput) string
- func RancherGetClusterKubeconfig(ctx context.Context, input RancherGetClusterKubeconfigInput, ...)
- func RancherGetOriginalKubeconfig(ctx context.Context, input RancherGetClusterKubeconfigInput, ...)
- func RancherLookupUser(ctx context.Context, input RancherLookupUserInput, ...)
- func RunCommand(ctx context.Context, input RunCommandInput, result *RunCommandResult)
- type AddLabelsToNamespaceInput
- type ApplyFromTemplateInput
- type ChartMuseumInput
- type ClusterctlGenerateFromTemplateInput
- type CreateDockerRegistrySecretInput
- type CreateSecretInput
- type FleetCreateFleetFileInput
- type FleetCreateGitRepoInput
- type FleetDeleteGitRepoInput
- type GetNodeAddressInput
- type GetServicePortByNameInput
- type GetServicePortByNameOutput
- type GitCloneRepoInput
- type GitCommitAndPushInput
- type GiteaCreateRepoInput
- type RancherGetClusterKubeconfigInput
- type RancherGetClusterKubeconfigResult
- type RancherLookupUserInput
- type RancherLookupUserResult
- type RunCommandInput
- type RunCommandResult
- type VariableCollection
- type VariableLookupFunc
Constants ¶
const ( // DefaultNamespace is the name of the default Kubernetes namespace. DefaultNamespace = "default" // DefaultBranchName is the name of the default git branch. DefaultBranchName = "main" // FleetLocalNamespace is the name of the namespace used for local cluster by Fleet. FleetLocalNamespace = "fleet-local" // MagicDNS is the dns name to use in isolated mode MagicDNS = "sslip.io" // DefaulRancherTurtlesNamespace is the name of the default namespace for Rancher Turtles. DefaultRancherTurtlesNamespace = "rancher-turtles-system" )
Variables ¶
This section is empty.
Functions ¶
func AddLabelsToNamespace ¶
func AddLabelsToNamespace(ctx context.Context, input AddLabelsToNamespaceInput)
AddLabelsToNamespace will add labels to a namespace.
func ApplyFromTemplate ¶
func ApplyFromTemplate(ctx context.Context, input ApplyFromTemplateInput) error
ApplyFromTemplate will generate a yaml definition from a given template and apply it in the cluster.
func Byf ¶
func Byf(format string, a ...interface{})
Byf is used to provider better output for a test using a formatted string.
func ClusterctlGenerateFromTemplate ¶
func ClusterctlGenerateFromTemplate(ctx context.Context, input ClusterctlGenerateFromTemplateInput)
ClusterctlGenerateFromTemplate will generate a cluster definition from a given template.
func CreateDockerRegistrySecret ¶
func CreateDockerRegistrySecret(ctx context.Context, input CreateDockerRegistrySecretInput)
func CreateSecret ¶
func CreateSecret(ctx context.Context, input CreateSecretInput)
CreateSecret will create a new Kubernetes secret.
func DeployChartMuseum ¶
func DeployChartMuseum(ctx context.Context, input ChartMuseumInput) string
DeployChartMuseum will create a new repo in the Gitea server.
func FleetCreateFleetFile ¶
func FleetCreateFleetFile(ctx context.Context, input FleetCreateFleetFileInput)
FleetCreateFleetFile will create a fleet.yaml file in the given location. See the Fleet docs for further information: https://fleet.rancher.io/ref-fleet-yaml
func FleetCreateGitRepo ¶
func FleetCreateGitRepo(ctx context.Context, input FleetCreateGitRepoInput)
FleetCreateGitRepo will create and apply a GitRepo resource to the cluster. See the Fleet docs for further information: https://fleet.rancher.io/gitrepo-add
func FleetDeleteGitRepo ¶
func FleetDeleteGitRepo(ctx context.Context, input FleetDeleteGitRepoInput)
FleetDeleteGitRepo will delete a GitRepo resource from a cluster.
func GetNodeAddress ¶
func GetNodeAddress(ctx context.Context, input GetNodeAddressInput) string
GetNodeAddress gets the address for a node based on index.
func GitCloneRepo ¶
func GitCloneRepo(ctx context.Context, input GitCloneRepoInput) string
GitCloneRepo will clone a repo to a given location.
func GitCommitAndPush ¶
func GitCommitAndPush(ctx context.Context, input GitCommitAndPushInput)
GitCommitAndPush will commit the files for a repo and push the changes to the origin.
func GiteaCreateRepo ¶
func GiteaCreateRepo(ctx context.Context, input GiteaCreateRepoInput) string
GiteaCreateRepo will create a new repo in the Gitea server.
func RancherGetClusterKubeconfig ¶
func RancherGetClusterKubeconfig(ctx context.Context, input RancherGetClusterKubeconfigInput, result *RancherGetClusterKubeconfigResult)
RancherGetClusterKubeconfig will get the Kubeconfig for a cluster from Rancher.
func RancherGetOriginalKubeconfig ¶
func RancherGetOriginalKubeconfig(ctx context.Context, input RancherGetClusterKubeconfigInput, result *RancherGetClusterKubeconfigResult)
RancherGetOriginalKubeconfig will get the unmodified Kubeconfig for a cluster from Rancher.
func RancherLookupUser ¶
func RancherLookupUser(ctx context.Context, input RancherLookupUserInput, result *RancherLookupUserResult)
func RunCommand ¶
func RunCommand(ctx context.Context, input RunCommandInput, result *RunCommandResult)
RunCommand will run a command with the given args and environment variables.
Types ¶
type AddLabelsToNamespaceInput ¶
type AddLabelsToNamespaceInput struct { ClusterProxy framework.ClusterProxy Name string Labels map[string]string }
AddLabelsToNamespaceInput is th einput to AddLabelsToNamespace.
type ApplyFromTemplateInput ¶
type ApplyFromTemplateInput struct { Getter func(key string) string Template []byte AddtionalEnvironmentVariables map[string]string Proxy framework.ClusterProxy OutputFilePath string }
ApplyFromTemplateInput is the input to ApplyFromTemplate.
type ChartMuseumInput ¶
type ChartMuseumInput struct { HelmBinaryPath string ChartsPath string ChartMuseumManifests []byte DeploymentName string ServiceName string PortName string Proxy framework.ClusterProxy WaitInterval []interface{} }
ChartMuseumInput is the input to DeployChartMuseum.
type ClusterctlGenerateFromTemplateInput ¶
type ClusterctlGenerateFromTemplateInput struct { ClusterName string TemplatePath string OutputFilePath string ClusterCtlBinaryPath string EnvironmentVariables map[string]string }
ClusterctlGenerateFromTemplateInput is the input to ClusterctlGenerateFromTemplate.
type CreateSecretInput ¶
type CreateSecretInput struct { Creator framework.Creator Name string Namespace string Type corev1.SecretType Data map[string]string Labels map[string]string Annotations map[string]string }
CreateSecretInput is the input to CreateSecret.
type FleetCreateFleetFileInput ¶
FleetCreateFleetFileInput is the input to FleetCreateFleetFile.
type FleetCreateGitRepoInput ¶
type FleetCreateGitRepoInput struct { Name string Namespace string Repo string Branch string Paths []string FleetGeneration int ClientSecretName string ClusterProxy framework.ClusterProxy }
FleetCreateGitRepoInput is the input to FleetCreateGitRepo.
type FleetDeleteGitRepoInput ¶
type FleetDeleteGitRepoInput struct { Name string Namespace string ClusterProxy framework.ClusterProxy }
FleetDeleteGitRepoInput is the input to FleetDeleteGitRepo.
type GetNodeAddressInput ¶
GetNodeAddressInput is th einput to GetNodeAddress.
type GetServicePortByNameInput ¶
type GetServicePortByNameInput struct { GetLister framework.GetLister ServiceName string ServiceNamespace string PortName string }
GetServicePortByNameInput is the input to GetServicePortByName.
type GetServicePortByNameOutput ¶
func GetServicePortByName ¶
func GetServicePortByName(ctx context.Context, input GetServicePortByNameInput, intervals ...interface{}) GetServicePortByNameOutput
GetServicePortByName will get the ports for a service by port name.
type GitCloneRepoInput ¶
type GitCloneRepoInput struct { Address string CloneLocation string Username string Password string }
GitCloneRepoInput is the input to GitCloneRepo.
type GitCommitAndPushInput ¶
type GitCommitAndPushInput struct { CloneLocation string Username string Password string CommitMessage string }
GitCommitAndPushInput is th einput to GitCommitAndPush.
type GiteaCreateRepoInput ¶
type GiteaCreateRepoInput struct { ServerAddr string RepoName string Username string Password string }
GiteaCreateRepoInput is the input to GiteaCreateRepo.
type RancherGetClusterKubeconfigInput ¶
type RancherGetClusterKubeconfigInput struct { Getter framework.Getter SecretName string Namespace string RancherServerURL string WriteToTempFile bool }
RancherGetClusterKubeconfigInput is the input to RancherGetClusterKubeconfig.
type RancherGetClusterKubeconfigResult ¶
RancherGetClusterKubeconfigResult is the result of RancherGetClusterKubeconfig.
type RancherLookupUserInput ¶
type RancherLookupUserInput struct { ClusterProxy framework.ClusterProxy Username string }
type RancherLookupUserResult ¶
type RancherLookupUserResult struct {
User string
}
type RunCommandInput ¶
RunCommandInput is the input to RunCommand.
type RunCommandResult ¶
RunCommandResult is the result of RunCommand.
type VariableCollection ¶
VariableCollection represents a collection of variables for tests.
type VariableLookupFunc ¶
VariableLookupFunc is a function type used for looking up variable values.
func GetVariable ¶
func GetVariable(vars VariableCollection) VariableLookupFunc
GetVariable is used to get the value for a variable. The expectation is that the variable exists in one of the sources. Assertion will fail if its not found. The order of precedence when checking for variables is: 1. Environment variables 2. Base variablesß This is a re-implementation of the CAPI function to add additional logging.