Documentation
¶
Index ¶
- Variables
- func DefaultConfig() config.Config
- func LogConfig() logger.Config
- func NewRPCConn(conf config.Config, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func RandomPort() string
- func RandomPortConfig(conf config.Config) config.Config
- func RandomString(n int) string
- func SetLogOutput(l *logger.Logger, t *testing.T)
- func TempDirConfig(conf config.Config) config.Config
- func TestifyConfig(conf config.Config) config.Config
- func TestingWriter(t *testing.T) io.Writer
- type Funnel
- func (f *Funnel) AddNode(conf config.Config)
- func (f *Funnel) AddRPCClient(opts ...grpc.DialOption) error
- func (f *Funnel) Cancel(id string) error
- func (f *Funnel) Cleanup()
- func (f *Funnel) CleanupTestServerContainer()
- func (f *Funnel) Get(id string) *tes.Task
- func (f *Funnel) GetView(id string, view tes.TaskView) *tes.Task
- func (f *Funnel) ListNodes() []*pbs.Node
- func (f *Funnel) ListView(view tes.TaskView) []*tes.Task
- func (f *Funnel) PollForServerStart() error
- func (f *Funnel) ReadFile(name string) string
- func (f *Funnel) Run(s string) string
- func (f *Funnel) RunE(s string) (string, error)
- func (f *Funnel) RunTask(t *tes.Task) (string, error)
- func (f *Funnel) StartServer()
- func (f *Funnel) StartServerInDocker(imageName string, extraArgs []string)
- func (f *Funnel) Tempdir() string
- func (f *Funnel) Wait(id string) *tes.Task
- func (f *Funnel) WaitForDockerDestroy(id string)
- func (f *Funnel) WaitForExec(id string, i int)
- func (f *Funnel) WaitForRunning(ids ...string)
- func (f *Funnel) WriteFile(name string, content string)
Constants ¶
This section is empty.
Variables ¶
var HelloWorld = &tes.Task{ Executors: []*tes.Executor{ { Image: "alpine", Command: []string{"echo", "hello world"}, }, }, }
HelloWorld is a simple, valid task that is easy to reuse in tests.
Functions ¶
func DefaultConfig ¶
DefaultConfig returns a default configuration useful for testing, including temp storage dirs, random ports, S3 + minio config, etc.
func NewRPCConn ¶
func NewRPCConn(conf config.Config, opts ...grpc.DialOption) (*grpc.ClientConn, error)
NewRPCConn returns a new grpc.ClientConn, to make creating TES clients easier.
func RandomPort ¶
func RandomPort() string
RandomPort returns a random port string between 10000 and 20000.
func RandomPortConfig ¶
RandomPortConfig returns a modified config with random HTTP and RPC ports.
func RandomString ¶
RandomString generates a random string of length n
func SetLogOutput ¶
SetLogOutput provides a method for connecting funnel logso the the test logger
func TempDirConfig ¶
TempDirConfig returns a modified config with workdir and db path set to a temp. directory.
func TestifyConfig ¶
TestifyConfig modifies a ports, directory paths, etc. to avoid conflicts between tests.
Types ¶
type Funnel ¶
type Funnel struct { // Clients RPC tes.TaskServiceClient HTTP *client.Client Docker *docker.Client // Config Conf config.Config StorageDir string // Components DB server.Database Server *server.Server Scheduler *scheduler.Scheduler SDB scheduler.Database Srv *servercmd.Server // contains filtered or unexported fields }
Funnel provides a test server and RPC/HTTP clients
func NewFunnel ¶
NewFunnel creates a new funnel test server with some test configuration automatically set: random ports, temp work dir, etc.
func (*Funnel) AddRPCClient ¶
func (f *Funnel) AddRPCClient(opts ...grpc.DialOption) error
AddRPCClient configures and connects the RPC client to the server.
func (*Funnel) CleanupTestServerContainer ¶
func (f *Funnel) CleanupTestServerContainer()
CleanupTestServerContainer stops the docker container running the test funnel server
func (*Funnel) PollForServerStart ¶
PollForServerStart polls the server http address to check if the server is running.
func (*Funnel) StartServerInDocker ¶
StartServerInDocker starts a funnel server in a docker image
func (*Funnel) WaitForDockerDestroy ¶
WaitForDockerDestroy waits for a "destroy" event from docker for the given container ID
TODO probably could use docker.ContainerWait() https://godoc.org/github.com/moby/moby/client#Client.ContainerWait
func (*Funnel) WaitForExec ¶
WaitForExec waits for a task to reach the given executor index. 1 is the first executor.
func (*Funnel) WaitForRunning ¶
WaitForRunning waits for a task to be in the RUNNING state