test

package
v0.2.59 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertNoRatelimitAnnotations

func AssertNoRatelimitAnnotations(
	t *testing.T,
	actualAnnotations annotations.Annotations,
)

AssertNoRatelimitAnnotations - the annotations that ResourceSyncers return can contain "informational" ratelimit annotations that let the caller know how much quota they have left and that their request was _not_ rejected. This helper just asserts that there are no "your request was ratelimited" annotations.

func AssertValidation added in v0.2.22

func AssertValidation(
	t *testing.T,
	validate func() error,
	expectedSuccess bool,
)

AssertValidation - call an arbitrary validation function and assert the result matches the expected result.

func AssertWasRatelimited

func AssertWasRatelimited(
	t *testing.T,
	actualAnnotations annotations.Annotations,
)

func ExerciseTestCase added in v0.2.23

func ExerciseTestCase(
	t *testing.T,
	configurationSchema field.Configuration,
	extraValidationFunction func(*viper.Viper) error,
	configs map[string]string,
	isValid bool,
)

func ExerciseTestCases added in v0.2.22

func ExerciseTestCases(
	t *testing.T,
	configurationSchema field.Configuration,
	extraValidationFunction func(*viper.Viper) error,
	testCases []TestCase,
)

ExerciseTestCases - this helper function is meant to be called by each connector to make sure that the every `Field` and `Relationship` do what we expect. Some connectors need to run custom validations, and they can be added as the `extraValidationFunction` parameter.

func ExerciseTestCasesFromExpressions added in v0.2.22

func ExerciseTestCasesFromExpressions(
	t *testing.T,
	configurationSchema field.Configuration,
	extraValidationFunction func(*viper.Viper) error,
	expressionParser func(string) (map[string]string, error),
	testCases []TestCaseFromExpression,
)

ExerciseTestCasesFromExpressions - Like ExerciseTestCases, but instead of passing a `map[string]string` to each test case, pass a function that parses configs from strings and pass each test case an expression as a string.

func ExhaustEntitlementPagination

func ExhaustEntitlementPagination(
	ctx context.Context,
	c connectorbuilder.ResourceSyncer,
	resource *v2.Resource,
) (
	[]*v2.Entitlement,
	annotations.Annotations,
	error,
)

func ExhaustGrantPagination

func ExhaustGrantPagination(
	ctx context.Context,
	c connectorbuilder.ResourceSyncer,
	resource *v2.Resource,
) (
	[]*v2.Grant,
	annotations.Annotations,
	error,
)

func GrantsIntegrationTest

func GrantsIntegrationTest(
	ctx context.Context,
	t *testing.T,
	c builder,
	principal *v2.Resource,
	entitlement *v2.Entitlement,
)

GrantsIntegrationTest - create a grant and then revoke it. Any connector that implements provisioning should be able to successfully run this test.

func IsRatelimited

func IsRatelimited(actualAnnotations annotations.Annotations) bool

func MakeViper added in v0.2.22

func MakeViper(input map[string]string) *viper.Viper

Types

type TestCase added in v0.2.22

type TestCase = struct {
	Configs map[string]string
	IsValid bool
	Message string
}

type TestCaseFromExpression added in v0.2.22

type TestCaseFromExpression = struct {
	Expression string
	IsValid    bool
	Message    string
}

Jump to

Keyboard shortcuts

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