package e2e

import "github.com/open-policy-agent/opa/test/e2e"

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.

Index

Functions

func NewAPIServerTestParams

func NewAPIServerTestParams() runtime.Params

NewAPIServerTestParams creates a new set of runtime.Params with enough default values filled in to start the server. Options can/should be customized for the test case.

func WithRuntime

func WithRuntime(t *testing.T, opts TestRuntimeOpts, params runtime.Params, f func(rt *TestRuntime))

WithRuntime invokes f with a new TestRuntime after waiting for server readiness. This function can be called inside of each test that requires a runtime as opposed to RunTests which can only be called once.

Types

type TestRuntime

type TestRuntime = v1.TestRuntime

TestRuntime holds metadata and provides helper methods to interact with the runtime being tested.

func NewTestRuntime

func NewTestRuntime(params runtime.Params) (*TestRuntime, error)

NewTestRuntime returns a new TestRuntime.

func NewTestRuntimeWithOpts

func NewTestRuntimeWithOpts(opts TestRuntimeOpts, params runtime.Params) (*TestRuntime, error)

NewTestRuntimeWithOpts returns a new TestRuntime.

func WrapRuntime

func WrapRuntime(ctx context.Context, cancel context.CancelFunc, rt *runtime.Runtime) *TestRuntime

WrapRuntime creates a new TestRuntime by wrapping an existing runtime

type TestRuntimeOpts

type TestRuntimeOpts = v1.TestRuntimeOpts

TestRuntimeOpts contains parameters for the test runtime.

Source Files

doc.go testing.go

Directories

PathSynopsis
test/e2e/logsDeprecated: 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.
Version
v1.4.2 (latest)
Published
May 2, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
1 week ago

Tools for package owners.