agenttest

package
v2.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New added in v2.2.0

func New(t testing.TB, coderURL *url.URL, agentToken string, opts ...func(*agent.Options)) agent.Agent

New starts a new agent for use in tests. The agent will use the provided coder URL and session token. The options passed to agent.New() can be modified by passing an optional variadic func(*agent.Options). Returns the agent. Closing the agent is handled by the test cleanup. It is the responsibility of the caller to call coderdtest.AwaitWorkspaceAgents to ensure agent is connected.

Types

type Client

type Client struct {
	LastWorkspaceAgent func()
	// contains filtered or unexported fields
}

func NewClient

func NewClient(t testing.TB,
	logger slog.Logger,
	agentID uuid.UUID,
	manifest agentsdk.Manifest,
	statsChan chan *agentproto.Stats,
	coordinator tailnet.Coordinator,
) *Client

func (*Client) Close added in v2.8.0

func (c *Client) Close()

func (*Client) ConnectRPC added in v2.8.0

func (c *Client) ConnectRPC(ctx context.Context) (drpc.Conn, error)

func (*Client) GetLifecycleStates

func (c *Client) GetLifecycleStates() []codersdk.WorkspaceAgentLifecycle

func (*Client) GetMetadata

func (c *Client) GetMetadata() map[string]agentsdk.Metadata

func (*Client) GetStartup

func (c *Client) GetStartup() <-chan *agentproto.Startup

func (*Client) GetStartupLogs

func (c *Client) GetStartupLogs() []agentsdk.Log

func (*Client) PushDERPMapUpdate

func (c *Client) PushDERPMapUpdate(update *tailcfg.DERPMap) error

func (*Client) RewriteDERPMap added in v2.8.0

func (*Client) RewriteDERPMap(*tailcfg.DERPMap)

func (*Client) SetLogsChannel added in v2.9.0

func (c *Client) SetLogsChannel(ch chan<- *agentproto.BatchCreateLogsRequest)

func (*Client) SetServiceBannerFunc

func (c *Client) SetServiceBannerFunc(f func() (codersdk.ServiceBannerConfig, error))

type FakeAgentAPI added in v2.8.0

type FakeAgentAPI struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewFakeAgentAPI added in v2.8.0

func NewFakeAgentAPI(t testing.TB, logger slog.Logger, manifest *agentproto.Manifest, statsCh chan *agentproto.Stats) *FakeAgentAPI

func (*FakeAgentAPI) AppHealthCh added in v2.9.0

func (f *FakeAgentAPI) AppHealthCh() <-chan *agentproto.BatchUpdateAppHealthRequest

func (*FakeAgentAPI) BatchCreateLogs added in v2.8.0

func (*FakeAgentAPI) BatchUpdateAppHealths added in v2.8.0

func (*FakeAgentAPI) BatchUpdateMetadata added in v2.8.0

func (*FakeAgentAPI) GetLifecycleStates added in v2.9.0

func (f *FakeAgentAPI) GetLifecycleStates() []codersdk.WorkspaceAgentLifecycle

func (*FakeAgentAPI) GetManifest added in v2.8.0

func (*FakeAgentAPI) GetMetadata added in v2.9.0

func (f *FakeAgentAPI) GetMetadata() map[string]agentsdk.Metadata

func (*FakeAgentAPI) GetServiceBanner added in v2.8.0

func (*FakeAgentAPI) SetLogsChannel added in v2.9.0

func (f *FakeAgentAPI) SetLogsChannel(ch chan<- *agentproto.BatchCreateLogsRequest)

func (*FakeAgentAPI) SetServiceBannerFunc added in v2.8.0

func (f *FakeAgentAPI) SetServiceBannerFunc(fn func() (codersdk.ServiceBannerConfig, error))

func (*FakeAgentAPI) UpdateLifecycle added in v2.8.0

func (*FakeAgentAPI) UpdateStartup added in v2.8.0

func (*FakeAgentAPI) UpdateStats added in v2.8.0

Jump to

Keyboard shortcuts

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