testredis

package module
v0.0.0-...-3732138 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Port = "6379/tcp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// TLS settings
	UseTLS       bool
	SecureURL    bool
	MTLSDisabled bool
	UseAddress   bool
	UseHostPort  bool
	UseURL       bool
	// contains filtered or unexported fields
}

Config represents the configuration for a Redis container

type Container

type Container struct {
	URL string

	Addrs     []string
	Host      string
	Port      int
	TLSConfig *tls.Config
	// contains filtered or unexported fields
}

Container represents a running Redis container

func Start

func Start(t testing.TB, img string, opts ...Option) *Container

Start starts a Redis container for testing and returns its configuration

type Option

type Option func(*Config)

Option is a function that configures a Config

func WithAddress

func WithAddress() Option

WithAddress sets the container to use address-based connection

func WithHostPort

func WithHostPort() Option

WithHostPort sets the container to use host and port based connection

func WithReuse

func WithReuse(name string) Option

WithReuse sets the container to be reused, providing a name to identify the container. This container is not cleaned up when the test completes.

func WithTLS

func WithTLS(secureURL bool, mtlsDisabled bool) Option

WithTLS configures the container to use TLS

func WithURL

func WithURL(useContainerURI bool) Option

WithURL sets the container to use a URL

Jump to

Keyboard shortcuts

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