enginetest

package
v1.10.3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package enginetest serves fake projection and transport engines for adapter tests: a RESP endpoint (Redis, FalkorDB) with optional TLS, and the certificates to verify it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Listen

func Listen(t *testing.T, serve func(net.Conn)) string

Listen accepts loopback connections and hands each to serve until the test ends. It returns the listening address.

func ReadCommand

func ReadCommand(reader *bufio.Reader) []string

ReadCommand reads one RESP array of bulk strings, or nil on anything else.

func TLS

func TLS(t *testing.T, host string) (server *tls.Config, caPEM []byte)

TLS makes a fresh CA and a server certificate for host (an IP or a DNS name). It returns the server config and the CA as PEM.

Types

type RESPServer

type RESPServer struct {
	Addr                    string
	Dials, Pings            atomic.Int32
	Stall                   atomic.Bool
	Handshake, SocketClosed chan struct{}
}

RESPServer is a RESP endpoint that answers HELLO, AUTH, CLIENT and PING the way Redis and FalkorDB do, optionally behind TLS. Dials counts accepted sockets and Pings authenticated PINGs. With Stall set, a socket that starts a TLS handshake is held open: Handshake fires and the server reads until the client gives up, then SocketClosed fires.

func StartRESP

func StartRESP(t *testing.T, certificate *tls.Config, username, password string) *RESPServer

StartRESP serves a RESPServer on a loopback port until the test ends. A nil certificate serves plaintext; an empty password needs no AUTH.

Jump to

Keyboard shortcuts

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