framework

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GetDockerHostAddr = docker.HostAddr
)

Functions

func GetTLSCertPath

func GetTLSCertPath() string

func GetTLSKeyPath

func GetTLSKeyPath() string

func Run

func Run(t *testing.T, i interface{})

Types

type FTPSettings

type FTPSettings struct {
	Addr string
	User string
	Pass string
}

type Initable

type Initable interface {
	Init(*testing.T)
}

type MysqlSettings

type MysqlSettings struct {
	// DatabaseName is name of a database that will be created
	DatabaseName string
	// The source dir from migration files.
	MigrationDir string
	// Password for mysql user.
	Password string
	// Port address used for mysql service.
	Port string
}

type PubSubSettings

type PubSubSettings struct {
	ProjectID          string
	TopicSubscriptions []TopicSubscriptions
}

type RedisSettings

type RedisSettings struct {
	Port     string
	Password string
}

type RuntimeType

type RuntimeType int

RuntimeType distinguish between different ways of sut execution.

const (
	// RuntimeTypeService indicates that system under test works as a service.
	RuntimeTypeService RuntimeType = iota

	// RuntimeTypeCommand indicates that system under test is a simble binary that will
	// terminate after execution.
	RuntimeTypeCommand
)

type Settings

type Settings struct {
	MySQL  *MysqlSettings
	SUT    *SutSettings
	PubSub *PubSubSettings
	Redis  *RedisSettings
	FTP    *FTPSettings
	TLS    *TLSSettings
}

type SutSettings

type SutSettings struct {
	// Envs allows to pass custom env to system under test container.
	Envs []string
	// Dir is a path to directory that collect system under test source for which binary shuld be build.
	Dir string
	// Ports is a collection of ports that sut binary require, those ports will be forwarded to local host with the
	// same port mapping.
	Ports []int

	// RuntimeType Type of system under test runtime. In case of service runtime sut component will
	// be executed once, but when runtime type is set to command (terminates after execution) sut component
	// needs to be re-executed for each testcase.
	RuntimeType RuntimeType
}

SutSettings system under test settings used to build and executed sut in docker container.

type TLSSettings

type TLSSettings struct {
	// Host is a list of DSName or IP that will be added as a Subject Alternative Names.
	Hosts []string
}

TLSSettings allows to pass additional that will be used during generation certs.

type TestEnviorment

type TestEnviorment struct {
	SUT component.Component

	M *testing.M
	// contains filtered or unexported fields
}

func TestEnv

func TestEnv(m *testing.M) *TestEnviorment

func (*TestEnviorment) Prepare

func (env *TestEnviorment) Prepare(cli *docker.Docker) error

func (*TestEnviorment) Run

func (env *TestEnviorment) Run()

func (*TestEnviorment) Start

func (env *TestEnviorment) Start(ctx context.Context) error

func (*TestEnviorment) StartSutInCommandMode

func (env *TestEnviorment) StartSutInCommandMode() error

func (*TestEnviorment) Stop

func (env *TestEnviorment) Stop(ctx context.Context) error

func (*TestEnviorment) StopSutInCommandMode

func (env *TestEnviorment) StopSutInCommandMode(tcName string) error

func (*TestEnviorment) WithFTP

func (env *TestEnviorment) WithFTP(settings FTPSettings) *TestEnviorment

func (*TestEnviorment) WithMySQL

func (env *TestEnviorment) WithMySQL(settings MysqlSettings) *TestEnviorment

func (*TestEnviorment) WithPubSub

func (env *TestEnviorment) WithPubSub(settings PubSubSettings) *TestEnviorment

func (*TestEnviorment) WithRedis

func (env *TestEnviorment) WithRedis(settings RedisSettings) *TestEnviorment

func (*TestEnviorment) WithSUT

func (env *TestEnviorment) WithSUT(settings SutSettings) *TestEnviorment

func (*TestEnviorment) WithTLS

func (env *TestEnviorment) WithTLS(settings TLSSettings) *TestEnviorment

func (*TestEnviorment) WriteComponentLogs

func (env *TestEnviorment) WriteComponentLogs(ctx context.Context, cpnt component.Component, prefix string) error

func (*TestEnviorment) WriteLogs

func (env *TestEnviorment) WriteLogs(ctx context.Context, tcName string) error

type TopicSubscriptions

type TopicSubscriptions struct {
	Topic         string
	Subscriptions []string
}

Directories

Path Synopsis
ftp
sut

Jump to

Keyboard shortcuts

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