testutil

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthzContext added in v1.1.0

func AuthzContext() context.Context

AuthzContext returns a context carrying a valid SubjectContext for use in tests that exercise the authz wrappers.

func NewClusterComponentType

func NewClusterComponentType(name string) *openchoreov1alpha1.ClusterComponentType

NewClusterComponentType creates a ClusterComponentType test fixture.

func NewClusterDataPlane

func NewClusterDataPlane(name string) *openchoreov1alpha1.ClusterDataPlane

NewClusterDataPlane creates a ClusterDataPlane test fixture.

func NewClusterObservabilityPlane

func NewClusterObservabilityPlane(name string) *openchoreov1alpha1.ClusterObservabilityPlane

NewClusterObservabilityPlane creates a ClusterObservabilityPlane test fixture.

func NewClusterResourceType added in v1.1.0

func NewClusterResourceType(name string) *openchoreov1alpha1.ClusterResourceType

NewClusterResourceType creates a ClusterResourceType test fixture.

func NewClusterTrait

func NewClusterTrait(name string) *openchoreov1alpha1.ClusterTrait

NewClusterTrait creates a ClusterTrait test fixture.

func NewClusterWorkflow

func NewClusterWorkflow(name string) *openchoreov1alpha1.ClusterWorkflow

NewClusterWorkflow creates a ClusterWorkflow test fixture.

func NewClusterWorkflowPlane

func NewClusterWorkflowPlane(name string) *openchoreov1alpha1.ClusterWorkflowPlane

NewClusterWorkflowPlane creates a ClusterWorkflowPlane test fixture.

func NewComponent

func NewComponent(namespace, projectName, name string) *openchoreov1alpha1.Component

NewComponent creates a Component test fixture.

func NewComponentRelease

func NewComponentRelease(namespace, projectName, componentName, name string) *openchoreov1alpha1.ComponentRelease

NewComponentRelease creates a ComponentRelease test fixture.

func NewComponentType

func NewComponentType(namespace, name string) *openchoreov1alpha1.ComponentType

NewComponentType creates a ComponentType test fixture.

func NewDataPlane

func NewDataPlane(namespace, name string) *openchoreov1alpha1.DataPlane

NewDataPlane creates a DataPlane test fixture.

func NewDeploymentPipeline

func NewDeploymentPipeline(namespace, name string) *openchoreov1alpha1.DeploymentPipeline

NewDeploymentPipeline creates a DeploymentPipeline test fixture.

func NewEnvironment

func NewEnvironment(namespace, name string) *openchoreov1alpha1.Environment

NewEnvironment creates an Environment test fixture.

func NewFakeClient

func NewFakeClient(objects ...client.Object) client.Client

NewFakeClient creates an in-memory Kubernetes client pre-loaded with the given objects.

func NewNamespace

func NewNamespace(name string) *corev1.Namespace

NewNamespace creates a Namespace test fixture.

func NewObservabilityAlertsNotificationChannel

func NewObservabilityAlertsNotificationChannel(namespace, environmentName, name string) *openchoreov1alpha1.ObservabilityAlertsNotificationChannel

NewObservabilityAlertsNotificationChannel creates an ObservabilityAlertsNotificationChannel fixture.

func NewObservabilityPlane

func NewObservabilityPlane(namespace, name string) *openchoreov1alpha1.ObservabilityPlane

NewObservabilityPlane creates an ObservabilityPlane test fixture.

func NewProject

func NewProject(namespace, name string) *openchoreov1alpha1.Project

NewProject creates a Project test fixture.

func NewReleaseBinding

func NewReleaseBinding(namespace, projectName, componentName, environmentName, name string) *openchoreov1alpha1.ReleaseBinding

NewReleaseBinding creates a ReleaseBinding test fixture.

func NewResource added in v1.1.0

func NewResource(namespace, projectName, name string) *openchoreov1alpha1.Resource

NewResource creates a Resource test fixture.

func NewResourceRelease added in v1.1.0

func NewResourceRelease(namespace, projectName, resourceName, name string) *openchoreov1alpha1.ResourceRelease

NewResourceRelease creates a ResourceRelease test fixture.

func NewResourceReleaseBinding added in v1.1.0

func NewResourceReleaseBinding(namespace, projectName, resourceName, environment, name string) *openchoreov1alpha1.ResourceReleaseBinding

NewResourceReleaseBinding creates a ResourceReleaseBinding test fixture.

func NewResourceType added in v1.1.0

func NewResourceType(namespace, name string) *openchoreov1alpha1.ResourceType

NewResourceType creates a ResourceType test fixture.

func NewScheme

func NewScheme() *runtime.Scheme

NewScheme returns a runtime.Scheme with the OpenChoreo and core Kubernetes API types registered.

func NewSecretReference

func NewSecretReference(namespace, name string) *openchoreov1alpha1.SecretReference

NewSecretReference creates a SecretReference test fixture.

func NewTestAuthzChecker added in v1.1.0

func NewTestAuthzChecker(pdp authzcore.PDP) *services.AuthzChecker

NewTestAuthzChecker creates an AuthzChecker backed by pdp and a discard logger.

func NewTrait

func NewTrait(namespace, name string) *openchoreov1alpha1.Trait

NewTrait creates a Trait test fixture.

func NewWorkflow

func NewWorkflow(namespace, name string) *openchoreov1alpha1.Workflow

NewWorkflow creates a Workflow test fixture.

func NewWorkflowPlane

func NewWorkflowPlane(namespace, name string) *openchoreov1alpha1.WorkflowPlane

NewWorkflowPlane creates a WorkflowPlane test fixture.

func NewWorkflowRun

func NewWorkflowRun(namespace, workflowName, name string) *openchoreov1alpha1.WorkflowRun

NewWorkflowRun creates a WorkflowRun test fixture.

func NewWorkload

func NewWorkload(namespace, projectName, componentName, name string) *openchoreov1alpha1.Workload

NewWorkload creates a Workload test fixture.

func RequireEvalRequest added in v1.1.0

func RequireEvalRequest(t *testing.T, req *authzcore.EvaluateRequest, action, resourceType, resourceID string, hierarchy authzcore.ResourceHierarchy)

RequireEvalRequest asserts all fields of a captured EvaluateRequest.

func TestLogger

func TestLogger() *slog.Logger

TestLogger returns a logger that suppresses normal test output noise.

Types

type CapturingPDP added in v1.1.0

type CapturingPDP struct {
	Captured []*authzcore.EvaluateRequest
	Decision bool
	Err      error
}

CapturingPDP is a mock authz.PDP that records every EvaluateRequest and returns a configurable decision. Use AllowPDP / DenyPDP / ErrorPDP to construct common variants.

func AllowPDP added in v1.1.0

func AllowPDP() *CapturingPDP

AllowPDP returns a CapturingPDP that approves every request.

func DenyPDP added in v1.1.0

func DenyPDP() *CapturingPDP

DenyPDP returns a CapturingPDP that denies every request.

func ErrorPDP added in v1.1.0

func ErrorPDP(err error) *CapturingPDP

ErrorPDP returns a CapturingPDP that returns err from every Evaluate call.

func (*CapturingPDP) BatchEvaluate added in v1.1.0

func (*CapturingPDP) Evaluate added in v1.1.0

func (*CapturingPDP) GetSubjectProfile added in v1.1.0

Jump to

Keyboard shortcuts

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