sourcetest

package
v0.0.0-...-e27f8b9 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package sourcetest is the conformance suite every collector must pass. The three extension tiers (Go, YAML template, external process) are only safe if "is a source" means the same thing for all of them, so the properties that definition rests on are asserted here once rather than per provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Conform

func Conform(t *testing.T, c Case)

Conform runs the suite. A source that passes can be registered without the pipeline knowing anything about the provider behind it.

Types

type Case

type Case struct {
	New  func(base string) source.Source
	Root string
	// Pages are served one per request, in order. More than one page asserts
	// that the source follows pagination to the end.
	Pages []string
	// Want is every hostname the source should emit across all pages.
	Want []string
	// ContentType of the served pages.
	ContentType string
}

Case describes one source under test. New receives the base URL of a test server and must return a source that talks to it instead of the real provider, which is the only concession a source makes to being testable.

Jump to

Keyboard shortcuts

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