agenttest

package
v2.3.3 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: AGPL-3.0 Imports: 18 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()
	PatchWorkspaceLogs   func() error
	GetServiceBannerFunc func() (codersdk.ServiceBannerConfig, error)
	// contains filtered or unexported fields
}

func NewClient

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

func (*Client) DERPMapUpdates

func (c *Client) DERPMapUpdates(_ context.Context) (<-chan agentsdk.DERPMapUpdate, io.Closer, error)

func (*Client) GetLifecycleStates

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

func (*Client) GetMetadata

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

func (*Client) GetServiceBanner

func (c *Client) GetServiceBanner(ctx context.Context) (codersdk.ServiceBannerConfig, error)

func (*Client) GetStartup

func (c *Client) GetStartup() agentsdk.PostStartupRequest

func (*Client) GetStartupLogs

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

func (*Client) Listen

func (c *Client) Listen(_ context.Context) (net.Conn, error)

func (*Client) Manifest

func (c *Client) Manifest(_ context.Context) (agentsdk.Manifest, error)

func (*Client) PatchLogs

func (c *Client) PatchLogs(ctx context.Context, logs agentsdk.PatchLogs) error

func (*Client) PostAppHealth

func (c *Client) PostAppHealth(ctx context.Context, req agentsdk.PostAppHealthsRequest) error

func (*Client) PostLifecycle

func (c *Client) PostLifecycle(ctx context.Context, req agentsdk.PostLifecycleRequest) error

func (*Client) PostMetadata

func (c *Client) PostMetadata(ctx context.Context, req agentsdk.PostMetadataRequest) error

func (*Client) PostStartup

func (c *Client) PostStartup(ctx context.Context, startup agentsdk.PostStartupRequest) error

func (*Client) PushDERPMapUpdate

func (c *Client) PushDERPMapUpdate(update agentsdk.DERPMapUpdate) error

func (*Client) ReportStats

func (c *Client) ReportStats(ctx context.Context, _ slog.Logger, statsChan <-chan *agentsdk.Stats, setInterval func(time.Duration)) (io.Closer, error)

func (*Client) SetServiceBannerFunc

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

Jump to

Keyboard shortcuts

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