e2e

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TODO: accept a flag?
	PorchTestConfigFile = "porch-test-config.yaml"

	TestGitServerImage = "test-git-server"
)

Variables

This section is empty.

Functions

func DebugFormat

func DebugFormat(obj client.Object) string

func InferGitServerImage added in v1.3.1

func InferGitServerImage(porchImage string) string

func RunSuite added in v1.3.1

func RunSuite(suite interface{}, t *testing.T)

RunSuite runs a test suite by calling each Test* method in the suite. Before each Test* method, it sets the T field of the suite to the current test. Before running the suite, it initializes the suite by calling Initialize.

Types

type ErrorHandler

type ErrorHandler func(format string, args ...interface{})

type GitConfig

type GitConfig struct {
	Repo      string   `json:"repo"`
	Branch    string   `json:"branch"`
	Directory string   `json:"directory"`
	Username  string   `json:"username"`
	Password  Password `json:"password"`
}

type Initializer

type Initializer interface {
	Initialize(ctx context.Context)
}

type OciConfig

type OciConfig struct {
	Registry string `json:"registry"`
}

type Password

type Password string

func (Password) String

func (p Password) String() string

type RepositoryOption added in v1.3.1

type RepositoryOption func(*configapi.Repository)

func InNamespace added in v1.3.1

func InNamespace(ns string) RepositoryOption

func WithDeployment added in v1.3.1

func WithDeployment() RepositoryOption

type TSetter added in v1.3.1

type TSetter interface {
	SetT(tt *testing.T)
}

type TestSuite

type TestSuite struct {
	*testing.T
	Kubeconfig *rest.Config
	Client     client.Client

	// Strongly-typed client handy for reading e.g. pod logs
	KubeClient kubernetes.Interface

	Clientset porchclient.Interface

	Namespace         string // K8s namespace for this test run
	TestRunnerIsLocal bool   // Tests running against local dev porch
}

func (*TestSuite) CompareGoldenFileYAML

func (t *TestSuite) CompareGoldenFileYAML(goldenPath string, gotContents string) string

func (*TestSuite) CreateE

func (t *TestSuite) CreateE(ctx context.Context, obj client.Object, opts ...client.CreateOption)

func (*TestSuite) CreateF

func (t *TestSuite) CreateF(ctx context.Context, obj client.Object, opts ...client.CreateOption)

func (*TestSuite) CreateGitRepo

func (t *TestSuite) CreateGitRepo() GitConfig

func (*TestSuite) CreatePackageDraftF added in v1.3.1

func (t *TestSuite) CreatePackageDraftF(ctx context.Context, repository, name, workspace string) *porchapi.PackageRevision

Creates an empty package draft by initializing an empty package

func (*TestSuite) DeleteE

func (t *TestSuite) DeleteE(ctx context.Context, obj client.Object, opts ...client.DeleteOption)

func (*TestSuite) DeleteF

func (t *TestSuite) DeleteF(ctx context.Context, obj client.Object, opts ...client.DeleteOption)

func (*TestSuite) DeleteL

func (t *TestSuite) DeleteL(ctx context.Context, obj client.Object, opts ...client.DeleteOption)

func (*TestSuite) DumpLogsForDeploymentE

func (t *TestSuite) DumpLogsForDeploymentE(ctx context.Context, deploymentKey client.ObjectKey)

func (*TestSuite) Error

func (t *TestSuite) Error(args ...any)

func (*TestSuite) Errorf

func (t *TestSuite) Errorf(format string, args ...any)

func (*TestSuite) Fatal

func (t *TestSuite) Fatal(args ...any)

func (*TestSuite) Fatalf

func (t *TestSuite) Fatalf(format string, args ...any)

func (*TestSuite) FindAndDecodeF

func (t *TestSuite) FindAndDecodeF(resources *porchapi.PackageRevisionResources, name string, value interface{})

func (*TestSuite) GetContentsOfPackageRevision added in v1.3.1

func (t *TestSuite) GetContentsOfPackageRevision(ctx context.Context, repository string, pkgName string, revision string) map[string]string

func (*TestSuite) GetE

func (t *TestSuite) GetE(ctx context.Context, key client.ObjectKey, obj client.Object)

func (*TestSuite) GetF

func (t *TestSuite) GetF(ctx context.Context, key client.ObjectKey, obj client.Object)

func (*TestSuite) Initialize

func (t *TestSuite) Initialize(ctx context.Context)

func (*TestSuite) IsPorchServerInCluster

func (t *TestSuite) IsPorchServerInCluster() bool

func (*TestSuite) IsTestRunnerInCluster

func (t *TestSuite) IsTestRunnerInCluster() bool

func (*TestSuite) ListE

func (t *TestSuite) ListE(ctx context.Context, list client.ObjectList, opts ...client.ListOption)

func (*TestSuite) ListF

func (t *TestSuite) ListF(ctx context.Context, list client.ObjectList, opts ...client.ListOption)

