helper

package
v1.17.18 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateVariantValuesFile

func GenerateVariantValuesFile(variant string) (string, error)

func GetHttpEchoImage

func GetHttpEchoImage() string

Deprecated; if this is needed create a resource yaml for it.

func GetTestReleasedVersion

func GetTestReleasedVersion(ctx context.Context, repoName string) string

For nightly runs, we want to install a released version rather than using a locally built chart To do this, set the environment variable RELEASED_VERSION with either a version name or "LATEST" to get the last release

func GetUpgradeVersions

func GetUpgradeVersions(ctx context.Context, repoName string) (*versionutils.Version, *versionutils.Version, error)

GetUpgradeVersions returns two semantic versions of a repository:

  • prevLtsRelease: the latest patch release of v1.m-1.x
  • latestRelease: the latest patch release of v1.m.x

Originally intended for use in upgrade testing, it can return any of:

  • (prevLtsRelease, latestRelease, nil): all release versions computable
  • (prevLtsRelease, nil, nil): only prevLtsRelease computable (ie current branch has never been released)
  • (nil, nil, err): unable to fetch versions for upgrade test

Types

type Options

type Options struct {
	Command []string
	Verbose bool
}

type OptionsMutator

type OptionsMutator func(opts *Options)

func WithExtraArgs

func WithExtraArgs(args ...string) OptionsMutator

type SoloTestHelper

type SoloTestHelper struct {
	*TestConfig
	// The kubernetes helper
	*kubectl.Cli
}

func GetTestHelperForRootDir

func GetTestHelperForRootDir(ctx context.Context, rootDir, namespace string) (*SoloTestHelper, error)

func NewSoloTestHelper

func NewSoloTestHelper(configFunc TestConfigFunc) (*SoloTestHelper, error)

NewSoloTestHelper is meant to provide a standard way of deploying Gloo/GlooE to a k8s cluster during tests. It assumes that build and test assets are present in the `_output` and `_test` directories (these are configurable). Specifically, it expects the glooctl executable in the BuildAssetDir and a helm chart in TestAssetDir. It also assumes that a kubectl executable is on the PATH.

func (*SoloTestHelper) ChartPath

func (h *SoloTestHelper) ChartPath() string

Return the path to the chart used for installation

func (*SoloTestHelper) ChartVersion

func (h *SoloTestHelper) ChartVersion() string

Return the version of the Helm chart

func (*SoloTestHelper) CurrentGlooRevision

func (h *SoloTestHelper) CurrentGlooRevision() (int, error)

func (*SoloTestHelper) InstallGloo

func (h *SoloTestHelper) InstallGloo(ctx context.Context, timeout time.Duration, options ...OptionsMutator) error

InstallGloo calls glooctl to install Gloo. This is where image variants are handled as well.

func (*SoloTestHelper) RevertGlooUpgrade

func (h *SoloTestHelper) RevertGlooUpgrade(ctx context.Context, timeout time.Duration, options ...OptionsMutator) error

Rollback Gloo. The version can be passed via the ExtraArgs option. If not specified it rolls-back to the previous version Eg: RevertGlooUpgrade(ctx, timeout, WithExtraArgs([]string{revision}))

func (*SoloTestHelper) SetKubeCli

func (h *SoloTestHelper) SetKubeCli(cli *kubectl.Cli)

func (*SoloTestHelper) UninstallGloo

func (h *SoloTestHelper) UninstallGloo() error

does not pass the --all flag to glooctl uninstall

func (*SoloTestHelper) UninstallGlooAll

func (h *SoloTestHelper) UninstallGlooAll() error

passes the --all flag to glooctl uninstall

func (*SoloTestHelper) UpgradeGloo

func (h *SoloTestHelper) UpgradeGloo(ctx context.Context, timeout time.Duration, options ...OptionsMutator) (revertFunc func() error, err error)

Upgrades Gloo via a helm upgrade. It returns a method that rolls-back helm to the version prior to this upgrade

type TestConfig

type TestConfig struct {
	// All relative paths will assume this as the base directory. This is usually the project base directory.
	RootDir string
	// The directory holding the test assets. Must be relative to RootDir.
	TestAssetDir string
	// The directory holding the build assets. Must be relative to RootDir.
	BuildAssetDir string
	// Helm chart name
	HelmChartName string
	// Name of the helm index file name
	HelmRepoIndexFileName string
	// The namespace gloo (and the test server) will be installed to. If empty, will use the helm chart version.
	InstallNamespace string
	// Name of the glooctl executable
	GlooctlExecName string
	// If provided, the licence key to install the enterprise version of Gloo
	LicenseKey string
	// Install a released version of gloo. This is the value of the github tag that may have a leading 'v'
	ReleasedVersion string
	// If true, glooctl will be run with a -v flag
	Verbose bool
	// contains filtered or unexported fields
}

type TestConfigFunc

type TestConfigFunc func(defaults TestConfig) TestConfig

Function to provide/override test configuration. Default values will be passed in.

Jump to

Keyboard shortcuts

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