helper

package
v0.0.0-...-c4d1043 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HttpEchoName = "http-echo"
	HttpEchoPort = 3000
)
View Source
const (
	TcpEchoName = "tcp-echo"
	TcpEchoPort = 1025
)
View Source
const (
	GATEWAY = "gateway"
	INGRESS = "ingress"
	KNATIVE = "knative"
)
View Source
const (
	TestrunnerName = "testrunner"
	TestRunnerPort = 1234

	// This response is given by the testrunner when the SimpleServer is started
	SimpleHttpResponse = `` /* 375-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func ExtraArgs

func ExtraArgs(args ...string) func(*InstallOptions)

func NewEchoHttp

func NewEchoHttp(namespace string) (*echoPod, error)

func NewEchoTcp

func NewEchoTcp(namespace string) (*echoPod, error)

func NewTestRunner

func NewTestRunner(namespace string) (*testRunner, error)

Types

type CurlOpts

type CurlOpts struct {
	Protocol          string
	Path              string
	Method            string
	Host              string
	Service           string
	CaFile            string
	Body              string
	Headers           map[string]string
	Port              int
	ReturnHeaders     bool
	ConnectionTimeout int
	Verbose           bool
	// WithoutStats sets the -s flag to prevent download stats from printing
	WithoutStats bool
}

type InstallOption

type InstallOption func(*InstallOptions)

type InstallOptions

type InstallOptions struct {
	GlooctlCommand []string
	Verbose        bool
}

type SoloTestHelper

type SoloTestHelper struct {
	*TestConfig
	TestRunner
}

This helper is meant to provide a standard way of deploying Gloo/GlooE to a k8s cluster during tests. It assumes that build and test assets are present in the `_output` and `_test` directories (these are configurable). Specifically, it expects the glooctl executable in the BuildAssetDir and a helm chart in TestAssetDir. It also assumes that a kubectl executable is on the PATH.

func NewSoloTestHelper

func NewSoloTestHelper(configFunc TestConfigFunc) (*SoloTestHelper, error)

func (*SoloTestHelper) ChartVersion

func (h *SoloTestHelper) ChartVersion() string

Return the version of the Helm chart

func (*SoloTestHelper) InstallGloo

func (h *SoloTestHelper) InstallGloo(deploymentType string, timeout time.Duration, options ...InstallOption) error

Installs Gloo (and, optionally, the test runner)

func (*SoloTestHelper) UninstallGloo

func (h *SoloTestHelper) UninstallGloo() error

does not pass the --all flag to glooctl uninstall

func (*SoloTestHelper) UninstallGlooAll

func (h *SoloTestHelper) UninstallGlooAll() error

passes the --all flag to glooctl uninstall

type TestConfig

type TestConfig struct {
	// All relative paths will assume this as the base directory. This is usually the project base directory.
	RootDir string
	// The directory holding the test assets. Must be relative to RootDir.
	TestAssetDir string
	// The directory holding the build assets. Must be relative to RootDir.
	BuildAssetDir string
	// Helm chart name
	HelmChartName string
	// Name of the helm index file name
	HelmRepoIndexFileName string
	// The namespace gloo (and the test runner) will be installed to. If empty, will use the helm chart version.
	InstallNamespace string
	// Name of the glooctl executable
	GlooctlExecName string
	// If provided, the licence key to install the enterprise version of Gloo
	LicenseKey string
	// Determines whether the test runner pod gets deployed
	DeployTestRunner bool

	// If true, glooctl will be run with a -v flag
	Verbose bool
	// contains filtered or unexported fields
}

type TestConfigFunc

type TestConfigFunc func(defaults TestConfig) TestConfig

Function to provide/override test configuration. Default values will be passed in.

type TestRunner

type TestRunner interface {
	Deploy(timeout time.Duration) error
	Terminate() error
	Exec(command ...string) (string, error)
	TestRunnerAsync(args ...string) (io.Reader, chan struct{}, error)
	// Checks the response of the request
	CurlEventuallyShouldRespond(opts CurlOpts, substr string, ginkgoOffset int, timeout ...time.Duration)
	// CHecks all of the output of the curl command
	CurlEventuallyShouldOutput(opts CurlOpts, substr string, ginkgoOffset int, timeout ...time.Duration)
	Curl(opts CurlOpts) (string, error)
}

Jump to

Keyboard shortcuts

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