testutils

package
v0.0.0-...-35d28e4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockDispatcher

type MockDispatcher struct {
	Addr string
	// contains filtered or unexported fields
}

MockDispatcher is a fake dispatcher that one agent at a time can connect to

func NewMockDispatcher

func NewMockDispatcher(t *testing.T, secConfig *ca.SecurityConfig, local bool) (*MockDispatcher, func())

NewMockDispatcher starts and returns a mock dispatcher instance that can be connected to

func (*MockDispatcher) Assignments

Assignments keeps an open stream until canceled

func (*MockDispatcher) GetSessions

func (m *MockDispatcher) GetSessions() (*api.SessionRequest, []*api.SessionRequest)

GetSessions return all the established and closed sessions

func (*MockDispatcher) Heartbeat

Heartbeat always successfully heartbeats

func (*MockDispatcher) Session

Session allows a session to be established, and sends the node info

func (*MockDispatcher) SessionMessageChannel

func (m *MockDispatcher) SessionMessageChannel() chan<- *api.SessionMessage

SessionMessageChannel returns a writable channel to inject session messages

func (*MockDispatcher) SetSessionHandler

func (m *MockDispatcher) SetSessionHandler(s SessionHandler)

SetSessionHandler lets you inject a custom function to handle session requests

func (*MockDispatcher) Tasks

Tasks keeps an open stream until canceled

func (*MockDispatcher) UpdateTaskStatus

UpdateTaskStatus is not implemented

type SessionHandler

type SessionHandler func(*api.SessionRequest, api.Dispatcher_SessionServer) error

SessionHandler is an injectable function that can be used handle session requests

type TestController

type TestController struct {
	// contains filtered or unexported fields
}

TestController is dummy channel based controller for tests.

func (*TestController) Close

func (t *TestController) Close() error

Close does nothing.

func (*TestController) Prepare

func (t *TestController) Prepare(ctx context.Context) error

Prepare does nothing.

func (*TestController) Remove

func (t *TestController) Remove(ctx context.Context) error

Remove does nothing.

func (*TestController) Shutdown

func (t *TestController) Shutdown(ctx context.Context) error

Shutdown closes internal channel

func (*TestController) Start

func (t *TestController) Start(ctx context.Context) error

Start does nothing.

func (*TestController) Terminate

func (t *TestController) Terminate(ctx context.Context) error

Terminate closes internal channel if it wasn't closed before.

func (*TestController) Update

func (t *TestController) Update(ctx context.Context, task *api.Task) error

Update does nothing.

func (*TestController) Wait

func (t *TestController) Wait(ctx context.Context) error

Wait waits on internal channel.

type TestExecutor

type TestExecutor struct {
	// contains filtered or unexported fields
}

TestExecutor is executor for integration tests

func (*TestExecutor) Configure

func (e *TestExecutor) Configure(ctx context.Context, node *api.Node) error

Configure does nothing.

func (*TestExecutor) Controller

func (e *TestExecutor) Controller(t *api.Task) (exec.Controller, error)

Controller returns TestController.

func (*TestExecutor) Describe

func (e *TestExecutor) Describe(ctx context.Context) (*api.NodeDescription, error)

Describe just returns empty NodeDescription.

func (*TestExecutor) SetNetworkBootstrapKeys

func (e *TestExecutor) SetNetworkBootstrapKeys([]*api.EncryptionKey) error

SetNetworkBootstrapKeys does nothing.

func (*TestExecutor) UpdateNodeDescription

func (e *TestExecutor) UpdateNodeDescription(newDesc *api.NodeDescription)

UpdateNodeDescription sets the node description on the test executor

Jump to

Keyboard shortcuts

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