pluginstest

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: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package pluginstest serves made-up source plugins for tests over the real wire (gRPC on cleartext HTTP/2).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(t testing.TB, p plugin.Plugin, apiKey string) string

Serve runs p behind apiKey and returns its URL.

func ServeWithRoutes

func ServeWithRoutes(t testing.TB, p plugin.Plugin, apiKey string, routes map[string]http.Handler) string

ServeWithRoutes is Serve with more routes on the plugin's address, such as files it links to by a relative path (icons).

Types

type Switchable

type Switchable struct {
	URL string
	// Down cuts every connection without an answer, like a service that
	// isn't listening.
	Down atomic.Bool
	// Requests counts requests that reached the service, answered or not.
	Requests atomic.Int64
}

Switchable is a test plugin service that can stop answering.

func ServeSwitchable

func ServeSwitchable(t testing.TB, p plugin.Plugin, apiKey string) *Switchable

ServeSwitchable runs p behind apiKey and returns the switchable service.

Jump to

Keyboard shortcuts

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