Documentation
¶
Index ¶
- func New(t testing.TB, coderURL *url.URL, agentToken string, ...) agent.Agent
- type Client
- func (c *Client) Close()
- func (c *Client) ConnectRPC24(ctx context.Context) (agentproto.DRPCAgentClient24, proto.DRPCTailnetClient24, error)
- func (c *Client) GetConnectionReports() []*agentproto.ReportConnectionRequest
- func (c *Client) GetLifecycleStates() []codersdk.WorkspaceAgentLifecycle
- func (c *Client) GetMetadata() map[string]agentsdk.Metadata
- func (c *Client) GetStartup() <-chan *agentproto.Startup
- func (c *Client) GetStartupLogs() []agentsdk.Log
- func (c *Client) PushDERPMapUpdate(update *tailcfg.DERPMap) error
- func (*Client) RewriteDERPMap(*tailcfg.DERPMap)
- func (c *Client) SetAnnouncementBannersFunc(f func() ([]codersdk.BannerConfig, error))
- func (c *Client) SetLogsChannel(ch chan<- *agentproto.BatchCreateLogsRequest)
- type FakeAgentAPI
- func (f *FakeAgentAPI) AppHealthCh() <-chan *agentproto.BatchUpdateAppHealthRequest
- func (f *FakeAgentAPI) BatchCreateLogs(ctx context.Context, req *agentproto.BatchCreateLogsRequest) (*agentproto.BatchCreateLogsResponse, error)
- func (f *FakeAgentAPI) BatchUpdateAppHealths(ctx context.Context, req *agentproto.BatchUpdateAppHealthRequest) (*agentproto.BatchUpdateAppHealthResponse, error)
- func (f *FakeAgentAPI) BatchUpdateMetadata(ctx context.Context, req *agentproto.BatchUpdateMetadataRequest) (*agentproto.BatchUpdateMetadataResponse, error)
- func (f *FakeAgentAPI) GetAnnouncementBanners(context.Context, *agentproto.GetAnnouncementBannersRequest) (*agentproto.GetAnnouncementBannersResponse, error)
- func (f *FakeAgentAPI) GetConnectionReports() []*agentproto.ReportConnectionRequest
- func (f *FakeAgentAPI) GetLifecycleStates() []codersdk.WorkspaceAgentLifecycle
- func (f *FakeAgentAPI) GetManifest(context.Context, *agentproto.GetManifestRequest) (*agentproto.Manifest, error)
- func (f *FakeAgentAPI) GetMetadata() map[string]agentsdk.Metadata
- func (f *FakeAgentAPI) GetResourcesMonitoringConfiguration(_ context.Context, _ *agentproto.GetResourcesMonitoringConfigurationRequest) (*agentproto.GetResourcesMonitoringConfigurationResponse, error)
- func (*FakeAgentAPI) GetServiceBanner(context.Context, *agentproto.GetServiceBannerRequest) (*agentproto.ServiceBanner, error)
- func (f *FakeAgentAPI) GetTimings() []*agentproto.Timing
- func (f *FakeAgentAPI) PushResourcesMonitoringUsage(_ context.Context, req *agentproto.PushResourcesMonitoringUsageRequest) (*agentproto.PushResourcesMonitoringUsageResponse, error)
- func (f *FakeAgentAPI) ReportConnection(_ context.Context, req *agentproto.ReportConnectionRequest) (*emptypb.Empty, error)
- func (f *FakeAgentAPI) ScriptCompleted(_ context.Context, req *agentproto.WorkspaceAgentScriptCompletedRequest) (*agentproto.WorkspaceAgentScriptCompletedResponse, error)
- func (f *FakeAgentAPI) SetAnnouncementBannersFunc(fn func() ([]codersdk.BannerConfig, error))
- func (f *FakeAgentAPI) SetLogsChannel(ch chan<- *agentproto.BatchCreateLogsRequest)
- func (f *FakeAgentAPI) UpdateLifecycle(_ context.Context, req *agentproto.UpdateLifecycleRequest) (*agentproto.Lifecycle, error)
- func (f *FakeAgentAPI) UpdateStartup(ctx context.Context, req *agentproto.UpdateStartupRequest) (*agentproto.Startup, error)
- func (f *FakeAgentAPI) UpdateStats(ctx context.Context, req *agentproto.UpdateStatsRequest) (*agentproto.UpdateStatsResponse, error)
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 (*Client) ConnectRPC24 ¶ added in v2.20.0
func (c *Client) ConnectRPC24(ctx context.Context) ( agentproto.DRPCAgentClient24, proto.DRPCTailnetClient24, error, )
func (*Client) GetConnectionReports ¶ added in v2.21.0
func (c *Client) GetConnectionReports() []*agentproto.ReportConnectionRequest
func (*Client) GetLifecycleStates ¶
func (c *Client) GetLifecycleStates() []codersdk.WorkspaceAgentLifecycle
func (*Client) GetStartup ¶
func (c *Client) GetStartup() <-chan *agentproto.Startup
func (*Client) GetStartupLogs ¶
func (*Client) PushDERPMapUpdate ¶
func (*Client) RewriteDERPMap ¶ added in v2.8.0
func (*Client) SetAnnouncementBannersFunc ¶ added in v2.12.0
func (c *Client) SetAnnouncementBannersFunc(f func() ([]codersdk.BannerConfig, error))
func (*Client) SetLogsChannel ¶ added in v2.9.0
func (c *Client) SetLogsChannel(ch chan<- *agentproto.BatchCreateLogsRequest)
type FakeAgentAPI ¶ added in v2.8.0
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 (f *FakeAgentAPI) BatchCreateLogs(ctx context.Context, req *agentproto.BatchCreateLogsRequest) (*agentproto.BatchCreateLogsResponse, error)
func (*FakeAgentAPI) BatchUpdateAppHealths ¶ added in v2.8.0
func (f *FakeAgentAPI) BatchUpdateAppHealths(ctx context.Context, req *agentproto.BatchUpdateAppHealthRequest) (*agentproto.BatchUpdateAppHealthResponse, error)
func (*FakeAgentAPI) BatchUpdateMetadata ¶ added in v2.8.0
func (f *FakeAgentAPI) BatchUpdateMetadata(ctx context.Context, req *agentproto.BatchUpdateMetadataRequest) (*agentproto.BatchUpdateMetadataResponse, error)
func (*FakeAgentAPI) GetAnnouncementBanners ¶ added in v2.12.0
func (f *FakeAgentAPI) GetAnnouncementBanners(context.Context, *agentproto.GetAnnouncementBannersRequest) (*agentproto.GetAnnouncementBannersResponse, error)
func (*FakeAgentAPI) GetConnectionReports ¶ added in v2.21.0
func (f *FakeAgentAPI) GetConnectionReports() []*agentproto.ReportConnectionRequest
func (*FakeAgentAPI) GetLifecycleStates ¶ added in v2.9.0
func (f *FakeAgentAPI) GetLifecycleStates() []codersdk.WorkspaceAgentLifecycle
func (*FakeAgentAPI) GetManifest ¶ added in v2.8.0
func (f *FakeAgentAPI) GetManifest(context.Context, *agentproto.GetManifestRequest) (*agentproto.Manifest, error)
func (*FakeAgentAPI) GetMetadata ¶ added in v2.9.0
func (f *FakeAgentAPI) GetMetadata() map[string]agentsdk.Metadata
func (*FakeAgentAPI) GetResourcesMonitoringConfiguration ¶ added in v2.20.0
func (f *FakeAgentAPI) GetResourcesMonitoringConfiguration(_ context.Context, _ *agentproto.GetResourcesMonitoringConfigurationRequest) (*agentproto.GetResourcesMonitoringConfigurationResponse, error)
func (*FakeAgentAPI) GetServiceBanner ¶ added in v2.8.0
func (*FakeAgentAPI) GetServiceBanner(context.Context, *agentproto.GetServiceBannerRequest) (*agentproto.ServiceBanner, error)
func (*FakeAgentAPI) GetTimings ¶ added in v2.16.0
func (f *FakeAgentAPI) GetTimings() []*agentproto.Timing
func (*FakeAgentAPI) PushResourcesMonitoringUsage ¶ added in v2.20.0
func (f *FakeAgentAPI) PushResourcesMonitoringUsage(_ context.Context, req *agentproto.PushResourcesMonitoringUsageRequest) (*agentproto.PushResourcesMonitoringUsageResponse, error)
func (*FakeAgentAPI) ReportConnection ¶ added in v2.20.0
func (f *FakeAgentAPI) ReportConnection(_ context.Context, req *agentproto.ReportConnectionRequest) (*emptypb.Empty, error)
func (*FakeAgentAPI) ScriptCompleted ¶ added in v2.16.0
func (f *FakeAgentAPI) ScriptCompleted(_ context.Context, req *agentproto.WorkspaceAgentScriptCompletedRequest) (*agentproto.WorkspaceAgentScriptCompletedResponse, error)
func (*FakeAgentAPI) SetAnnouncementBannersFunc ¶ added in v2.12.0
func (f *FakeAgentAPI) SetAnnouncementBannersFunc(fn func() ([]codersdk.BannerConfig, error))
func (*FakeAgentAPI) SetLogsChannel ¶ added in v2.9.0
func (f *FakeAgentAPI) SetLogsChannel(ch chan<- *agentproto.BatchCreateLogsRequest)
func (*FakeAgentAPI) UpdateLifecycle ¶ added in v2.8.0
func (f *FakeAgentAPI) UpdateLifecycle(_ context.Context, req *agentproto.UpdateLifecycleRequest) (*agentproto.Lifecycle, error)
func (*FakeAgentAPI) UpdateStartup ¶ added in v2.8.0
func (f *FakeAgentAPI) UpdateStartup(ctx context.Context, req *agentproto.UpdateStartupRequest) (*agentproto.Startup, error)
func (*FakeAgentAPI) UpdateStats ¶ added in v2.8.0
func (f *FakeAgentAPI) UpdateStats(ctx context.Context, req *agentproto.UpdateStatsRequest) (*agentproto.UpdateStatsResponse, error)
Click to show internal directories.
Click to hide internal directories.