func (*TestSuite) MustExist added in v1.3.1

func (t *TestSuite) MustExist(ctx context.Context, key client.ObjectKey, obj client.Object)

func (*TestSuite) MustNotExist added in v1.3.1

func (t *TestSuite) MustNotExist(ctx context.Context, obj client.Object)

func (*TestSuite) ParseKptfileF

func (t *TestSuite) ParseKptfileF(resources *porchapi.PackageRevisionResources) *kptfilev1.KptFile

func (*TestSuite) PatchE

func (t *TestSuite) PatchE(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption)

func (*TestSuite) PatchF

func (t *TestSuite) PatchF(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption)

func (*TestSuite) RegisterGitRepositoryF added in v1.3.1

func (t *TestSuite) RegisterGitRepositoryF(ctx context.Context, repo, name, directory string, opts ...RepositoryOption)

func (*TestSuite) SaveKptfileF

func (t *TestSuite) SaveKptfileF(resources *porchapi.PackageRevisionResources, kptfile *kptfilev1.KptFile)

func (*TestSuite) SetT added in v1.3.1

func (t *TestSuite) SetT(tt *testing.T)

func (*TestSuite) UpdateApprovalF

func (*TestSuite) UpdateE

func (t *TestSuite) UpdateE(ctx context.Context, obj client.Object, opts ...client.UpdateOption)

func (*TestSuite) UpdateF

func (t *TestSuite) UpdateF(ctx context.Context, obj client.Object, opts ...client.UpdateOption)

func (*TestSuite) ValidateFinalizers added in v1.3.1

func (t *TestSuite) ValidateFinalizers(ctx context.Context, name string, finalizers []string)

func (*TestSuite) ValidateLabelsAndAnnos added in v1.3.1

func (t *TestSuite) ValidateLabelsAndAnnos(ctx context.Context, name string, labels, annos map[string]string)

func (*TestSuite) ValidateOwnerReferences added in v1.3.1

func (t *TestSuite) ValidateOwnerReferences(ctx context.Context, name string, ownerRefs []metav1.OwnerReference)

func (*TestSuite) WaitUntilAllPackagesDeleted added in v1.3.1

func (t *TestSuite) WaitUntilAllPackagesDeleted(ctx context.Context, repoName string)

func (*TestSuite) WaitUntilDraftPackageRevisionExists added in v1.3.1

func (t *TestSuite) WaitUntilDraftPackageRevisionExists(ctx context.Context, repository string, pkgName string) *porchapi.PackageRevision

func (*TestSuite) WaitUntilObjectDeleted added in v1.3.1

func (t *TestSuite) WaitUntilObjectDeleted(ctx context.Context, gvk schema.GroupVersionKind, namespacedName types.NamespacedName, d time.Duration)

func (*TestSuite) WaitUntilPackageRevisionExists added in v1.3.1

func (t *TestSuite) WaitUntilPackageRevisionExists(ctx context.Context, repository string, pkgName string, revision string) *porchapi.PackageRevision

func (*TestSuite) WaitUntilPackageRevisionFulfillingConditionExists added in v1.3.1

func (t *TestSuite) WaitUntilPackageRevisionFulfillingConditionExists(
	ctx context.Context,
	timeout time.Duration,
	condition func(porchapi.PackageRevision) bool,
) (*porchapi.PackageRevision, error)

func (*TestSuite) WaitUntilPackageRevisionResourcesExists added in v1.3.1

func (t *TestSuite) WaitUntilPackageRevisionResourcesExists(
	ctx context.Context,
	key types.NamespacedName,
) *porchapi.PackageRevisionResources

func (*TestSuite) WaitUntilRepositoryDeleted added in v1.3.1

func (t *TestSuite) WaitUntilRepositoryDeleted(ctx context.Context, name, namespace string)

func (*TestSuite) WaitUntilRepositoryReady added in v1.3.1

func (t *TestSuite) WaitUntilRepositoryReady(ctx context.Context, name, namespace string)

WaitUntilRepositoryReady waits for up to 60 seconds for the repository with the provided name and namespace is ready, i.e. the Ready condition is true. It also queries for Functions and PackageRevisions, to ensure these are also ready - this is an artifact of the way we've implemented the aggregated apiserver, where the first fetch can sometimes be synchronous.

type TestSuiteWithGit added in v1.3.1

type TestSuiteWithGit struct {
	TestSuite
	// contains filtered or unexported fields
}

func (*TestSuiteWithGit) GitConfig added in v1.3.1

func (p *TestSuiteWithGit) GitConfig(repoID string) GitConfig

func (*TestSuiteWithGit) Initialize added in v1.3.1

func (p *TestSuiteWithGit) Initialize(ctx context.Context)

func (*TestSuiteWithGit) RegisterMainGitRepositoryF added in v1.3.1

func (t *TestSuiteWithGit) RegisterMainGitRepositoryF(ctx context.Context, name string, opts ...RepositoryOption)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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