Documentation
¶
Overview ¶
Package plugintest provides a made-up source plugin for tests: hosts can run against it, and the SDK's own tests and the example plugin use it.
Index ¶
- func Image(ref string) []byte
- type Chapter
- type Fake
- func (f *Fake) BreakOrigin(id string, broken bool)
- func (f *Fake) Calls() map[string]int
- func (f *Fake) CancelJobRun(ctx context.Context, r *sourcev1.CancelJobRunRequest) (*sourcev1.CancelJobRunResponse, error)
- func (f *Fake) DisableJob(id, reason string)
- func (f *Fake) FetchImage(_ context.Context, r *sourcev1.FetchImageRequest, send plugin.ImageSendFunc) error
- func (f *Fake) GetConfig(ctx context.Context, r *sourcev1.GetConfigRequest) (*sourcev1.GetConfigResponse, error)
- func (f *Fake) GetFilters(_ context.Context, r *sourcev1.GetFiltersRequest) (*sourcev1.GetFiltersResponse, error)
- func (f *Fake) GetInfo(context.Context, *sourcev1.GetInfoRequest) (*sourcev1.GetInfoResponse, error)
- func (f *Fake) GetJob(ctx context.Context, r *sourcev1.GetJobRequest) (*sourcev1.GetJobResponse, error)
- func (f *Fake) GetJobRun(ctx context.Context, r *sourcev1.GetJobRunRequest) (*sourcev1.GetJobRunResponse, error)
- func (f *Fake) GetNetworkProfile(_ context.Context, r *sourcev1.GetNetworkProfileRequest) (*sourcev1.GetNetworkProfileResponse, error)
- func (f *Fake) GetPackage(_ context.Context, r *sourcev1.GetPackageRequest) (*sourcev1.GetPackageResponse, error)
- func (f *Fake) GetSeries(_ context.Context, r *sourcev1.GetSeriesRequest) (*sourcev1.GetSeriesResponse, error)
- func (f *Fake) GetSettings(_ context.Context, r *sourcev1.GetSettingsRequest) (*sourcev1.GetSettingsResponse, error)
- func (f *Fake) GetSettingsSchema(_ context.Context, r *sourcev1.GetSettingsSchemaRequest) (*sourcev1.GetSettingsSchemaResponse, error)
- func (f *Fake) GetSource(_ context.Context, r *sourcev1.GetSourceRequest) (*sourcev1.GetSourceResponse, error)
- func (f *Fake) InstallPackage(_ context.Context, r *sourcev1.InstallPackageRequest) (*sourcev1.InstallPackageResponse, error)
- func (f *Fake) Latest(_ context.Context, r *sourcev1.LatestRequest) (*sourcev1.LatestResponse, error)
- func (f *Fake) ListChapters(_ context.Context, r *sourcev1.ListChaptersRequest) (*sourcev1.ListChaptersResponse, error)
- func (f *Fake) ListJobRuns(ctx context.Context, r *sourcev1.ListJobRunsRequest) (*sourcev1.ListJobRunsResponse, error)
- func (f *Fake) ListJobs(ctx context.Context, r *sourcev1.ListJobsRequest) (*sourcev1.ListJobsResponse, error)
- func (f *Fake) ListOrigins(_ context.Context, _ *sourcev1.ListOriginsRequest) (*sourcev1.ListOriginsResponse, error)
- func (f *Fake) ListPackages(_ context.Context, r *sourcev1.ListPackagesRequest) (*sourcev1.ListPackagesResponse, error)
- func (f *Fake) ListPages(_ context.Context, r *sourcev1.ListPagesRequest) (*sourcev1.ListPagesResponse, error)
- func (f *Fake) ListSources(_ context.Context, r *sourcev1.ListSourcesRequest) (*sourcev1.ListSourcesResponse, error)
- func (f *Fake) Popular(_ context.Context, r *sourcev1.PopularRequest) (*sourcev1.PopularResponse, error)
- func (f *Fake) Profile(sourceID string) *sourcev1.NetworkProfile
- func (f *Fake) RefreshOrigin(_ context.Context, r *sourcev1.RefreshOriginRequest) (*sourcev1.RefreshOriginResponse, error)
- func (f *Fake) Release()
- func (f *Fake) ReloadPackage(_ context.Context, r *sourcev1.ReloadPackageRequest) (*sourcev1.ReloadPackageResponse, error)
- func (f *Fake) ResolveUrl(_ context.Context, r *sourcev1.ResolveUrlRequest) (*sourcev1.ResolveUrlResponse, error)
- func (f *Fake) RunJob(ctx context.Context, r *sourcev1.RunJobRequest) (*sourcev1.RunJobResponse, error)
- func (f *Fake) Search(_ context.Context, r *sourcev1.SearchRequest) (*sourcev1.SearchResponse, error)
- func (f *Fake) SetConfig(ctx context.Context, r *sourcev1.SetConfigRequest) (*sourcev1.SetConfigResponse, error)
- func (f *Fake) SetNetworkProfile(_ context.Context, r *sourcev1.SetNetworkProfileRequest) (*sourcev1.SetNetworkProfileResponse, error)
- func (f *Fake) SetPackageSettings(_ context.Context, r *sourcev1.SetPackageSettingsRequest) (*sourcev1.SetPackageSettingsResponse, error)
- func (f *Fake) SetSettings(_ context.Context, r *sourcev1.SetSettingsRequest) (*sourcev1.SetSettingsResponse, error)
- func (f *Fake) SetSourceHealthCheck(_ context.Context, r *sourcev1.SetSourceHealthCheckRequest) (*sourcev1.SetSourceHealthCheckResponse, error)
- func (f *Fake) UninstallPackage(_ context.Context, r *sourcev1.UninstallPackageRequest) (*sourcev1.UninstallPackageResponse, error)
- func (f *Fake) UpdatePackage(_ context.Context, r *sourcev1.UpdatePackageRequest) (*sourcev1.UpdatePackageResponse, error)
- type Offer
- type Package
- type Series
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Fake ¶
type Fake struct {
plugin.Unimplemented
// ID of the plugin, "fake" by default.
ID string
// Sources it serves.
Sources []*Source
// PageSize is the number of series per Popular/Latest/Search page, 2 by
// default.
PageSize int
// Config, when set, is the plugin-level configuration: GetInfo declares
// its schema and GetConfig/SetConfig use it.
Config *plugin.PluginConfig
// Packages, when set, makes the fake a plugin with the PACKAGES capability:
// a source belongs to the package that lists it, and is listed only while
// that package is installed and its language is enabled.
Packages []*Package
// Langs are the languages the plugin offers sources in; empty means all.
Langs []string
// Jobs, when set, makes the fake a plugin with the JOBS capability. [New]
// sets up "refresh" and "hold".
Jobs *jobs.Runner
// contains filtered or unexported fields
}
Fake is an in-memory source plugin. Build one with New or fill in Sources yourself. It is safe for concurrent use once serving.
func New ¶
func New() *Fake
New returns a fake with two sources: "Example Comics" (en: latest, search, filters, URL resolving, settings) and "Beispiel Comics" (de: search only), each with a few series, chapters and pages. Everything is made up.
func (*Fake) BreakOrigin ¶
BreakOrigin makes refreshing an origin fail with STORE_FETCH_FAILED, or work again.
func (*Fake) CancelJobRun ¶
func (f *Fake) CancelJobRun(ctx context.Context, r *sourcev1.CancelJobRunRequest) (*sourcev1.CancelJobRunResponse, error)
func (*Fake) DisableJob ¶
DisableJob gives a job a disabled reason, so it refuses to run with JOB_DISABLED; "" enables it again.
func (*Fake) FetchImage ¶
func (f *Fake) FetchImage(_ context.Context, r *sourcev1.FetchImageRequest, send plugin.ImageSendFunc) error
func (*Fake) GetConfig ¶
func (f *Fake) GetConfig(ctx context.Context, r *sourcev1.GetConfigRequest) (*sourcev1.GetConfigResponse, error)
func (*Fake) GetFilters ¶
func (f *Fake) GetFilters(_ context.Context, r *sourcev1.GetFiltersRequest) (*sourcev1.GetFiltersResponse, error)
func (*Fake) GetInfo ¶
func (f *Fake) GetInfo(context.Context, *sourcev1.GetInfoRequest) (*sourcev1.GetInfoResponse, error)
func (*Fake) GetJob ¶
func (f *Fake) GetJob(ctx context.Context, r *sourcev1.GetJobRequest) (*sourcev1.GetJobResponse, error)
func (*Fake) GetJobRun ¶
func (f *Fake) GetJobRun(ctx context.Context, r *sourcev1.GetJobRunRequest) (*sourcev1.GetJobRunResponse, error)
func (*Fake) GetNetworkProfile ¶
func (f *Fake) GetNetworkProfile(_ context.Context, r *sourcev1.GetNetworkProfileRequest) (*sourcev1.GetNetworkProfileResponse, error)
GetNetworkProfile returns the pushed profile, password left out, or none.
func (*Fake) GetPackage ¶
func (f *Fake) GetPackage(_ context.Context, r *sourcev1.GetPackageRequest) (*sourcev1.GetPackageResponse, error)
func (*Fake) GetSeries ¶
func (f *Fake) GetSeries(_ context.Context, r *sourcev1.GetSeriesRequest) (*sourcev1.GetSeriesResponse, error)
func (*Fake) GetSettings ¶
func (f *Fake) GetSettings(_ context.Context, r *sourcev1.GetSettingsRequest) (*sourcev1.GetSettingsResponse, error)
func (*Fake) GetSettingsSchema ¶
func (f *Fake) GetSettingsSchema(_ context.Context, r *sourcev1.GetSettingsSchemaRequest) (*sourcev1.GetSettingsSchemaResponse, error)
func (*Fake) GetSource ¶
func (f *Fake) GetSource(_ context.Context, r *sourcev1.GetSourceRequest) (*sourcev1.GetSourceResponse, error)
func (*Fake) InstallPackage ¶
func (f *Fake) InstallPackage(_ context.Context, r *sourcev1.InstallPackageRequest) (*sourcev1.InstallPackageResponse, error)
InstallPackage installs the offered version; the same version again is OK.
func (*Fake) Latest ¶
func (f *Fake) Latest(_ context.Context, r *sourcev1.LatestRequest) (*sourcev1.LatestResponse, error)
func (*Fake) ListChapters ¶
func (f *Fake) ListChapters(_ context.Context, r *sourcev1.ListChaptersRequest) (*sourcev1.ListChaptersResponse, error)
func (*Fake) ListJobRuns ¶
func (f *Fake) ListJobRuns(ctx context.Context, r *sourcev1.ListJobRunsRequest) (*sourcev1.ListJobRunsResponse, error)
func (*Fake) ListJobs ¶
func (f *Fake) ListJobs(ctx context.Context, r *sourcev1.ListJobsRequest) (*sourcev1.ListJobsResponse, error)
ListJobs lists the fake's jobs, when it has them.
func (*Fake) ListOrigins ¶
func (f *Fake) ListOrigins(_ context.Context, _ *sourcev1.ListOriginsRequest) (*sourcev1.ListOriginsResponse, error)
ListOrigins lists the origins the packages' offers name.
func (*Fake) ListPackages ¶
func (f *Fake) ListPackages(_ context.Context, r *sourcev1.ListPackagesRequest) (*sourcev1.ListPackagesResponse, error)
func (*Fake) ListPages ¶
func (f *Fake) ListPages(_ context.Context, r *sourcev1.ListPagesRequest) (*sourcev1.ListPagesResponse, error)
func (*Fake) ListSources ¶
func (f *Fake) ListSources(_ context.Context, r *sourcev1.ListSourcesRequest) (*sourcev1.ListSourcesResponse, error)
func (*Fake) Popular ¶
func (f *Fake) Popular(_ context.Context, r *sourcev1.PopularRequest) (*sourcev1.PopularResponse, error)
func (*Fake) Profile ¶
func (f *Fake) Profile(sourceID string) *sourcev1.NetworkProfile
Profile returns the network profile pushed for a source, if any.
func (*Fake) RefreshOrigin ¶
func (f *Fake) RefreshOrigin(_ context.Context, r *sourcev1.RefreshOriginRequest) (*sourcev1.RefreshOriginResponse, error)
RefreshOrigin pretends to fetch an origin; see Fake.BreakOrigin.
func (*Fake) ReloadPackage ¶
func (f *Fake) ReloadPackage(_ context.Context, r *sourcev1.ReloadPackageRequest) (*sourcev1.ReloadPackageResponse, error)
ReloadPackage answers with the package as it is: there is nothing to load.
func (*Fake) ResolveUrl ¶
func (f *Fake) ResolveUrl(_ context.Context, r *sourcev1.ResolveUrlRequest) (*sourcev1.ResolveUrlResponse, error)
func (*Fake) RunJob ¶
func (f *Fake) RunJob(ctx context.Context, r *sourcev1.RunJobRequest) (*sourcev1.RunJobResponse, error)
func (*Fake) Search ¶
func (f *Fake) Search(_ context.Context, r *sourcev1.SearchRequest) (*sourcev1.SearchResponse, error)
func (*Fake) SetConfig ¶
func (f *Fake) SetConfig(ctx context.Context, r *sourcev1.SetConfigRequest) (*sourcev1.SetConfigResponse, error)
func (*Fake) SetNetworkProfile ¶
func (f *Fake) SetNetworkProfile(_ context.Context, r *sourcev1.SetNetworkProfileRequest) (*sourcev1.SetNetworkProfileResponse, error)
func (*Fake) SetPackageSettings ¶
func (f *Fake) SetPackageSettings(_ context.Context, r *sourcev1.SetPackageSettingsRequest) (*sourcev1.SetPackageSettingsResponse, error)
func (*Fake) SetSettings ¶
func (f *Fake) SetSettings(_ context.Context, r *sourcev1.SetSettingsRequest) (*sourcev1.SetSettingsResponse, error)
func (*Fake) SetSourceHealthCheck ¶
func (f *Fake) SetSourceHealthCheck(_ context.Context, r *sourcev1.SetSourceHealthCheckRequest) (*sourcev1.SetSourceHealthCheckResponse, error)
SetSourceHealthCheck turns a source's (pretend) scheduled checks on or off.
func (*Fake) UninstallPackage ¶
func (f *Fake) UninstallPackage(_ context.Context, r *sourcev1.UninstallPackageRequest) (*sourcev1.UninstallPackageResponse, error)
func (*Fake) UpdatePackage ¶
func (f *Fake) UpdatePackage(_ context.Context, r *sourcev1.UpdatePackageRequest) (*sourcev1.UpdatePackageResponse, error)
type Offer ¶
type Offer struct{ OriginID, OriginName, Version string }
Offer is where a fake package can be installed from.
type Package ¶
type Package struct {
Package *sourcev1.Package
Sources []*Source
// contains filtered or unexported fields
}
Package is a fake package: what it offers, the sources it provides and whether it starts out installed.
func NewPackage ¶
NewPackage describes a package that provides sources, offered by origins. Its version is the newest offered.