env

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AKODeploymentConfigLabelsGetter

func AKODeploymentConfigLabelsGetter(testcase *E2ETestCase) labelGetter

func AllocVIP

func AllocVIP(runner *VIPRunner) (string, error)

func ApplyLabelOnCluster

func ApplyLabelOnCluster(r *KubectlRunner, name, key, val string)

func ClusterExists

func ClusterExists(r *TKGRunner, name string) bool

func CreateCluster

func CreateCluster(r *TKGRunner, name string, vip string)

func CreateNamespace

func CreateNamespace(r *KubectlRunner)

func DeleteCluster

func DeleteCluster(r *TKGRunner, name string)

func DeleteNamespace

func DeleteNamespace(r *KubectlRunner)

func EnsureAKO

func EnsureAKO(testcase *E2ETestCase, clusterName string)

func EnsureAviObjectDeleted

func EnsureAviObjectDeleted(aviClient aviclient.Client, clusterName string, obj string)

func EnsureClusterGone

func EnsureClusterGone(r *TKGRunner, name string)

func EnsureClusterHasLabels

func EnsureClusterHasLabels(runner *KubectlRunner, name string, labels map[string]string)

func EnsureClusterStatus

func EnsureClusterStatus(r *TKGRunner, name, status string)

func EnsureClusterStatusWithTimeout

func EnsureClusterStatusWithTimeout(r *TKGRunner, name, status, timeout string)

func EnsureIPAccessible

func EnsureIPAccessible(ip string, port int)

func EnsureLoadBalancerService

func EnsureLoadBalancerService(testcase *E2ETestCase, clusterName string)

func EnsureLoadBalancerTypeServiceAccessible

func EnsureLoadBalancerTypeServiceAccessible(runner *KubectlRunner, expectedNum int)

func EnsureObjectGone

func EnsureObjectGone(runner *KubectlRunner, obj, objName string)

func EnsurePodRunning

func EnsurePodRunning(runner *KubectlRunner, podNamePrefix string, expectedNum int, namespace string)

func EnsurePodRunningWithTimeout

func EnsurePodRunningWithTimeout(runner *KubectlRunner, podNamePrefix string, expectedNum int, namespace, timeout string)

func EnsureYamlsApplied

func EnsureYamlsApplied(runner *KubectlRunner, yamlPaths []string)

func GenerateRandomName

func GenerateRandomName() string

func GetAviObject

func GetAviObject(runner *KubectlRunner, resourceType, resourceName, field, obj string) string

func GetClusterCredential

func GetClusterCredential(r *TKGRunner, name string)

func GetLoadBalancerServices

func GetLoadBalancerServices(runner *KubectlRunner, expectedNum int, namespace string) []string

func GetPodsStatuses

func GetPodsStatuses(runner *KubectlRunner, podNamePrefix string, expectedNum int, namespace string) []string

func LoadTestEnv

func LoadTestEnv(path string) error

func NewAviRunner

func NewAviRunner(runner *KubectlRunner) aviclient.Client

func NotExist

func NotExist(path string) bool

func ReadFromFile

func ReadFromFile(file string) ([]byte, error)

func ShowThePlan

func ShowThePlan()

Types

type Clients

type Clients struct {
	Kubectl *KubectlRunner
	TKGCli  *TKGRunner
	VIP     *VIPRunner
	Avi     aviclient.Client
}

type E2ETestCase

type E2ETestCase struct {
	Clients             Clients
	AKODeploymentConfig YamlTarget
	YAMLs               []YamlTarget
}

E2ETestCase runs tests case in one separate namespace

func LoadTestCase

func LoadTestCase(name string) (bool, *E2ETestCase)

LoadTestTest checks if the testcase is registered to run. It takes one parameter:

string: name of the testcase

It returns two values:

bool: if it's true, then the test case is not registered and should be skipped
*E2ETestCase: an encapsulation of a Test Case's env

