framework

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0 Imports: 22 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePipelineRunFromJSON

func CreatePipelineRunFromJSON(ctx context.Context, pipelineRunJSON string) (result *api.PipelineRun, err error)

CreatePipelineRunFromJSON creates a Tenant resource on a client

func CreatePipelineRunFromYAML

func CreatePipelineRunFromYAML(ctx context.Context, pipelineRunYAML string) (result *api.PipelineRun, err error)

CreatePipelineRunFromYAML creates a Tenant resource on a client

func CreateTenant

func CreateTenant(ctx context.Context, tenant *api.Tenant) (*api.Tenant, error)

CreateTenant creates a Tenant resource on a client

func CreateTenantFromJSON

func CreateTenantFromJSON(ctx context.Context, tenantJSON string) (result *api.Tenant, err error)

CreateTenantFromJSON creates a Tenant resource on a client

func CreateTenantFromYAML

func CreateTenantFromYAML(ctx context.Context, tenantYAML string) (result *api.Tenant, err error)

CreateTenantFromYAML creates a Tenant resource on a client

func DeletePipelineRun

func DeletePipelineRun(ctx context.Context, pipelineRun *api.PipelineRun) error

DeletePipelineRun deletes a Tenant resource from a client

func DeleteTenant

func DeleteTenant(ctx context.Context, tenant *api.Tenant) error

DeleteTenant deletes a Tenant resource from a client

func ExecutePipelineRunTests

func ExecutePipelineRunTests(t *testing.T, testPlans ...TestPlan)

ExecutePipelineRunTests execute a set of testPlans

func GetClientFactory

func GetClientFactory(ctx context.Context) k8s.ClientFactory

GetClientFactory returns the client factory from the context

func GetNamespace

func GetNamespace(ctx context.Context) string

GetNamespace returns the client namespace from the context

func GetPipelineRun

func GetPipelineRun(ctx context.Context) *api.PipelineRun

GetPipelineRun returns the pipeline run from the context

func GetRealmUUID added in v0.2.0

func GetRealmUUID(ctx context.Context) string

GetRealmUUID returns an UUID for the test execution

func GetTenant

func GetTenant(ctx context.Context, tenant *api.Tenant) (*api.Tenant, error)

GetTenant returns a Tenant resource from a client

func GetTenantNamespace

func GetTenantNamespace(ctx context.Context) string

GetTenantNamespace returns the tenant namespace from the context

func GetTestName

func GetTestName(ctx context.Context) string

GetTestName returns the test Name from the context

func GetWaitInterval

func GetWaitInterval(ctx context.Context) time.Duration

GetWaitInterval returns the wait Interval Defaults to 1s if nothing was set

func SetClientFactory

func SetClientFactory(ctx context.Context, clientFactory k8s.ClientFactory) context.Context

SetClientFactory returns a context with client factory

func SetNamespace

func SetNamespace(ctx context.Context, namespace string) context.Context

SetNamespace sets the client namespace to the context

func SetPipelineRun

func SetPipelineRun(ctx context.Context, PipelineRun *api.PipelineRun) context.Context

SetPipelineRun sets the Namespace to the context

func SetRealmUUID added in v0.2.0

func SetRealmUUID(ctx context.Context) context.Context

SetRealmUUID returns an UUID for the test execution

func SetTenantNamespace

func SetTenantNamespace(ctx context.Context, namespace string) context.Context

SetTenantNamespace sets the tenant namespace to the context

func SetTestName

func SetTestName(ctx context.Context, Name string) context.Context

SetTestName sets the test Name to the context

func SetWaitInterval

func SetWaitInterval(ctx context.Context, interval time.Duration) context.Context

SetWaitInterval sets the test Name to the context

func Setup

func Setup(t *testing.T) context.Context

Setup prepares the test environment

func WaitFor

func WaitFor(ctx context.Context, conditionFunc WaitConditionFunc) (time.Duration, error)

WaitFor waits for a condition it returns the duration the waiting took it returns an error if condition cannot be fullfilled anymore

Types

type PipelineRunCheck

type PipelineRunCheck func(*api.PipelineRun) (bool, error)

PipelineRunCheck is a Check for a PipelineRun

func PipelineRunHasStateResult

func PipelineRunHasStateResult(result api.Result) PipelineRunCheck

PipelineRunHasStateResult returns a PipelineRunCheck which Checks if a PipelineRun has a dedicated result

func PipelineRunMessageOnFinished

func PipelineRunMessageOnFinished(message string) PipelineRunCheck

PipelineRunMessageOnFinished returns a PipelineRunCheck which Checks if a PipelineRun has a dedicated message when it is in state finished

type PipelineRunTest

type PipelineRunTest struct {
	PipelineRun *api.PipelineRun
	Secrets     []*v1.Secret
	Check       PipelineRunCheck
	Expected    string
	Timeout     time.Duration
}

PipelineRunTest is a test for a pipeline run

type PipelineRunTestBuilder

type PipelineRunTestBuilder = func(string, *api.CustomJSON) PipelineRunTest

PipelineRunTestBuilder is a funciton creating a PipelineRunTest for a defined Namespace and a buildID for the elasticsearch

type TenantCheck

type TenantCheck func(*api.Tenant) bool

TenantCheck is a Check for a tenant

func TenantIsReady

func TenantIsReady() TenantCheck

TenantIsReady creates a TenantCheck which Checks if tenant has readyCondition wiht status true

type TenantTest

type TenantTest struct {
	// contains filtered or unexported fields
}

TenantTest is a test for a Tenant

func TenantSuccessTest

func TenantSuccessTest(ctx context.Context) TenantTest

TenantSuccessTest is a test Checking if a tenant was created successfully

type TestPlan

type TestPlan struct {
	Name             string
	TestBuilder      PipelineRunTestBuilder
	Count            int
	ParallelCreation bool
	CreationDelay    time.Duration
	Cleanup          bool
}

TestPlan defines a test plan

type WaitConditionFunc

type WaitConditionFunc func(context.Context) (bool, error)

WaitConditionFunc is a function waiting for a condition return true,nil if condition is fullfilled return false,nil if condition may be fullfilled in the future returns nil,error if condition is not fullfilled

func CreatePipelineRunCondition

func CreatePipelineRunCondition(pipelineRunToFind *api.PipelineRun, check PipelineRunCheck) WaitConditionFunc

CreatePipelineRunCondition returns a WaitCondition for a PipelineRun with a dedicated PipelineCheck

func CreateTenantCondition

func CreateTenantCondition(tenant *api.Tenant, Check TenantCheck) WaitConditionFunc

CreateTenantCondition creates a WaitCondition for a tenant with a dedicated Check

Jump to

Keyboard shortcuts

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