conformance

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package conformance checks that a source plugin follows the panelarr.source.v1 protocol. For each source it walks list → popular → latest → search → details → chapters → pages → image, and it checks the plugin's info, configuration, health, capabilities and error mapping.

Problems are protocol violations: a conformant plugin has none. A source whose site is down is not a protocol violation, so failing steps are reported per source, and only a malformed answer or error is a problem.

Run it from a plugin's own tests with Run, against any client with Check, or from the command line with source-conformance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Config is applied with SetConfig before anything else, e.g. to point
	// the plugin at a test server. Only for plugins with a config schema.
	Config map[string]any
	// SourceIDs limits the walk to these sources. Empty means all.
	SourceIDs []string
	// MaxSources limits the walk to the first n sources. 0 means all.
	MaxSources int
	// SearchQuery is searched on every source that can search. Empty means
	// the title of the source's first popular series, which then should be
	// found.
	SearchQuery string
	// SkipImages skips FetchImage.
	SkipImages bool
	// PackageID, for plugins with the PACKAGES capability, is a package to
	// install, narrow to one language, restore and (if it wasn't installed)
	// uninstall again. Without it the package checks only read.
	PackageID string
	// Timeout bounds the whole check. Default 5 minutes.
	Timeout time.Duration
}

Options select what to exercise.

type Report

type Report struct {
	Info *sourcev1.PluginInfo
	// Problems break the protocol. A conformant plugin has none.
	Problems []string
	// Warnings are likely mistakes that don't break the protocol.
	Warnings []string
	// Sources are the walks of the checked sources.
	Sources []*SourceReport
	// Packages is how many packages ListPackages returned (PACKAGES plugins).
	Packages int
	// Jobs is how many jobs ListJobs returned (JOBS plugins).
	Jobs int
	// PackageSteps is the install walk of Options.PackageID.
	PackageSteps []Step
}

Report is what Check found.

func Check

func Check(ctx context.Context, c client.Client, opts Options) (*Report, error)

Check runs the checks. The error is for failures to run them at all (e.g. the plugin can't be reached); protocol violations go to the report.

func Run

func Run(t testing.TB, c client.Client, opts Options) *Report

Run checks the plugin behind c and fails t for every problem. Warnings and failing source steps are logged.

func (*Report) OK

func (r *Report) OK() bool

OK reports whether no problems were found.

type SourceReport

type SourceReport struct {
	ID    string
	Name  string
	Lang  string
	Steps []Step
}

SourceReport is the walk through one source.

func (*SourceReport) OK

func (s *SourceReport) OK() bool

OK reports whether every step that ran passed.

type Step

type Step struct {
	Name    string
	OK      bool
	Skipped bool
	// Detail says what came back ("12 series") or why it failed or was
	// skipped.
	Detail string
	// Reason is the error reason of a failed call, e.g. "SOURCE_DOWN".
	Reason   string
	Duration time.Duration
}

Step is one call of the walk.

Jump to

Keyboard shortcuts

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