func (*E2ETestCase) EnsureAviResourcesDeleted

func (o *E2ETestCase) EnsureAviResourcesDeleted(clusterName string)

func (*E2ETestCase) EnsureCRSandAviUserDeleted

func (o *E2ETestCase) EnsureCRSandAviUserDeleted(clusterName string)

func (*E2ETestCase) EnsureClusterCreated

func (o *E2ETestCase) EnsureClusterCreated(name string)

func (*E2ETestCase) EnsureClusterDeleted

func (o *E2ETestCase) EnsureClusterDeleted(name string)

func (*E2ETestCase) EnsureClusterLabelApplied

func (o *E2ETestCase) EnsureClusterLabelApplied(clusterName string, labelGetter labelGetter)

func (*E2ETestCase) EnsureYamlsApplied

func (o *E2ETestCase) EnsureYamlsApplied(yamlPaths []string)

func (*E2ETestCase) EnsureYamlsRemoved

func (o *E2ETestCase) EnsureYamlsRemoved(yamlPaths []string)

func (*E2ETestCase) Init

func (o *E2ETestCase) Init()

Init initializes the namespace

func (*E2ETestCase) SanityCheck

func (o *E2ETestCase) SanityCheck()

func (*E2ETestCase) Teardown

func (o *E2ETestCase) Teardown()

Teardown deletes the namespace

type Env

type Env struct {
	TKGConfig                   string      `json:"tkg-config"`
	ManagementClusterKubeconfig Kubecontext `json:"mc-kubeconfig"`
	Worker                      string      `json:"worker"`
}

type Kubecontext

type Kubecontext struct {
	Path    string `json:"path"`
	Context string `json:"context"`
}

type KubectlRunner

type KubectlRunner struct {
	ConfigPath string
	Context    string
	Namespace  string
	Timeout    string
}

func NewKubectlRunner

func NewKubectlRunner(kubeConfigPath, context, namespace string) *KubectlRunner

func (*KubectlRunner) Run

func (runner *KubectlRunner) Run(args ...string) *gexec.Session

func (*KubectlRunner) RunInNamespace

func (runner *KubectlRunner) RunInNamespace(namespace string, args ...string) *gexec.Session

func (*KubectlRunner) RunWithArgs

func (runner *KubectlRunner) RunWithArgs(args ...string) *gexec.Session

func (*KubectlRunner) RunWithoutNamespace

func (runner *KubectlRunner) RunWithoutNamespace(args ...string) *gexec.Session

type TKGRunner

type TKGRunner struct {
	ConfigPath string
	Namespace  string
}

func NewTKGRunner

func NewTKGRunner(configPath, namespace string) *TKGRunner

func (*TKGRunner) Run

func (runner *TKGRunner) Run(args ...string) *gexec.Session

func (*TKGRunner) RunWithArgs

func (runner *TKGRunner) RunWithArgs(args ...string) *gexec.Session

func (*TKGRunner) RunWithNamespace

func (runner *TKGRunner) RunWithNamespace(namespace string, args ...string) *gexec.Session

type TestCaseSpec

type TestCaseSpec struct {
	Name                string       `json:"name"`
	AKODeploymentConfig YamlTarget   `json:"akoDeploymentConfig"`
	YAMLs               []YamlTarget `json:"yamls"`
}

type TestEnvSpec

type TestEnvSpec struct {
	Env   Env
	Tests []TestCaseSpec
}

TestEnvSpec is the specification for an e2e tests which includes: 1. the infra information where these tests will run; 2. an array of test cases that'll be run and the test specific settings;

type VIPRunner

type VIPRunner struct {
	WorkerEndpoint string
}

func NewVIPRunner

func NewVIPRunner(workerEndpoint string) *VIPRunner

type YamlTarget

type YamlTarget struct {
	Path string `json:"path"`
	Name string `json:"name,omitempty"`
}

Jump to

Keyboard shortcuts

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