testutil

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	ContainerRepoEnvVar = "CERBOS_TEST_CONTAINER_REPO"
	ContainerTagEnvVar  = "CERBOS_TEST_CONTAINER_TAG"
	DebugEnvVar         = "CERBOS_TEST_DEBUG"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CerbosServerInstance

type CerbosServerInstance struct {
	Stop     func() error
	Host     string
	GRPCPort string
	HTTPPort string
	// contains filtered or unexported fields
}

func LaunchCerbosServer

func LaunchCerbosServer(ctx context.Context, launchConf LaunchConf) (*CerbosServerInstance, error)

LaunchCerbosServer is a utility method to start a Cerbos server and wait for it be ready.

Example
Output:

false

func (*CerbosServerInstance) GRPCAddr

func (csi *CerbosServerInstance) GRPCAddr() string

func (*CerbosServerInstance) HTTPAddr

func (csi *CerbosServerInstance) HTTPAddr() string

func (*CerbosServerInstance) IsHealthy

func (csi *CerbosServerInstance) IsHealthy() (bool, error)

func (*CerbosServerInstance) WaitForReady

func (csi *CerbosServerInstance) WaitForReady(ctx context.Context) error

type CerbosServerLauncher

type CerbosServerLauncher struct {
	// contains filtered or unexported fields
}

func NewCerbosServerLauncher

func NewCerbosServerLauncher() (*CerbosServerLauncher, error)

NewCerbosServerLauncher creates a launcher for Cerbos containers. By default it launches ghcr.io/cerbos/cerbos:latest. The image and/or tag can be overridden with environment variables. CERBOS_TEST_CONTAINER_REPO overrides the default container image repository. CERBOS_TEST_CONTAINER_TAG overrides the default container tag. CERBOS_TEST_DEBUG if set to true, configures the launcher to output container logs to stdout and stderr.

func NewCerbosServerLauncherFromImage

func NewCerbosServerLauncherFromImage(repo, tag string) (*CerbosServerLauncher, error)

func (*CerbosServerLauncher) Launch

type LaunchConf

type LaunchConf struct {
	ConfFilePath        string
	PolicyDir           string
	PolicyDirMountPoint string
	AdditionalMounts    []string
	Cmd                 []string
	Env                 []string
}

Jump to

Keyboard shortcuts

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