testcontext

package
v0.0.0-...-862d091 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnyToken                  = "any"
	AuthorizationHeaderName   = "Authorization"
	AuthorizationHeaderPrefix = "Bearer"
	OpaqueHeaderName          = "opaque-token"
)

Variables

This section is empty.

Functions

func AddApiGatewayCRIntoContext

func AddApiGatewayCRIntoContext(ctx context.Context, apiGateway *v1alpha1.APIGateway) context.Context

func AddCreatedTestObjectInContext

func AddCreatedTestObjectInContext(ctx context.Context, object client.Object) context.Context

func GetApiGatewayCRsFromContext

func GetApiGatewayCRsFromContext(ctx context.Context) ([]*v1alpha1.APIGateway, bool)

func GetCreatedTestObjectsFromContext

func GetCreatedTestObjectsFromContext(ctx context.Context) ([]client.Object, bool)

func GetK8sClientFromContext

func GetK8sClientFromContext(ctx context.Context) (client.Client, error)

func GetRetryOpts

func GetRetryOpts() []retry.Option

func GetTestingFromContext

func GetTestingFromContext(ctx context.Context) (*testing.T, error)

func SetK8sClientInContext

func SetK8sClientInContext(ctx context.Context, k8sClient client.Client) context.Context

func SetTestingInContext

func SetTestingInContext(ctx context.Context, testing *testing.T) context.Context

Types

type Config

type Config struct {
	CustomDomain              string `envconfig:"TEST_CUSTOM_DOMAIN,optional"`
	OIDCConfigUrl             string `envconfig:"TEST_OIDC_CONFIG_URL,optional"`
	IssuerUrl                 string `envconfig:"-"`
	ClientID                  string `envconfig:"TEST_CLIENT_ID,optional"`
	ClientSecret              string `envconfig:"TEST_CLIENT_SECRET,optional"`
	ReqAttempts               uint   `envconfig:"TEST_REQUEST_ATTEMPTS,default=60"`
	ReqDelay                  uint   `envconfig:"TEST_REQUEST_DELAY,default=5"`
	Domain                    string `envconfig:"TEST_DOMAIN,default=local.kyma.dev"`
	GatewayName               string `envconfig:"TEST_GATEWAY_NAME,default=kyma-gateway"`
	GatewayNamespace          string `envconfig:"TEST_GATEWAY_NAMESPACE,default=kyma-system"`
	TestConcurrency           int    `envconfig:"TEST_CONCURRENCY,default=4"`
	IstioNamespace            string `envconfig:"TEST_ISTIO_NAMESPACE,default=istio-system"`
	IsGardener                bool   `envconfig:"IS_GARDENER,default=false"`
	GCPServiceAccountJsonPath string `envconfig:"TEST_SA_ACCESS_KEY_PATH,optional"`
	DebugLogging              bool   `envconfig:"TEST_DEBUG_LOGGING,default=false"`
}

func GetConfig

func GetConfig() Config

func (*Config) EnforceGardener

func (c *Config) EnforceGardener()

func (*Config) EnforceSerialRun

func (c *Config) EnforceSerialRun()

func (*Config) RequireCredsForOIDC

func (c *Config) RequireCredsForOIDC() error

func (*Config) RequireCustomDomain

func (c *Config) RequireCustomDomain() error

func (*Config) RequireDomain

func (c *Config) RequireDomain() error

func (*Config) RequireGCPServiceAccount

func (c *Config) RequireGCPServiceAccount() error

func (*Config) ValidateCommon

func (c *Config) ValidateCommon(resourceMgr *resource.Manager, k8sClient dynamic.Interface) error

func (*Config) ValidateGardener

func (c *Config) ValidateGardener(resourceMgr *resource.Manager, k8sClient dynamic.Interface) error

type Testsuite

type Testsuite interface {
	Name() string
	FeaturePath() []string
	InitScenarios(ctx *godog.ScenarioContext)
	Setup() error
	TearDown()
	ResourceManager() *resource.Manager
	K8sClient() dynamic.Interface
	BeforeSuiteHooks() []func() error
	AfterSuiteHooks() []func() error
	ValidateAndFixConfig() error
	TestConcurrency() int
}

func New

func New(factory TestsuiteFactory) (Testsuite, error)

type TestsuiteFactory

type TestsuiteFactory func(httpClient *helpers.RetryableHttpClient, k8sClient dynamic.Interface, rm *resource.Manager, config Config) Testsuite

Jump to

Keyboard shortcuts

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