framework

package
v0.0.0-...-02c6b06 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TestNamespacePrefix = "tm-it"
)

Variables

View Source
var (
	CoreSecrets = []string{
		"s3-secret",
	}
)

Functions

func ValidateConfig

func ValidateConfig(config *Config) error

ValidateConfig validates a framework configuration

Types

type Config

type Config struct {
	CommitSha        string
	Namespace        string
	TmKubeconfigPath string
	TmNamespace      string
	S3Endpoint       string

	Local        bool
	TMConfigPath string
}

Framework operation configuration

func RegisterFlags

func RegisterFlags(flagset *flag.FlagSet) *Config

RegisterFlags adds all framework operation specific flags to the provided flagset.

type Operation

type Operation struct {
	State OperationState
	// contains filtered or unexported fields
}

Operation is a common set of configuration and functions for running testmachinery integration tests.

func New

func New(log logr.Logger, config *Config) (*Operation, error)

New creates a new test operation with a logger and a framework configuration.

func (*Operation) AfterSuite

func (o *Operation) AfterSuite()

AfterSuite should be registered as ginkgo's after suite. It cleans up all previously created resources that are in the operation state.

func (*Operation) Client

func (o *Operation) Client() client.Client

Client returns the kubernetes client of the current test cluster

func (*Operation) Commit

func (o *Operation) Commit() string

Commit returns the current commit sha of the test-infra repo

func (*Operation) EnsureTestNamespace

func (o *Operation) EnsureTestNamespace(ctx context.Context) error

EnsureTestNamespace creates the namespace specified in the config it does not exist. if o.config.TestNamespace is empty a random generated namespace will be created. Additionally necessary resources were created and added to the operation state.

func (*Operation) GetKubeconfigPath

func (o *Operation) GetKubeconfigPath() string

GetKubeconfigPath returns the path to the current kubeconfig

func (*Operation) IsLocal

func (o *Operation) IsLocal() bool

IsLocal indicates if the test is running against a local testmachinery controller

func (*Operation) Log

func (o *Operation) Log() logr.Logger

Log returns the test logger

func (*Operation) RunTestrun

func (o *Operation) RunTestrun(ctx context.Context, tr *tmv1beta1.Testrun, phase argov1.WorkflowPhase, timeout time.Duration, watchFunc utils.WatchFunc) (*tmv1beta1.Testrun, *argov1.Workflow, error)

func (*Operation) RunTestrunUntilCompleted

func (o *Operation) RunTestrunUntilCompleted(ctx context.Context, tr *tmv1beta1.Testrun, phase argov1.WorkflowPhase, timeout time.Duration) (*tmv1beta1.Testrun, *argov1.Workflow, error)

func (*Operation) S3Config

func (o *Operation) S3Config() (*config.S3, error)

S3Config returns the s3 testConfig that is used by the testmachinery to test

func (*Operation) S3Endpoint

func (o *Operation) S3Endpoint() string

func (*Operation) TestMachineryNamespace

func (o *Operation) TestMachineryNamespace() string

TestMachineryNamespace returns the current namespace where the testmachinery components are running.

func (*Operation) TestNamespace

func (o *Operation) TestNamespace() string

TestNamespace returns the name of the current test namespace

func (*Operation) WaitForClusterReadiness

func (o *Operation) WaitForClusterReadiness(maxWaitTime time.Duration) error

WaitForClusterReadiness waits until all Test Machinery components are ready

type OperationState

type OperationState struct {
	Objects []client.Object
}

func (*OperationState) AppendObject

func (s *OperationState) AppendObject(obj client.Object)

AppendObject adds a kubernetes objects to the start of the state's objects. These objects are meant to be cleaned up after the test has run.

Jump to

Keyboard shortcuts

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