Documentation ¶
Index ¶
- Constants
- func AddClusterSuite(f func(context.Context) suite.TestingSuite)
- func AddConnectedSuite(suffix string, f func(NamespacePair) suite.TestingSuite)
- func AddHelmAndServiceSuite(suffix, name string, f func(services HelmAndService) suite.TestingSuite)
- func AddMultipleServicesSuite(suffix, name string, f func(services MultipleServices) suite.TestingSuite)
- func AddNamespacePairSuite(suffix string, f func(NamespacePair) suite.TestingSuite)
- func AddSingleServiceSuite(suffix, name string, f func(services SingleService) suite.TestingSuite)
- func AppAndMgrNSName(suffix string) (appNS, mgrNS string)
- func ApplyApp(ctx context.Context, name, namespace, workload string)
- func ApplyEchoService(ctx context.Context, name, namespace string, port int)
- func ApplyService(ctx context.Context, name, namespace, image string, port, targetPort int)
- func AssertDisconnectOutput(ctx context.Context, stdout string)
- func AssertQuitOutput(ctx context.Context, stdout string)
- func Command(ctx context.Context, executable string, args ...string) *dexec.Cmd
- func CreateNamespaces(ctx context.Context, namespaces ...string)
- func DeleteNamespaces(ctx context.Context, namespaces ...string)
- func DeleteSvcAndWorkload(ctx context.Context, workload, name, namespace string)
- func GetGlobalHarness(ctx context.Context) *cluster
- func GetUser(ctx context.Context) string
- func GetWorkingDir(ctx context.Context) string
- func KubeConfig(ctx context.Context) string
- func Kubectl(ctx context.Context, namespace string, args ...string) error
- func KubectlOut(ctx context.Context, namespace string, args ...string) (string, error)
- func LookupEnv(ctx context.Context, key string) (value string, ok bool)
- func Output(ctx context.Context, exe string, args ...string) (string, error)
- func RolloutStatusWait(ctx context.Context, namespace, workload string) error
- func Run(ctx context.Context, exe string, args ...string) error
- func RunError(err error, out []byte) error
- func RunTests(t *testing.T)
- func StartLocalHttpEchoServer(ctx context.Context, name string) (int, context.CancelFunc)
- func Telepresence(ctx context.Context, args ...string) (string, string, error)
- func TelepresenceCmd(ctx context.Context, args ...string) *dexec.Cmd
- func TelepresenceDisconnectOk(ctx context.Context)
- func TelepresenceOk(ctx context.Context, args ...string) string
- func TelepresenceQuitOk(ctx context.Context)
- func TestContext(t *testing.T) context.Context
- func WithCluster(ctx context.Context, f func(ctx context.Context))
- func WithConfig(c context.Context, addConfig *client.Config) context.Context
- func WithConnection(np NamespacePair, f func(ctx context.Context, ch NamespacePair))
- func WithEnv(ctx context.Context, env map[string]string) context.Context
- func WithHelmAndService(h SingleService, f func(HelmAndService))
- func WithKubeConfigExtension(ctx context.Context, extProducer func(*api.Cluster) map[string]interface{}) context.Context
- func WithModuleRoot(ctx context.Context) context.Context
- func WithMultipleServices(np NamespacePair, name string, serviceCount int, f func(MultipleServices))
- func WithNamespacePair(ctx context.Context, suffix string, f func(NamespacePair))
- func WithSingleService(h NamespacePair, serviceName string, f func(SingleService))
- func WithUser(ctx context.Context, clusterUser string) context.Context
- func WithWorkingDir(ctx context.Context, dir string) context.Context
- type Cluster
- type Harness
- type HelmAndService
- type MultipleServices
- type NamespacePair
- type Runner
- type SingleService
- type Suite
Constants ¶
const TestUser = "telepresence-test-developer"
const TestUserAccount = "system:serviceaccount:default:" + TestUser
Variables ¶
This section is empty.
Functions ¶
func AddClusterSuite ¶
func AddClusterSuite(f func(context.Context) suite.TestingSuite)
AddClusterSuite adds a constructor for a test suite that requires a cluster to run to the default runner.
func AddConnectedSuite ¶
func AddConnectedSuite(suffix string, f func(NamespacePair) suite.TestingSuite)
AddConnectedSuite adds a constructor for a test suite that requires a cluster where a namespace pair has been initialized and telepresence is connected to the default runner.
func AddHelmAndServiceSuite ¶
func AddHelmAndServiceSuite(suffix, name string, f func(services HelmAndService) suite.TestingSuite)
AddHelmAndServiceSuite adds a constructor for a TestingSuite to the default runner that requires a cluster where a namespace pair has been initialized, a service has been installed, and telepresence has been installed using Helm.
func AddMultipleServicesSuite ¶
func AddMultipleServicesSuite(suffix, name string, f func(services MultipleServices) suite.TestingSuite)
AddMultipleServicesSuite adds a constructor for a test suite to the default runner that requires a cluster where a namespace pair has been initialized, multiple services has been installed, and telepresence is connected.
func AddNamespacePairSuite ¶
func AddNamespacePairSuite(suffix string, f func(NamespacePair) suite.TestingSuite)
AddNamespacePairSuite adds a constructor for a test suite that requires a cluster where a namespace pair has been initialized to the default runner.
func AddSingleServiceSuite ¶
func AddSingleServiceSuite(suffix, name string, f func(services SingleService) suite.TestingSuite)
AddSingleServiceSuite adds a constructor for a test suite to the default runner that requires a cluster where a namespace pair has been initialized, a service has been installed, and telepresence is connected.
func AppAndMgrNSName ¶
func ApplyEchoService ¶
func ApplyService ¶
func AssertDisconnectOutput ¶ added in v2.5.0
AssertDisconnectOutput asserts that the stdout contains the correct output from a telepresence quit command
func AssertQuitOutput ¶
AssertQuitOutput asserts that the stdout contains the correct output from a telepresence quit command
func Command ¶
Command creates and returns a dexec.Cmd initialized with the global environment from the cluster harness and any other environment that has been added using the WithEnv() function
func CreateNamespaces ¶
func DeleteNamespaces ¶
func DeleteSvcAndWorkload ¶
func GetGlobalHarness ¶
func GetWorkingDir ¶
func KubeConfig ¶
func Kubectl ¶
Kubectl runs kubectl with the default context and the given namespace, or in the default namespace if the given namespace is an empty string
func KubectlOut ¶
KubectlOut runs kubectl with the default context and the application namespace and returns its combined output
func Output ¶
Output runs the given command and arguments and returns its combined output and an error if the command failed.
func RolloutStatusWait ¶
func RunError ¶
RunError checks if the given err is a *exit.ExitError, and if so, extracts Stderr and the ExitCode from it.
func StartLocalHttpEchoServer ¶
StartLocalHttpEchoServer starts a local http server that echoes a line with the given name and the current URL path. The port is returned together with function that cancels the server.
func Telepresence ¶
Telepresence executes the CLI command in a new process
func TelepresenceCmd ¶
TelepresenceCmd creates a dexec.Cmd using the Command function. Before the command is created, the environment is extended with DEV_TELEPRESENCE_CONFIG_DIR from filelocation.AppUserConfigDir and DEV_TELEPRESENCE_LOG_DIR from filelocation.AppUserLogDir
func TelepresenceDisconnectOk ¶ added in v2.5.0
TelepresenceDisconnectOk tells telepresence to quit and asserts that the stdout contains the correct output
func TelepresenceOk ¶
TelepresenceOk executes the CLI command in a new process and requires the result to be OK
func TelepresenceQuitOk ¶
TelepresenceQuitOk tells telepresence to quit and asserts that the stdout contains the correct output
func WithConnection ¶
func WithConnection(np NamespacePair, f func(ctx context.Context, ch NamespacePair))
func WithHelmAndService ¶
func WithHelmAndService(h SingleService, f func(HelmAndService))
func WithKubeConfigExtension ¶
func WithModuleRoot ¶
WithModuleRoot set the working directory for the Command function to the module root.
func WithMultipleServices ¶
func WithMultipleServices(np NamespacePair, name string, serviceCount int, f func(MultipleServices))
func WithNamespacePair ¶
func WithNamespacePair(ctx context.Context, suffix string, f func(NamespacePair))
func WithSingleService ¶
func WithSingleService(h NamespacePair, serviceName string, f func(SingleService))
Types ¶
type Cluster ¶
type Cluster interface { CapturePodLogs(ctx context.Context, app, container, ns string) Executable() string GeneralError() error GlobalEnv() map[string]string InstallTrafficManager(ctx context.Context, managerNamespace string, appNamespaces ...string) error IsCI() bool Registry() string SetGeneralError(error) Suffix() string TelepresenceVersion() string UninstallTrafficManager(ctx context.Context, managerNamespace string) }
type Harness ¶
type Harness interface { Cluster PushHarness(ctx context.Context, setup func(ctx context.Context) bool, tearDown func(ctx context.Context)) RunSuite(suite.TestingSuite) HarnessContext() context.Context SetupSuite() HarnessT() *testing.T PopHarness() }
func NewContextHarness ¶
type HelmAndService ¶
type HelmAndService interface { SingleService }
type MultipleServices ¶
type MultipleServices interface { NamespacePair Name() string ServiceCount() int }
type NamespacePair ¶
type NamespacePair interface { Harness ApplyApp(ctx context.Context, name, workload string) ApplyEchoService(ctx context.Context, name string, port int) AppNamespace() string DeleteSvcAndWorkload(ctx context.Context, workload, name string) Kubectl(ctx context.Context, args ...string) error KubectlOut(ctx context.Context, args ...string) (string, error) ManagerNamespace() string RolloutStatusWait(ctx context.Context, workload string) error }
type Runner ¶
type Runner interface { AddClusterSuite(func(context.Context) suite.TestingSuite) AddNamespacePairSuite(suffix string, f func(NamespacePair) suite.TestingSuite) AddConnectedSuite(suffix string, f func(NamespacePair) suite.TestingSuite) AddHelmAndServiceSuite(suffix, name string, f func(HelmAndService) suite.TestingSuite) AddMultipleServicesSuite(suffix, name string, f func(MultipleServices) suite.TestingSuite) AddSingleServiceSuite(suffix, name string, f func(SingleService) suite.TestingSuite) RunTests(*testing.T) }
type SingleService ¶
type SingleService interface { NamespacePair ServiceName() string }