testutils

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestDebugLogger

func TestDebugLogger(t *testing.T) *slog.Logger

TestDebugLogger creates a test logger that outputs logs

func TestLogger

func TestLogger(t *testing.T) *slog.Logger

TestLogger creates a test logger that discards all output

Types

type EtcdEntityServer

type EtcdEntityServer struct {
	Store  *entity.EtcdStore
	Server *entityserver.EntityServer
	EAC    *entityserver_v1alpha.EntityAccessClient
	Client *apiserver.Client
	Prefix string
	// contains filtered or unexported fields
}

EtcdEntityServer provides an etcd-backed entity server for testing This enforces proper optimistic concurrency control unlike the in-memory version

func NewEtcdEntityServer

func NewEtcdEntityServer(t *testing.T) (*EtcdEntityServer, func())

NewEtcdEntityServer creates a new etcd-backed entity server for testing It connects to etcd:2379 and uses a random prefix for isolation This should be run with ./hack/dev-exec or similar to have etcd available

type InMemEntityServer

type InMemEntityServer struct {
	Store  *entity.MockStore
	Server *entityserver.EntityServer
	EAC    *entityserver_v1alpha.EntityAccessClient
	Client *apiserver.Client
}

InMemEntityServer provides an in-memory entity server for testing

func NewInMemEntityServer

func NewInMemEntityServer(t *testing.T) (*InMemEntityServer, func())

NewInMemEntityServer creates a new in-memory entity server for testing

func (*InMemEntityServer) AddEntity

func (s *InMemEntityServer) AddEntity(ent *entity.Entity)

AddEntity adds an entity to the mock store

func (*InMemEntityServer) GetEntity

func (s *InMemEntityServer) GetEntity(id entity.Id) *entity.Entity

GetEntity retrieves an entity from the mock store

Jump to

Keyboard shortcuts

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