hooks

package
v0.0.0-...-cfcfa37 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const ApiGatewayCRName string = "default"

Variables

View Source
var ApiGatewayCrTearDownScenarioHook = func(ctx context.Context, sc *godog.Scenario, _ error) (context.Context, error) {
	if apiGateways, ok := testcontext.GetApiGatewayCRsFromContext(ctx); ok {

		for _, apiGateway := range apiGateways {
			_ = retry.Do(func() error {
				err := removeObjectFromCluster(ctx, apiGateway)
				if err != nil {
					return fmt.Errorf("failed to delete ApiGateway CR %s", apiGateway.GetName())
				}
				return nil
			}, testcontext.GetRetryOpts()...)
			err := forceApiGatewayCrRemoval(ctx, apiGateway)
			if err != nil {
				return ctx, err
			}
		}
	}
	return ctx, nil
}
View Source
var ApiGatewayCrTearDownSuiteHook = func() error {
	k8sClient := k8sclient.GetK8sClient()

	apiGateway, err := createApiGatewayCRObjectFromTemplate(ApiGatewayCRName)
	if err != nil {
		return err
	}

	err = retry.Do(func() error {
		err := k8sClient.Delete(context.Background(), &apiGateway)
		if err != nil {
			return err
		}
		return nil
	}, testcontext.GetRetryOpts()...)
	if err != nil {
		return err
	}

	err = retry.Do(func() error {
		err := k8sClient.Get(context.Background(), client.ObjectKey{
			Namespace: apiGateway.GetNamespace(),
			Name:      apiGateway.GetName(),
		}, &apiGateway)

		if err == nil {
			return fmt.Errorf("ApiGatewayCrTearDownSuiteHook did not delete APIGateway CR, state: %s description: %s", apiGateway.Status.State, apiGateway.Status.Description)
		}

		return nil
	})
	if err != nil {
		return err
	}

	return nil
}
View Source
var ApplyAndVerifyApiGatewayCrSuiteHook = func() error {
	return applyAndVerifyApiGateway(false)
}
View Source
var ApplyAndVerifyApiGatewayWithoutOathkeeperCrSuiteHook = func() error {
	return applyAndVerifyApiGateway(true)
}
View Source
var ApplyApiGatewayCrScenarioHook = func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
	k8sClient, err := testcontext.GetK8sClientFromContext(ctx)
	if err != nil {
		return ctx, err
	}

	if err := createDeprecatedV1ConfigMap(context.Background(), k8sClient); err != nil {
		return ctx, err
	}

	apiGateway, err := createApiGatewayCRObjectFromTemplate(ApiGatewayCRName)
	if err != nil {
		return ctx, err
	}
	err = retry.Do(func() error {
		err := k8sClient.Create(ctx, &apiGateway)
		if err != nil {
			return err
		}
		ctx = testcontext.AddApiGatewayCRIntoContext(ctx, &apiGateway)
		return nil
	}, testcontext.GetRetryOpts()...)
	return ctx, err
}
View Source
var DeleteBlockingResourcesScenarioHook = func(ctx context.Context, sc *godog.Scenario, _ error) (context.Context, error) {
	return ctx, deleteBlockingResources(ctx)
}
View Source
var DeleteBlockingResourcesSuiteHook = func() error {
	return deleteBlockingResources(context.Background())
}
View Source
var DisableV2Alpha1RequiredFieldsHook = func() error {
	err := patch.Removev2alpha1VersionRequiredFields(k8sclient.GetK8sClient())
	if err != nil {
		log.Printf("Failed to disable v2alpha1 required fields: %v", err)
	}
	return err
}
View Source
var Removev2alpha1VersionRequiredFieldsHook = func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
	k8sClient, err := testcontext.GetK8sClientFromContext(ctx)
	if err != nil {
		return ctx, err
	}

	return ctx, patch.Removev2alpha1VersionRequiredFields(k8sClient)
}
View Source
var WaitUntilApiGatewayDepsAreRemovedHook = func(ctx context.Context, sc *godog.Scenario, _ error) (context.Context, error) {
	err := waitUntilObjectIsRemoved(ctx, dnsKind, kymaDNSName, kymaDNSNamespace)
	if err != nil {
		return ctx, err
	}

	err = waitUntilObjectIsRemoved(ctx, gatewayKind, kymaGatewayName, kymaGatewayNamespace)
	if err != nil {
		return ctx, err
	}

	err = waitUntilObjectIsRemoved(ctx, certKind, kymaCertName, kymaCertNamespace)
	if err != nil {
		return ctx, err
	}

	return ctx, nil
}

Functions

func DnsPatchForK3dSuiteHook

func DnsPatchForK3dSuiteHook(t testcontext.Testsuite) func() error

func DnsPatchForK3dSuiteHookTeardown

func DnsPatchForK3dSuiteHookTeardown(t testcontext.Testsuite) func() error

func ExtAuthorizerInstallHook

func ExtAuthorizerInstallHook(t testcontext.Testsuite) func() error

func ExtAuthorizerRemoveHook

func ExtAuthorizerRemoveHook(t testcontext.Testsuite) func() error

func IstioSkipVerifyJwksResolverSuiteHook

func IstioSkipVerifyJwksResolverSuiteHook(t testcontext.Testsuite) func() error

func IstioSkipVerifyJwksResolverSuiteHookTeardown

func IstioSkipVerifyJwksResolverSuiteHookTeardown(t testcontext.Testsuite) func() error

Types

This section is empty.

Jump to

Keyboard shortcuts

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