Documentation ¶
Index ¶
- type MockDispatcher
- func (m *MockDispatcher) Assignments(_ *api.AssignmentsRequest, stream api.Dispatcher_AssignmentsServer) error
- func (m *MockDispatcher) GetSessions() (*api.SessionRequest, []*api.SessionRequest)
- func (m *MockDispatcher) Heartbeat(context.Context, *api.HeartbeatRequest) (*api.HeartbeatResponse, error)
- func (m *MockDispatcher) Session(r *api.SessionRequest, stream api.Dispatcher_SessionServer) error
- func (m *MockDispatcher) SessionMessageChannel() chan<- *api.SessionMessage
- func (m *MockDispatcher) SetSessionHandler(s SessionHandler)
- func (m *MockDispatcher) Tasks(_ *api.TasksRequest, stream api.Dispatcher_TasksServer) error
- func (m *MockDispatcher) UpdateTaskStatus(context.Context, *api.UpdateTaskStatusRequest) (*api.UpdateTaskStatusResponse, error)
- type SessionHandler
- type TestController
- func (t *TestController) Close() error
- func (t *TestController) Prepare(ctx context.Context) error
- func (t *TestController) Remove(ctx context.Context) error
- func (t *TestController) Shutdown(ctx context.Context) error
- func (t *TestController) Start(ctx context.Context) error
- func (t *TestController) Terminate(ctx context.Context) error
- func (t *TestController) Update(ctx context.Context, task *api.Task) error
- func (t *TestController) Wait(ctx context.Context) error
- type TestExecutor
- func (e *TestExecutor) Configure(ctx context.Context, node *api.Node) error
- func (e *TestExecutor) Controller(t *api.Task) (exec.Controller, error)
- func (e *TestExecutor) Describe(ctx context.Context) (*api.NodeDescription, error)
- func (e *TestExecutor) SetNetworkBootstrapKeys([]*api.EncryptionKey) error
- func (e *TestExecutor) UpdateNodeDescription(newDesc *api.NodeDescription)
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 ¶
func (m *MockDispatcher) Assignments(_ *api.AssignmentsRequest, stream api.Dispatcher_AssignmentsServer) error
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 ¶
func (m *MockDispatcher) Heartbeat(context.Context, *api.HeartbeatRequest) (*api.HeartbeatResponse, error)
Heartbeat always successfully heartbeats
func (*MockDispatcher) Session ¶
func (m *MockDispatcher) Session(r *api.SessionRequest, stream api.Dispatcher_SessionServer) error
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 ¶
func (m *MockDispatcher) Tasks(_ *api.TasksRequest, stream api.Dispatcher_TasksServer) error
Tasks keeps an open stream until canceled
func (*MockDispatcher) UpdateTaskStatus ¶
func (m *MockDispatcher) UpdateTaskStatus(context.Context, *api.UpdateTaskStatusRequest) (*api.UpdateTaskStatusResponse, error)
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) 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.
type TestExecutor ¶
type TestExecutor struct {
// contains filtered or unexported fields
}
TestExecutor is executor for integration tests
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