Documentation ¶
Overview ¶
Package testenv provides functions for creating test servers for testing.
Index ¶
- func MakeTestServer(t *testing.T, opts ...TestServerOptFunc) (process *service.TeleportProcess)
- func NewTCPListener(t *testing.T, lt service.ListenerType, fds *[]*servicecfg.FileDescriptor) string
- func WithInsecureDevMode(t *testing.T, mode bool)
- func WithResyncInterval(t *testing.T, interval time.Duration)
- type TestServerOptFunc
- func WithAuthConfig(fn func(*servicecfg.AuthConfig)) TestServerOptFunc
- func WithAuthPreference(authPref types.AuthPreference) TestServerOptFunc
- func WithBootstrap(bootstrap ...types.Resource) TestServerOptFunc
- func WithClusterName(t *testing.T, n string) TestServerOptFunc
- func WithConfig(fn func(cfg *servicecfg.Config)) TestServerOptFunc
- func WithHostname(hostname string) TestServerOptFunc
- func WithSSHLabel(key, value string) TestServerOptFunc
- func WithSSHPublicAddrs(addrs ...string) TestServerOptFunc
- type TestServersOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeTestServer ¶
func MakeTestServer(t *testing.T, opts ...TestServerOptFunc) (process *service.TeleportProcess)
MakeTestServer creates a Teleport Server for testing.
func NewTCPListener ¶
func NewTCPListener(t *testing.T, lt service.ListenerType, fds *[]*servicecfg.FileDescriptor) string
NewTCPListener creates a new TCP listener on 127.0.0.1:0, adds it to the FileDescriptor slice (with the specified type) and returns its actual local address as a string (for use in configuration). Takes a pointer to the slice so that it's convenient to call in the middle of a FileConfig or Config struct literal.
func WithInsecureDevMode ¶
WithInsecureDevMode is a test helper that sets insecure dev mode and resets it in test cleanup. It is NOT SAFE to use in parallel tests, because it modifies a global. To run insecure dev mode tests in parallel, group them together under a parent test and then run them as parallel subtests. and call WithInsecureDevMode before running all the tests in parallel.
func WithResyncInterval ¶
WithResyncInterval is a test helper that sets the tunnel resync interval and resets it in test cleanup. Useful to substantially speedup test cluster setup - passing 0 for the interval selects a reasonably fast default of 100ms. It is NOT SAFE to use in parallel tests, because it modifies a global.
Types ¶
type TestServerOptFunc ¶
type TestServerOptFunc func(o *TestServersOpts)
func WithAuthConfig ¶
func WithAuthConfig(fn func(*servicecfg.AuthConfig)) TestServerOptFunc
func WithAuthPreference ¶
func WithAuthPreference(authPref types.AuthPreference) TestServerOptFunc
func WithBootstrap ¶
func WithBootstrap(bootstrap ...types.Resource) TestServerOptFunc
func WithClusterName ¶
func WithClusterName(t *testing.T, n string) TestServerOptFunc
func WithConfig ¶
func WithConfig(fn func(cfg *servicecfg.Config)) TestServerOptFunc
func WithHostname ¶
func WithHostname(hostname string) TestServerOptFunc
func WithSSHLabel ¶
func WithSSHLabel(key, value string) TestServerOptFunc
func WithSSHPublicAddrs ¶
func WithSSHPublicAddrs(addrs ...string) TestServerOptFunc
type TestServersOpts ¶
type TestServersOpts struct { Bootstrap []types.Resource ConfigFuncs []func(cfg *servicecfg.Config) }