testutil

package
v1.39.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaveatedFoundSubject

func CaveatedFoundSubject(subjectID string, expr *core.CaveatExpression) *v1.FoundSubject

CaveatedFoundSubject returns a FoundSubject with the given ID and caveat expression.

func CaveatedWildcard

func CaveatedWildcard(expr *core.CaveatExpression, exclusions ...*v1.FoundSubject) *v1.FoundSubject

CaveatedWildcard returns a wildcard FoundSubject with the given caveat expression and exclusions.

func CheckEquivalentSets

func CheckEquivalentSets(expected []*v1.FoundSubject, found []*v1.FoundSubject) error

CheckEquivalentSets checks if the sets of subjects are equivalent and returns an error if they are not.

func CheckEquivalentSubjects

func CheckEquivalentSubjects(expected *v1.FoundSubject, found *v1.FoundSubject) error

CheckEquivalentSubjects checks if the given subjects are equivalent and returns an error if they are not.

func CmpSubjects added in v1.26.0

func CmpSubjects(a, b *v1.FoundSubject) int

CmpSubjects compares FoundSubjects such that they can be sorted.

func FormatSubject

func FormatSubject(sub *v1.FoundSubject) string

FormatSubject formats the given subject (which can be nil) into a human-readable string.

func FormatSubjects

func FormatSubjects(subs []*v1.FoundSubject) string

FormatSubjects formats the given slice of subjects in a human-readable string.

func FoundSubject

func FoundSubject(subjectID string) *v1.FoundSubject

FoundSubject returns a FoundSubject with the given ID.

func RequireEquivalentSets

func RequireEquivalentSets(t *testing.T, expected []*v1.FoundSubject, found []*v1.FoundSubject)

RequireEquivalentSets requires that the given sets of subjects are equivalent.

func RequireExpectedSubject

func RequireExpectedSubject(t *testing.T, expected *v1.FoundSubject, produced **v1.FoundSubject)

RequireExpectedSubject requires that the given expected and produced subjects match.

func Wildcard

func Wildcard(exclusions ...string) *v1.FoundSubject

Wildcard returns a FoundSubject with the given subject IDs as concrete exclusions.

func WrapFoundSubject

func WrapFoundSubject(sub *v1.FoundSubject) **v1.FoundSubject

WrapFoundSubject wraps the given subject into a pointer to it, unless nil, in which case this method returns nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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