agenttest
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- func New(t testing.TB, coderURL *url.URL, agentToken string, ...) agent.Agent
- type Client
- func (c *Client) Close()
- func (c *Client) ConnectRPC25(ctx context.Context) (agentproto.DRPCAgentClient25, proto.DRPCTailnetClient25, 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¶
funcNew¶added inv2.2.0
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 optionalvariadic 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.AwaitWorkspaceAgentsto ensure agent is connected.
Types¶
typeClient¶
type Client struct {LastWorkspaceAgent func()// contains filtered or unexported fields}
func (*Client)ConnectRPC25¶added inv2.23.0
func (c *Client) ConnectRPC25(ctxcontext.Context) (agentproto.DRPCAgentClient25,proto.DRPCTailnetClient25,error,)
func (*Client)GetConnectionReports¶added inv2.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)RewriteDERPMap¶added inv2.8.0
func (*Client)SetAnnouncementBannersFunc¶added inv2.12.0
func (c *Client) SetAnnouncementBannersFunc(f func() ([]codersdk.BannerConfig,error))
func (*Client)SetLogsChannel¶added inv2.9.0
func (c *Client) SetLogsChannel(ch chan<- *agentproto.BatchCreateLogsRequest)
typeFakeAgentAPI¶added inv2.8.0
funcNewFakeAgentAPI¶added inv2.8.0
func NewFakeAgentAPI(ttesting.TB, loggerslog.Logger, manifest *agentproto.Manifest, statsCh chan *agentproto.Stats) *FakeAgentAPI
func (*FakeAgentAPI)AppHealthCh¶added inv2.9.0
func (f *FakeAgentAPI) AppHealthCh() <-chan *agentproto.BatchUpdateAppHealthRequest
func (*FakeAgentAPI)BatchCreateLogs¶added inv2.8.0
func (f *FakeAgentAPI) BatchCreateLogs(ctxcontext.Context, req *agentproto.BatchCreateLogsRequest) (*agentproto.BatchCreateLogsResponse,error)
func (*FakeAgentAPI)BatchUpdateAppHealths¶added inv2.8.0
func (f *FakeAgentAPI) BatchUpdateAppHealths(ctxcontext.Context, req *agentproto.BatchUpdateAppHealthRequest) (*agentproto.BatchUpdateAppHealthResponse,error)
func (*FakeAgentAPI)BatchUpdateMetadata¶added inv2.8.0
func (f *FakeAgentAPI) BatchUpdateMetadata(ctxcontext.Context, req *agentproto.BatchUpdateMetadataRequest) (*agentproto.BatchUpdateMetadataResponse,error)
func (*FakeAgentAPI)GetAnnouncementBanners¶added inv2.12.0
func (f *FakeAgentAPI) GetAnnouncementBanners(context.Context, *agentproto.GetAnnouncementBannersRequest) (*agentproto.GetAnnouncementBannersResponse,error)
func (*FakeAgentAPI)GetConnectionReports¶added inv2.21.0
func (f *FakeAgentAPI) GetConnectionReports() []*agentproto.ReportConnectionRequest
func (*FakeAgentAPI)GetLifecycleStates¶added inv2.9.0
func (f *FakeAgentAPI) GetLifecycleStates() []codersdk.WorkspaceAgentLifecycle
func (*FakeAgentAPI)GetManifest¶added inv2.8.0
func (f *FakeAgentAPI) GetManifest(context.Context, *agentproto.GetManifestRequest) (*agentproto.Manifest,error)
func (*FakeAgentAPI)GetMetadata¶added inv2.9.0
func (f *FakeAgentAPI) GetMetadata() map[string]agentsdk.Metadata
func (*FakeAgentAPI)GetResourcesMonitoringConfiguration¶added inv2.20.0
func (f *FakeAgentAPI) GetResourcesMonitoringConfiguration(_context.Context, _ *agentproto.GetResourcesMonitoringConfigurationRequest) (*agentproto.GetResourcesMonitoringConfigurationResponse,error)
func (*FakeAgentAPI)GetServiceBanner¶added inv2.8.0
func (*FakeAgentAPI) GetServiceBanner(context.Context, *agentproto.GetServiceBannerRequest) (*agentproto.ServiceBanner,error)
func (*FakeAgentAPI)GetTimings¶added inv2.16.0
func (f *FakeAgentAPI) GetTimings() []*agentproto.Timing
func (*FakeAgentAPI)PushResourcesMonitoringUsage¶added inv2.20.0
func (f *FakeAgentAPI) PushResourcesMonitoringUsage(_context.Context, req *agentproto.PushResourcesMonitoringUsageRequest) (*agentproto.PushResourcesMonitoringUsageResponse,error)
func (*FakeAgentAPI)ReportConnection¶added inv2.20.0
func (f *FakeAgentAPI) ReportConnection(_context.Context, req *agentproto.ReportConnectionRequest) (*emptypb.Empty,error)
func (*FakeAgentAPI)ScriptCompleted¶added inv2.16.0
func (f *FakeAgentAPI) ScriptCompleted(_context.Context, req *agentproto.WorkspaceAgentScriptCompletedRequest) (*agentproto.WorkspaceAgentScriptCompletedResponse,error)
func (*FakeAgentAPI)SetAnnouncementBannersFunc¶added inv2.12.0
func (f *FakeAgentAPI) SetAnnouncementBannersFunc(fn func() ([]codersdk.BannerConfig,error))
func (*FakeAgentAPI)SetLogsChannel¶added inv2.9.0
func (f *FakeAgentAPI) SetLogsChannel(ch chan<- *agentproto.BatchCreateLogsRequest)
func (*FakeAgentAPI)UpdateLifecycle¶added inv2.8.0
func (f *FakeAgentAPI) UpdateLifecycle(_context.Context, req *agentproto.UpdateLifecycleRequest) (*agentproto.Lifecycle,error)
func (*FakeAgentAPI)UpdateStartup¶added inv2.8.0
func (f *FakeAgentAPI) UpdateStartup(ctxcontext.Context, req *agentproto.UpdateStartupRequest) (*agentproto.Startup,error)
func (*FakeAgentAPI)UpdateStats¶added inv2.8.0
func (f *FakeAgentAPI) UpdateStats(ctxcontext.Context, req *agentproto.UpdateStatsRequest) (*agentproto.UpdateStatsResponse,error)