Documentation ¶
Overview ¶
Package test contains utilities used in the policy engine's test suite.
Index ¶
- func ArrayIterationBenchmarkModule(n int) string
- func Eventually(t *testing.T, timeout time.Duration, f func() bool) bool
- func GenerateConcurrencyBenchmarkData() (string, map[string]interface{})
- func GenerateJSONBenchmarkData(k, v int) map[string]interface{}
- func GenerateLargeJSONBenchmarkData() map[string]interface{}
- func GenerateVirtualDocsBenchmarkData(numTotalRules, numHitRules int) (string, map[string]interface{})
- func MakeTempFS(root, prefix string, files map[string]string) (rootDir string, cleanup func(), err error)
- func ObjectIterationBenchmarkModule(n int) string
- func PartialObjectBenchmarkCrossModule(n int) []string
- func SetIterationBenchmarkModule(n int) string
- func Skip(*testing.T)
- func WithTempFS(files map[string]string, f func(string))
- func WithTestFS(files map[string]string, inMemoryFS bool, f func(string, fs.FS))
- type BlockingWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayIterationBenchmarkModule ¶ added in v0.27.0
ArrayIterationBenchmarkModule returns a module that iterates an array with `n` elements
func Eventually ¶ added in v0.54.0
func GenerateConcurrencyBenchmarkData ¶ added in v0.27.0
GenerateConcurrencyBenchmarkData returns a module and data; the module checks some input parameters against that data in a simple API authz scheme.
func GenerateJSONBenchmarkData ¶ added in v0.27.0
GenerateJSONBenchmarkData returns a map of `k` keys and `v` key/value pairs.
func GenerateLargeJSONBenchmarkData ¶ added in v0.27.0
func GenerateLargeJSONBenchmarkData() map[string]interface{}
GenerateLargeJSONBenchmarkData returns a map of 100 keys and 100.000 key/value pairs.
func GenerateVirtualDocsBenchmarkData ¶ added in v0.27.0
func GenerateVirtualDocsBenchmarkData(numTotalRules, numHitRules int) (string, map[string]interface{})
GenerateVirtualDocsBenchmarkData generates a module and input; the numTotalRules and numHitRules create as many rules in the module to match/miss the returned input.
func MakeTempFS ¶ added in v0.5.7
func MakeTempFS(root, prefix string, files map[string]string) (rootDir string, cleanup func(), err error)
MakeTempFS creates a temporary directory structure for test purposes rooted at root. If root is empty, the dir is created in the default system temp location. If the creation fails, cleanup is nil and the caller does not have to invoke it. If creation succeeds, the caller should invoke cleanup when they are done.
func ObjectIterationBenchmarkModule ¶ added in v0.27.0
ObjectIterationBenchmarkModule returns a module that iterates an object with `n` key/val pairs
func PartialObjectBenchmarkCrossModule ¶ added in v0.48.0
PartialObjectBenchmarkCrossModule returns a module with n "bench_test_" prefixed rules that each refer to another "cond_bench_" prefixed rule
func SetIterationBenchmarkModule ¶ added in v0.27.0
SetIterationBenchmarkModule returns a module that iterates a set with `n` elements
func Skip ¶ added in v0.42.0
Skip will skip this test on pull request CI runs. Used for slow test runners on GHA's darwin machines.
func WithTempFS ¶ added in v0.5.7
WithTempFS creates a temporary directory structure and invokes f with the root directory path.
Types ¶
type BlockingWriter ¶ added in v0.61.0
type BlockingWriter struct {
// contains filtered or unexported fields
}
func (*BlockingWriter) Reset ¶ added in v0.61.0
func (w *BlockingWriter) Reset()
func (*BlockingWriter) String ¶ added in v0.61.0
func (w *BlockingWriter) String() string