internals

package
v0.2.0-g958cdc2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OpaImage is the Docker image to be used for tests.
	// TODO: make the OPA version a configuration value
	OpaImage     = "openpolicyagent/opa:0.47.4"
	OpaPort      = "8181"
	OpaBundleDir = "/etc/opa/bundles"
)
View Source
const (
	UrlSep = "/"
)

Variables

This section is empty.

Functions

func CreateBundle

func CreateBundle(manifestPath string, srcDir string) (string, error)

CreateBundle takes a JSON Manifest and the path to a directory containing OPA Policies ( Rego files) and then generates an archive (`.tar.gz`) file according to OPA Bundle rules. It returns the full path to the temporary file.

func EstimateWorkers

func EstimateWorkers() uint

func GetResult

func GetResult(r io.Reader) (bool, error)

func RunTests

func RunTests(tests []TestUnit, workers uint, addr string) *TestReport

func SendData

func SendData(serverURL string, dataChan <-chan TestUnit, report *TestReport) error

Types

type OpaServer

type OpaServer struct {
	Address        string
	BundleFilepath string
	Container      testcontainers.Container
}

OpaServer represents the running server.

func NewOpaContainer

func NewOpaContainer(ctx context.Context, bundlePath string) (*OpaServer, error)

func (*OpaServer) GetEndpoint

func (s *OpaServer) GetEndpoint(endpoint string) (*http.Response, error)

Jump to

Keyboard shortcuts

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