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
- func CLICoreDescribe(text string, body func()) bool
- func ContainsAnyString(stdOut *bytes.Buffer, contains []string) error
- func ContainsString(stdOut *bytes.Buffer, contains string) error
- func NotContainsString(stdOut *bytes.Buffer, contains string) error
- func RandomString(length int) string
- type CliOps
- type ClusterOps
- type CmdOps
- type ConfigOps
- type ContainerRuntime
- type Docker
- type Framework
- type KindCluster
Constants ¶
const ( ConfigFileName = "config.yaml" ConfigNGFileName = "config-ng.yaml" ConfigFileDir = ".config/tanzu/" )
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 ¶
CLICoreDescribe annotates the test with the CLICore label.
func ContainsAnyString ¶
ContainsAnyString checks that the given buffer contains any of the given set of strings.
func ContainsString ¶
ContainsString checks that the given buffer contains the string.
func NotContainsString ¶
NotContainsString checks that the given buffer not contains the string if contains then throws error.
func RandomString ¶
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
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
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
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