framework

package
v0.0.0-...-b25b198 Latest Latest
Warning

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

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

Documentation

Overview

Copyright 2021 VMware, Inc. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Package test defines the integration and end-to-end test case for cli core

Copyright 2022 VMware, Inc. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	ConfigFileName   = "config.yaml"
	ConfigNGFileName = "config-ng.yaml"
	ConfigFileDir    = ".config/tanzu/"
)
View Source
const (
	CliCore = "[CLI-Core]"

	TanzuInit    = "tanzu init"
	TanzuVersion = "tanzu version"

	ConfigSet          = "tanzu config set "
	ConfigGet          = "tanzu config get "
	ConfigUnset        = "tanzu config unset "
	ConfigInit         = "tanzu config init"
	ConfigServerList   = "tanzu config server list"
	ConfigServerDelete = "tanzu config server delete "

	KindCreateCluster = "kind create cluster --name "
	DockerInfo        = "docker info"
	TestDir           = ".tanzu-cli-e2e"
)

Variables

This section is empty.

Functions

func CLICoreDescribe

func CLICoreDescribe(text string, body func()) bool

CLICoreDescribe annotates the test with the CLICore label.

func ContainsAnyString

func ContainsAnyString(stdOut *bytes.Buffer, contains []string) error

ContainsAnyString checks that the given buffer contains any of the given set of strings.

func ContainsString

func ContainsString(stdOut *bytes.Buffer, contains string) error

ContainsString checks that the given buffer contains the string.

func NotContainsString

func NotContainsString(stdOut *bytes.Buffer, contains string) error

NotContainsString checks that the given buffer not contains the string if contains then throws error.

func RandomString

func RandomString(length int) string

RandomString generates random string of given length

Types

type CliOps

type CliOps interface {
	CliInit() error
	CliVersion() (string, error)
	InstallCLI(version string) error
	UninstallCLI(version string) error
}

CliOps performs basic cli operations

func NewCliOps

func NewCliOps() CliOps

type ClusterOps

type ClusterOps interface {
	CreateCluster(name string, args []string) (output string, err error)
	DeleteCluster(name string, args []string) (output string, err error)
	ClusterStatus(name string, args []string) (output string, err error)
}

ClusterOps has helper operations to perform on cluster

type CmdOps

type CmdOps interface {
	Exec(command string) (stdOut, stdErr *bytes.Buffer, err error)
	ExecContainsString(command, contains string) error
	ExecContainsAnyString(command string, contains []string) error
	ExecContainsErrorString(command, contains string) error
	ExecNotContainsStdErrorString(command, contains string) error
	ExecNotContainsString(command, contains string) error
}

CmdOps performs the Command line exec operations

func NewCmdOps

func NewCmdOps() CmdOps

type ConfigOps

type ConfigOps interface {
	ConfigSetFeatureFlag(path, value string) error
	ConfigGetFeatureFlag(path string) (string, error)
	ConfigUnsetFeature(path string) error
	ConfigInit() error
	ConfigServerList() error
	ConfigServerDelete(serverName string) error
	DeleteCLIConfigurationFiles() error
	IsCLIConfigurationFilesExists() bool
}

ConfigOps performs "tanzu config" command operations

func NewConfOps

func NewConfOps() ConfigOps

type ContainerRuntime

type ContainerRuntime interface {
	StartContainerRuntime() (output string, err error)
	ContainerRuntimeStatus() (status string, err error)
	StopContainerRuntime() (output string, err error)
}

ContainerRuntime has operations to perform on container runtime

type Docker

type Docker interface {
	ContainerRuntime
}

Docker is the container runtime of type docker

func NewDocker

func NewDocker() Docker

type Framework

type Framework struct {
	CliOps
	ConfigOps
	ClusterOps
}

Framework has all helper functions to write CLI e2e test cases

func NewFramework

func NewFramework() *Framework

type KindCluster

type KindCluster interface {
	ClusterOps
}

KindCluster performs k8s KIND cluster operations

func NewKindCluster

func NewKindCluster(runtime ContainerRuntime) KindCluster

Jump to

Keyboard shortcuts

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