sourcetest

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sourcetest runs source plugins in-process, for tests on either side of the source protocol: Stub is a source that reports a scripted snapshot, and Launch connects any source to a host over a real go-plugin connection inside the test binary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Launch

func Launch(t testing.TB, id string, src source.Source, host source.Host) *source.Client

Launch serves src as plugin id in-process, serves host to it, starts it and returns the host's client. The test's cleanup stops it.

Types

type Stub

type Stub struct {
	// contains filtered or unexported fields
}

Stub is a source whose Ingest reports Snapshots to the host. Embed it to add capabilities.

func NewStub

func NewStub(snapshots ...source.Snapshot) *Stub

NewStub is a Stub that reports snapshots.

func (*Stub) Health

func (s *Stub) Health(context.Context) (plugin.Health, error)

func (*Stub) Host

func (s *Stub) Host() source.Host

Host is the broker Start received.

func (*Stub) Ingest

func (*Stub) Locate

func (s *Stub) Locate(context.Context, string) (plugin.Unit, bool, error)

func (*Stub) Notified

func (s *Stub) Notified() [][]plugin.Unit

Notified are the units of every Notify, oldest first.

func (*Stub) Notify

func (s *Stub) Notify(_ context.Context, units []plugin.Unit, _ []plugin.Topic) error

func (*Stub) Resolve

func (s *Stub) Resolve(context.Context, string) (plugin.Unit, bool, error)

func (*Stub) Script

func (s *Stub) Script(snapshots ...source.Snapshot)

Script replaces the snapshots the next Ingest reports.

func (*Stub) Start

func (s *Stub) Start(_ context.Context, req source.StartRequest) error

func (*Stub) Stop

func (s *Stub) Stop(context.Context) error

func (*Stub) Track

func (s *Stub) Track(_ context.Context, req source.TrackRequest) (source.Tracked, error)

func (*Stub) Untrack

func (s *Stub) Untrack(context.Context, plugin.Unit) error

Jump to

Keyboard shortcuts

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