e2e

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: Apache-2.0 Imports: 51 Imported by: 0

README

Backend end to end tests

This runs a series of tests against the Kubernetes API to verify that OLM is functioning properly.

Requirements

  • Helm > 2.7.0

How to use

Execute make e2e-local in the root of the repository, which will:

  • optionally update test/e2e/assets/chart/zz_chart.go as needed
  • build local executables used during testing
    • bin/e2e-local.test
    • bin/wait
    • bin/cpb
    • bin/catalog
    • bin/olm
    • bin/package-server
  • build docker file e2e.Dockerfile which includes the local executables in a kind image archive test/e2e-local.image.tar
  • execute ginkgo to run the pre-compiled test package bin/e2e-local.test with the kind image archive. This runs BDD tests defined in test/e2e
    • these tests are run in a kind cluster that is started fresh each time the test is executed

Examples:

  • Run all BDD tests (this takes a long time)

    make e2e-local
    
  • Run a specific BDD test using the TEST argument to make. Note that this argument uses regular expressions.

    make e2e-local TEST='API service resource not migrated if not adoptable'
    
  • If you have previously created the bin/e2e-local.test executable and want a quick way to ensure that your TEST regex argument will work, you can bypass the make file and use -dryRun with -focus and see if the regex would trigger your specific test(s).

    GO111MODULE=on go run github.com/onsi/ginkgo/v2/ginkgo -dryRun -focus 'API service resource not migrated if not adoptable' bin/e2e-local.test
    
  • It is also possible to specify the number of parallel test nodes (i.e. one or more instances of go test) to run using the NODES argument. Defaults to 1 if not specified

    make e2e-local NODES=2
    

Build infrastructure

Note that the make file target e2e-local is executed by the github workflow .github/workflows/e2e-tests.yml and uses two parallel go test processes.

Documentation

Index

Constants

View Source
const (
	BuilderServiceAccount = "builder"
)

Variables

This section is empty.

Functions

func Apply added in v0.20.0

func Apply(obj controllerclient.Object, changeFunc interface{}) func() error

func CSVHasPhase added in v0.21.0

func HaveMessage added in v0.20.0

func HaveMessage(goal string) gtypes.GomegaMatcher

func HavePhase added in v0.20.0

func K8sSafeCurrentTestDescription added in v0.21.0

func K8sSafeCurrentTestDescription() string

func Local added in v0.20.0

func Local(client operatorclient.ClientInterface) (bool, error)

Local determines whether test is running locally or in a container on openshift-CI. Queries for a clusterversion object specific to OpenShift.

func MaskNotFound added in v0.20.0

func MaskNotFound(err error) error

MaskNotFound "masks" an given error by returning nil when it refers to a "NotFound" API status response, otherwise returns the error unaltered.

func SetupGeneratedTestNamespace added in v0.20.0

func SetupGeneratedTestNamespace(name string, targetNamespaces ...string) corev1.Namespace

func SetupGeneratedTestNamespaceWithOperatorGroup added in v0.20.0

func SetupGeneratedTestNamespaceWithOperatorGroup(name string, og operatorsv1.OperatorGroup) corev1.Namespace

func TearDown added in v0.20.0

func TearDown(namespace string)

TearDown deletes all OLM resources in the corresponding namespace and at the cluster scope.

func TeardownNamespace added in v0.20.0

func TeardownNamespace(ns string)

Types

type FileBasedCatalogProvider added in v0.20.0

type FileBasedCatalogProvider interface {
	GetCatalog() string
}

func NewFileBasedFiledBasedCatalogProvider added in v0.20.0

func NewFileBasedFiledBasedCatalogProvider(path string) (FileBasedCatalogProvider, error)

func NewRawFileBasedCatalogProvider added in v0.26.0

func NewRawFileBasedCatalogProvider(data string) (FileBasedCatalogProvider, error)

type MagicCatalog added in v0.20.0

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

func NewMagicCatalog added in v0.20.0

func NewMagicCatalog(kubeClient k8scontrollerclient.Client, namespace string, catalogName string, provider FileBasedCatalogProvider) *MagicCatalog

NewMagicCatalog creates an object that can deploy an arbitrary file-based catalog given by the FileBasedCatalogProvider Keep in mind that there are limits to the configMaps. So, the catalogs need to be relatively simple

func NewMagicCatalogFromFile added in v0.22.0

func NewMagicCatalogFromFile(kubeClient k8scontrollerclient.Client, namespace string, catalogName string, fbcFilePath string) (*MagicCatalog, error)

func (*MagicCatalog) DeployCatalog added in v0.20.0

func (c *MagicCatalog) DeployCatalog(ctx context.Context) error

func (*MagicCatalog) GetName added in v0.22.0

func (c *MagicCatalog) GetName() string

func (*MagicCatalog) GetNamespace added in v0.22.0

func (c *MagicCatalog) GetNamespace() string

func (*MagicCatalog) UndeployCatalog added in v0.20.0

func (c *MagicCatalog) UndeployCatalog(ctx context.Context) []error

func (*MagicCatalog) UpdateCatalog added in v0.21.0

func (c *MagicCatalog) UpdateCatalog(ctx context.Context, provider FileBasedCatalogProvider) error

Directories

Path Synopsis
Package ctx provides information about the Kubernetes cluster under test, as well as optional functionality for provisioning (i.e., creating new clusters) and installing (i.e., deploying operators and supporting resources into clusters).
Package ctx provides information about the Kubernetes cluster under test, as well as optional functionality for provisioning (i.e., creating new clusters) and installing (i.e., deploying operators and supporting resources into clusters).
data

Jump to

Keyboard shortcuts

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