redisdockertest

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 14 Imported by: ? 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 redisdockertest provides an in-memory container runtime and control connection for exercising redisdocker groups without Docker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	Addr string
	Args []any
}

Cmd is one control command a group sent to a node.

type Fake

type Fake struct {
	// BeforeCreate, when set, runs before each container start; tests block it to hold an operation mid-flight.
	BeforeCreate func()
	// BeforeRemove, when set, runs before each container removal.
	BeforeRemove func(id string)
	// CreateErr, when set, fails the container start whose zero-based index it is given with the returned error.
	CreateErr func(index int) error
	// contains filtered or unexported fields
}

Fake is a runtime and control plane that records everything and answers like a healthy cluster.

func New

func New(t *testing.T, base PortRange) (*Fake, *redisdocker.Engine)

New returns a Fake and an Engine wired to it.

func (*Fake) CertsPresentAtStart

func (f *Fake) CertsPresentAtStart(name string) bool

CertsPresentAtStart reports whether the named container's TLS files existed when it started.

func (*Fake) Cmds

func (f *Fake) Cmds(prefix ...string) []Cmd

Cmds returns the control commands whose leading arguments equal prefix.

func (*Fake) CreateAndStart

func (f *Fake) CreateAndStart(_ context.Context, spec container.Spec) (string, error)

CreateAndStart implements redisdocker.Runtime.

func (*Fake) Exec

func (f *Fake) Exec(_ context.Context, id string, _ []string) (container.ExecResult, error)

Exec implements redisdocker.Runtime; it answers `hostname -i`.

func (*Fake) Removed

func (f *Fake) Removed() []string

Removed returns the IDs of removed containers.

func (*Fake) Specs

func (f *Fake) Specs() []container.Spec

Specs returns the containers started so far.

func (*Fake) StopAndRemove

func (f *Fake) StopAndRemove(_ context.Context, id string) error

StopAndRemove implements redisdocker.Runtime.

type PortRange

type PortRange struct{ Start, End int }

PortRange is an inclusive host port range for the fake.

func Ports

func Ports(start, end int) PortRange

Ports returns a port range for the fake's allocator.

Jump to

Keyboard shortcuts

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