Documentation ¶
Index ¶
Constants ¶
const ( HttpEchoName = "http-echo" HttpEchoPort = 3000 )
const ( TcpEchoName = "tcp-echo" TcpEchoPort = 1025 )
const ( GATEWAY = "gateway" INGRESS = "ingress" KNATIVE = "knative" )
const ( TestServerName = "testserver" TestServerPort = 1234 // This response is given by the testserver when the SimpleServer is started SimpleHttpResponse = `` /* 851-byte string literal not displayed */ SimpleHttpResponseArm = `` /* 807-byte string literal not displayed */ )
Variables ¶
var (
ErrCannotCurl = errors.New("cannot curl")
)
Functions ¶
func ExtraArgs ¶
func ExtraArgs(args ...string) func(*InstallOptions)
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 LogResponses bool // WithoutStats sets the -s flag to prevent download stats from printing WithoutStats bool // Optional SNI name to resolve domain to when sending request Sni string SelfSigned bool }
type InstallOption ¶
type InstallOption func(*InstallOptions)
type InstallOptions ¶
type SoloTestHelper ¶
type SoloTestHelper struct { *TestConfig TestUpstreamServer }
func NewSoloTestHelper ¶
func NewSoloTestHelper(configFunc TestConfigFunc) (*SoloTestHelper, error)
NewSoloTestHelper 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 (*SoloTestHelper) ChartVersion ¶
func (h *SoloTestHelper) ChartVersion() string
Return the version of the Helm chart
func (*SoloTestHelper) InstallGloo ¶
func (h *SoloTestHelper) InstallGloo(ctx context.Context, deploymentType string, timeout time.Duration, options ...InstallOption) error
Installs Gloo (and, optionally, the test server)
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 server) 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 server pod gets deployed DeployTestServer bool // Install a released version of gloo. This is the value of the github tag that may have a leading 'v' ReleasedVersion string // 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 TestContainer ¶
type TestContainer interface { DeployResources(timeout time.Duration) error TerminatePod() error DeleteService() error TerminatePodAndDeleteService() error CanCurl() bool // Checks the response of the request eventually meets expectation CurlEventuallyShouldRespond(opts CurlOpts, substr string, ginkgoOffset int, timeout ...time.Duration) // Checks all of the output of the curl command eventually meets expectation CurlEventuallyShouldOutput(opts CurlOpts, substr string, ginkgoOffset int, timeout ...time.Duration) Curl(opts CurlOpts) (string, error) Exec(command ...string) (string, error) ExecAsync(args ...string) (io.Reader, chan struct{}, error) }
A TestContainer is a general-purpose abstraction over a container in which we might execute cURL or other, arbitrary commands via kubectl.
func NewEchoHttp ¶
func NewEchoHttp(namespace string) (TestContainer, error)
func NewEchoTcp ¶
func NewEchoTcp(namespace string) (TestContainer, error)
type TestUpstreamServer ¶
type TestUpstreamServer interface { TestContainer DeployServer(timeout time.Duration) error DeployServerTls(timeout time.Duration, crt, key []byte) error }
A TestUpstreamServer is an extension of a TestContainer which is typically run with the defaultTestServerImage. It is used to deploy test http/https services
func NewTestServer ¶
func NewTestServer(namespace string) (TestUpstreamServer, error)