testvalidate

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testvalidate provides shared validation test helpers used by both the top-level corpus tests and the x/exp/schema/validate corpus tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunEntityChecks

func RunEntityChecks(t *testing.T, rs *resolved.Schema, entities cedar.EntityMap, cv Validation)

RunEntityChecks runs aggregate and per-entity validation checks.

func RunPolicyChecks

func RunPolicyChecks(t *testing.T, rs *resolved.Schema, policySet *cedar.PolicySet, cv Validation)

RunPolicyChecks runs aggregate and per-policy validation checks.

func RunRequestChecks

func RunRequestChecks(t *testing.T, rs *resolved.Schema, cv Validation, requests []cedar.Request)

RunRequestChecks runs per-request validation checks.

Types

type PerEntityResult

type PerEntityResult struct {
	Errors []string `json:"errors"`
}

PerEntityResult holds expected per-entity validation results from Rust Cedar.

type PerPolicyResult

type PerPolicyResult struct {
	Strict           bool     `json:"strict"`
	Permissive       bool     `json:"permissive"`
	StrictErrors     []string `json:"strictErrors"`
	PermissiveErrors []string `json:"permissiveErrors"`
}

PerPolicyResult holds expected per-policy validation results from Rust Cedar.

type RequestValidationResult

type RequestValidationResult struct {
	Description string   `json:"description"`
	Strict      *bool    `json:"strict"`
	Permissive  *bool    `json:"permissive"`
	Errors      []string `json:"errors"`
}

RequestValidationResult holds expected per-request validation results.

type Validation

type Validation struct {
	PolicyValidation struct {
		Strict           bool                       `json:"strict"`
		Permissive       bool                       `json:"permissive"`
		StrictErrors     []string                   `json:"strictErrors"`
		PermissiveErrors []string                   `json:"permissiveErrors"`
		PerPolicy        map[string]PerPolicyResult `json:"perPolicy"`
	} `json:"policyValidation"`
	EntityValidation struct {
		PerEntity map[string]PerEntityResult `json:"perEntity"`
	} `json:"entityValidation"`
	RequestValidation []RequestValidationResult `json:"requestValidation"`
}

Validation holds the full expected validation results from Rust Cedar.

func ParseValidation

func ParseValidation(t testing.TB, data []byte) Validation

ParseValidation unmarshals validation JSON data into a Validation struct.

Jump to

Keyboard shortcuts

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