Documentation
¶
Index ¶
- func AuthzContext() context.Context
- func NewClusterComponentType(name string) *openchoreov1alpha1.ClusterComponentType
- func NewClusterDataPlane(name string) *openchoreov1alpha1.ClusterDataPlane
- func NewClusterObservabilityPlane(name string) *openchoreov1alpha1.ClusterObservabilityPlane
- func NewClusterResourceType(name string) *openchoreov1alpha1.ClusterResourceType
- func NewClusterTrait(name string) *openchoreov1alpha1.ClusterTrait
- func NewClusterWorkflow(name string) *openchoreov1alpha1.ClusterWorkflow
- func NewClusterWorkflowPlane(name string) *openchoreov1alpha1.ClusterWorkflowPlane
- func NewComponent(namespace, projectName, name string) *openchoreov1alpha1.Component
- func NewComponentRelease(namespace, projectName, componentName, name string) *openchoreov1alpha1.ComponentRelease
- func NewComponentType(namespace, name string) *openchoreov1alpha1.ComponentType
- func NewDataPlane(namespace, name string) *openchoreov1alpha1.DataPlane
- func NewDeploymentPipeline(namespace, name string) *openchoreov1alpha1.DeploymentPipeline
- func NewEnvironment(namespace, name string) *openchoreov1alpha1.Environment
- func NewFakeClient(objects ...client.Object) client.Client
- func NewNamespace(name string) *corev1.Namespace
- func NewObservabilityAlertsNotificationChannel(namespace, environmentName, name string) *openchoreov1alpha1.ObservabilityAlertsNotificationChannel
- func NewObservabilityPlane(namespace, name string) *openchoreov1alpha1.ObservabilityPlane
- func NewProject(namespace, name string) *openchoreov1alpha1.Project
- func NewReleaseBinding(namespace, projectName, componentName, environmentName, name string) *openchoreov1alpha1.ReleaseBinding
- func NewResource(namespace, projectName, name string) *openchoreov1alpha1.Resource
- func NewResourceRelease(namespace, projectName, resourceName, name string) *openchoreov1alpha1.ResourceRelease
- func NewResourceReleaseBinding(namespace, projectName, resourceName, environment, name string) *openchoreov1alpha1.ResourceReleaseBinding
- func NewResourceType(namespace, name string) *openchoreov1alpha1.ResourceType
- func NewScheme() *runtime.Scheme
- func NewSecretReference(namespace, name string) *openchoreov1alpha1.SecretReference
- func NewTestAuthzChecker(pdp authzcore.PDP) *services.AuthzChecker
- func NewTrait(namespace, name string) *openchoreov1alpha1.Trait
- func NewWorkflow(namespace, name string) *openchoreov1alpha1.Workflow
- func NewWorkflowPlane(namespace, name string) *openchoreov1alpha1.WorkflowPlane
- func NewWorkflowRun(namespace, workflowName, name string) *openchoreov1alpha1.WorkflowRun
- func NewWorkload(namespace, projectName, componentName, name string) *openchoreov1alpha1.Workload
- func RequireEvalRequest(t *testing.T, req *authzcore.EvaluateRequest, ...)
- func TestLogger() *slog.Logger
- type CapturingPDP
- func (p *CapturingPDP) BatchEvaluate(_ context.Context, req *authzcore.BatchEvaluateRequest) (*authzcore.BatchEvaluateResponse, error)
- func (p *CapturingPDP) Evaluate(_ context.Context, req *authzcore.EvaluateRequest) (*authzcore.Decision, error)
- func (p *CapturingPDP) GetSubjectProfile(_ context.Context, _ *authzcore.ProfileRequest) (*authzcore.UserCapabilitiesResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthzContext ¶ added in v1.1.0
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 ¶
NewFakeClient creates an in-memory Kubernetes client pre-loaded with the given objects.
func NewNamespace ¶
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 ¶
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 ¶
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 (p *CapturingPDP) BatchEvaluate(_ context.Context, req *authzcore.BatchEvaluateRequest) (*authzcore.BatchEvaluateResponse, error)
func (*CapturingPDP) Evaluate ¶ added in v1.1.0
func (p *CapturingPDP) Evaluate(_ context.Context, req *authzcore.EvaluateRequest) (*authzcore.Decision, error)
func (*CapturingPDP) GetSubjectProfile ¶ added in v1.1.0
func (p *CapturingPDP) GetSubjectProfile(_ context.Context, _ *authzcore.ProfileRequest) (*authzcore.UserCapabilitiesResponse, error)