embedded

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentRedisPort

func CurrentRedisPort(ctx context.Context) (port int)

CurrentRedisPort getter to return embedded redis port. returns -1 if it's not initialized or started

func CurrentRedisServer added in v0.14.0

func CurrentRedisServer(ctx context.Context) *miniredis.Miniredis

CurrentRedisServer getter to return embedded redis. returns nil if it's not initialized or started

func Redis

func Redis(opts ...RedisOptions) suitetest.PackageOptions

Redis start redis at random port (32768-65535) on test package level. The actual port get be get using CurrentRedisPort

func RedisWithPort

func RedisWithPort(port int) suitetest.PackageOptions

RedisWithPort start redis at given port (must between 32768 and 65535) on test package level. Deprecated, use Redis(...) to set RedisConfig.Port

func ServerTLSWithCerts

func ServerTLSWithCerts(opts ...func(src *TLSCerts)) (*tls.Config, error)

ServerTLSWithCerts construct a tls.Config with certificates in a given filesystem. The setup Server TLS, following config are required: - filesystem to load files from. Default to "." - path of certificate file in PEM format, default to "testdata/server.crt" - path of certificate private key file in unencrypted PEM format, default to "testdata/server.key" - path of at least one CA certificate in PEM format, default to "testdata/ca.crt" Note: if any file is missing or not readable, the result tls.Config might not works as expected

func WithRedis

func WithRedis(opts ...RedisOptions) test.Options

WithRedis start redis at random port (32768-65535) on per test basis The actual port get be get using CurrentRedisPort

Types

type RedisConfig

type RedisConfig struct {
	// Port must between 32768 and 65535
	Port int
	// TLS when set, the redis server is run in TLS mode.
	// Note: duo to internal implementation, When running in TLS mode, the Port is ignored
	TLS *tls.Config
}

type RedisOptions

type RedisOptions func(cfg *RedisConfig)

func EnableTLS

func EnableTLS(certs ...func(src *TLSCerts)) RedisOptions

type TLSCerts

type TLSCerts struct {
	FS   fs.FS
	Cert string
	Key  string
	CAs  []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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