Documentation ¶
Overview ¶
Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended. For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the github.com/open-policy-agent/opa/v1 package instead. See https://www.openpolicyagent.org/docs/latest/v0-compatibility/ for more information.
Package tester contains utilities for executing Rego tests.
Index ¶
- Constants
- func Load(args []string, filter loader.Filter) (map[string]*ast.Module, storage.Store, error)
- func LoadBundles(args []string, filter loader.Filter) (map[string]*bundle.Bundle, error)
- func LoadBundlesWithRegoVersion(args []string, filter loader.Filter, regoVersion ast.RegoVersion) (map[string]*bundle.Bundle, error)
- func LoadWithRegoVersion(args []string, filter loader.Filter, regoVersion ast.RegoVersion) (map[string]*ast.Module, storage.Store, error)
- type BenchmarkOptions
- type Builtin
- type JSONCoverageReporter
- type JSONReporter
- type PrettyReporter
- type Reporter
- type Result
- type Runner
Constants ¶
const SkipTestPrefix = v1.SkipTestPrefix
SkipTestPrefix declares the prefix for tests that should be skipped.
const TestPrefix = v1.TestPrefix
TestPrefix declares the prefix for all test rules.
Variables ¶
This section is empty.
Functions ¶
func LoadBundles ¶ added in v0.14.0
LoadBundles will load the given args as bundles, either tarball or directory is OK.
func LoadBundlesWithRegoVersion ¶ added in v0.60.0
func LoadBundlesWithRegoVersion(args []string, filter loader.Filter, regoVersion ast.RegoVersion) (map[string]*bundle.Bundle, error)
LoadBundlesWithRegoVersion will load the given args as bundles, either tarball or directory is OK. Bundles are parsed in accordance with the given RegoVersion.
func LoadWithRegoVersion ¶ added in v0.60.0
func LoadWithRegoVersion(args []string, filter loader.Filter, regoVersion ast.RegoVersion) (map[string]*ast.Module, storage.Store, error)
LoadWithRegoVersion returns modules and an in-memory store for running tests. Modules are parsed in accordance with the given RegoVersion.
Types ¶
type BenchmarkOptions ¶ added in v0.18.0
type BenchmarkOptions = v1.BenchmarkOptions
BenchmarkOptions defines options specific to benchmarking tests
type JSONCoverageReporter ¶ added in v0.8.0
type JSONCoverageReporter = v1.JSONCoverageReporter
JSONCoverageReporter reports coverage as a JSON structure.
type JSONReporter ¶ added in v0.8.0
type JSONReporter = v1.JSONReporter
JSONReporter reports test results as array of JSON objects.
type PrettyReporter ¶
type PrettyReporter = v1.PrettyReporter
PrettyReporter reports test results in a simple human readable format.