cluster

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package cluster contains complex tests that involve multiple servers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client map[string]*Server

Client is a fed.Client that handles a HTTP request by calling the destination server's http.Handler.

func (Client) Do

func (f Client) Do(r *http.Request) (*http.Response, error)

type Cluster

type Cluster Client

Cluster represents a collection of servers that talk to each other.

func NewCluster

func NewCluster(t T, domain ...string) Cluster

NewCluster creates a collection of servers that talk to each other.

func (Cluster) Settle

func (c Cluster) Settle(t T)

Settle waits until all servers are done processing queued activities, both incoming and outgoing.

func (Cluster) Stop

func (c Cluster) Stop()

Stop stops all servers in the cluster.

type Line

type Line struct {
	Type LineType
	Text string
	URL  string
}

type LineType

type LineType int
const (
	Text LineType = iota
	Link
	Heading
	SubHeading
	Item
	Quote
	Preformatted
)

type Page

type Page struct {
	Path   string
	Raw    string
	Status string
	Lines  []Line
	Links  map[string]string
	// contains filtered or unexported fields
}

Respnonse represents a frontend page displayed to the user.

func (Page) Contains

func (p Page) Contains(line Line) Page

func (Page) Error

func (p Page) Error(err string)

func (Page) Follow

func (p Page) Follow(text string) Page

Follow follows a link, follows redirects and returns a Page.

func (Page) FollowInput

func (p Page) FollowInput(text, input string) Page

FollowInput is like Page.Follow but also accepts user-provided input.

func (Page) Goto

func (p Page) Goto(path string) Page

Goto navigates to a different page by its path.

func (Page) GotoInput

func (p Page) GotoInput(path, input string) Page

GotoInput is like Page.Goto but also accepts user-provided input.

func (Page) NotContains

func (p Page) NotContains(line Line) Page

func (Page) OK

func (p Page) OK() Page

func (Page) Refresh

func (p Page) Refresh() Page

Refresh fetches the same Page again.

type Server

type Server struct {
	Test         T
	Domain       string
	Config       *cfg.Config
	DB           *sql.DB
	Resolver     *fed.Resolver
	AppActorKeys [2]httpsig.Key
	Frontend     gemini.Listener
	Backend      http.Handler
	Inbox        *inbox.Inbox
	Incoming     *inbox.Queue
	Outgoing     *fed.Queue
	// contains filtered or unexported fields
}

func NewServer

func NewServer(t T, domain string, client fed.Client) *Server

func (*Server) Handle

func (s *Server) Handle(cert tls.Certificate, path string) Page

Handle simulates a Gemini request, follows redirects and returns a Page.

func (*Server) HandleInput

func (s *Server) HandleInput(cert tls.Certificate, path, input string) Page

HandleInput is like Server.Handle but also accepts user-provided input.

func (*Server) Register

func (s *Server) Register(cert tls.Certificate) Page

func (*Server) RegisterPortable added in v0.19.0

func (s *Server) RegisterPortable(cert tls.Certificate) Page

func (*Server) Stop

func (s *Server) Stop()

type T added in v0.21.1

type T interface {
	Parallel()
	Name() string
	Context() context.Context
	TempDir() string
	Fatal(args ...any)
	Fatalf(format string, args ...any)
}

T is the subset of testing.T that's actually used by this package.

Jump to

Keyboard shortcuts

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