testing

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetAcmeEBBFilePath

func AssetAcmeEBBFilePath() string

AssetAcmeEBBFilePath returns the path of the test contoso EDS database file

func AssetDefaultConfigLocal

func AssetDefaultConfigLocal() config.Path

AssetDefaultConfigLocal returns the path of the default yaml config file that doesn't use an online bundle

func AssetDefaultConfigOnline

func AssetDefaultConfigOnline() config.Path

AssetDefaultConfigOnline returns the path of the default yaml config file that uses an online bundle

func AssetLocalBundle

func AssetLocalBundle() string

AssetLocalBundle returns the path of the default local bundle directory that contains test policies and data

func AssetsDir

func AssetsDir() string

AssetsDir returns the directory containing test assets

func LogReadLine

func LogReadLine(reader *bufio.Reader, timeout time.Duration) (string, error)

LogReadLine reads and returns a single line from the given file. If a given timeout has passed, an error is returned.

func PortOpen

func PortOpen(listenAddress string) bool

PortOpen returns true if there's a socket listening on the specified listenAddress

func PrettyPrintObject

func PrettyPrintObject(obj interface{}) string

PrettyPrintObject returns the JSON representation of any object; only useful for debugging

Types

type EngineHarness

type EngineHarness struct {
	Engine      *app.Authorizer
	LogDebugger *LogDebugger
	// contains filtered or unexported fields
}

EngineHarness wraps an Aserto Runtime Engine so we can set it up easily and monitor its logs

func SetupOffline

func SetupOffline(t *testing.T, configOverrides func(*config.Config)) *EngineHarness

SetupOffline sets up an engine that uses a runtime that loads offline bundles, from the assets directory

func SetupOnline

func SetupOnline(t *testing.T, configOverrides func(*config.Config)) *EngineHarness

SetupOnline sets up an engine that uses a runtime that loads online bundles, from the online aserto registry service

func (*EngineHarness) Cleanup

func (h *EngineHarness) Cleanup()

Cleanup releases all resources the harness uses and shuts down servers and runtimes

func (*EngineHarness) Context added in v0.0.8

func (h *EngineHarness) Context() context.Context

func (*EngineHarness) CreateClient

func (h *EngineHarness) CreateClient() *http.Client

CreateClient creates a new http client that can talk to the API

func (*EngineHarness) CreateGRPCClient

func (h *EngineHarness) CreateGRPCClient() authz2.AuthorizerClient

func (*EngineHarness) Req

func (h *EngineHarness) Req(verb, path, tenantID, body string) (string, int)

func (*EngineHarness) Runtime

func (h *EngineHarness) Runtime() *runtime.Runtime

type LogDebugger added in v0.0.7

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

func NewLogDebugger added in v0.0.7

func NewLogDebugger(t *testing.T, logName string) *LogDebugger

func (*LogDebugger) Contains added in v0.0.7

func (d *LogDebugger) Contains(message string) bool

func (*LogDebugger) Write added in v0.0.7

func (d *LogDebugger) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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