utils

package
v0.0.0-...-8180c33 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Nginx holds the string literal "nginx"
	Nginx = "nginx"

	// NginxNs is the namespace in which the nginx controller is installed
	NginxNs = "ingress-nginx"

	// NginxController is the name of the nginx controller
	NginxController = "ingress-nginx-controller"
)

Variables

This section is empty.

Functions

func CheckProxyContainer

func CheckProxyContainer(deployName, namespace string) error

CheckProxyContainer gets the pods from a deployment, and checks if the proxy container is present

func Err

func Err(err error) string

Err returns err.Error() string if err is not nil This helper is meant to be used with gomega.Should() to annotate failures without causing runtime errors when returned errors are nil

func InstallLinkerdBinary

func InstallLinkerdBinary(linkerd, version string, force bool, verbose bool) error

InstallLinkerdBinary installs a linkerd2 binary of the given version

func InstallLinkerdControlPlane

func InstallLinkerdControlPlane(h *testutil.TestHelper, c *ConformanceTestOptions)

InstallLinkerdControlPlane runs the control plane install tests

func RunBeforeAndAfterEachSetup

func RunBeforeAndAfterEachSetup()

RunBeforeAndAfterEachSetup runs the control plane installation and uninstallation tests when a new control plane is required by each test

func RunCheck

func RunCheck(h *testutil.TestHelper, pre bool)

RunCheck rus `linkerd check`

func ShouldTestSkip

func ShouldTestSkip(skip bool, message string) bool

ShouldTestSkip is called within a Describe block to determine if a test must be skipped

func TestControlPlanePostInstall

func TestControlPlanePostInstall(h *testutil.TestHelper)

TestControlPlanePostInstall tests the control plane resources post installation

func TestEmojivotoApp

func TestEmojivotoApp()

TestEmojivotoApp installs and checks if emojivoto app is installed called of the function must have `testdata/emojivoto.yml`

func TestEmojivotoInject

func TestEmojivotoInject()

TestEmojivotoInject installs and checks if emojivoto app is installed called of the function must have `testdata/emojivoto.yml`

func TestEmojivotoUninstall

func TestEmojivotoUninstall()

TestEmojivotoUninstall tests if emojivoto can be successfull uninstalled

func UninstallLinkerdControlPlane

func UninstallLinkerdControlPlane(h *testutil.TestHelper)

UninstallLinkerdControlPlane runs the test for control plane uninstall

Types

type CheckOutput

type CheckOutput struct {
	Success    bool `json:"success"`
	Categories []struct {
		CategoryName string `json:"categoryName"`
		Checks       []struct {
			Result string `json:"result"`
			Error  string `json:"error"`
		}
	}
}

CheckOutput is used for unmarshalling the output from `linkerd check -o json`

type ConformanceTestOptions

type ConformanceTestOptions struct {
	LinkerdVersion    string `yaml:"linkerdVersion,omitempty"`
	LinkerdBinaryPath string `yaml:"linkerdBinaryPath,omitempty"`
	ClusterDomain     string `yaml:"clusterDomain,omitempty"`
	K8sContext        string `yaml:"k8sContext,omitempty"`
	ExternalIssuer    bool   `yaml:"externalIssuer,omitempty"`
	ControlPlane      `yaml:"controlPlane"`
	TestCase          `yaml:"testCase"`
}

ConformanceTestOptions holds the values fed from the test config file

func GetHelperAndConfig

func GetHelperAndConfig() (*testutil.TestHelper, *ConformanceTestOptions)

GetHelperAndConfig returns a reference to the initialized `testHelper` and `testConfig`

func (*ConformanceTestOptions) CleanEdges

func (options *ConformanceTestOptions) CleanEdges() bool

CleanEdges returns the value of `options.TestCase.Edges.Clean`

func (*ConformanceTestOptions) CleanInject

func (options *ConformanceTestOptions) CleanInject() bool

CleanInject determines if resources created during inject test must be removed

func (*ConformanceTestOptions) CleanRoutes

func (options *ConformanceTestOptions) CleanRoutes() bool

CleanRoutes checks if tap resources must be deleted

func (*ConformanceTestOptions) CleanStat

func (options *ConformanceTestOptions) CleanStat() bool

CleanStat checks if stat test resources must be deleted

func (*ConformanceTestOptions) CleanTap

func (options *ConformanceTestOptions) CleanTap() bool

CleanTap checks if tap resources must be deleted

func (*ConformanceTestOptions) GetAddOnsYAML

func (options *ConformanceTestOptions) GetAddOnsYAML() (out []byte, err error)

GetAddOnsYAML marshals the add-on config to a YAML and returns the byte slice and error

func (*ConformanceTestOptions) GetAddons

func (options *ConformanceTestOptions) GetAddons() map[string]interface{}

GetAddons returns the add-on config

func (*ConformanceTestOptions) GetIngressControllerConfig

func (options *ConformanceTestOptions) GetIngressControllerConfig() *[]IngressControllerConfig

GetIngressControllerConfig returns a slice of IngressControllerConfig

func (*ConformanceTestOptions) GetInstallFlags

func (options *ConformanceTestOptions) GetInstallFlags() []string

GetInstallFlags returns the flags set by the user for running `linkerd install`

func (*ConformanceTestOptions) GetLinkerdPath

func (options *ConformanceTestOptions) GetLinkerdPath() string

GetLinkerdPath returns the path where Linkerd binary will be installed

func (*ConformanceTestOptions) HA

func (options *ConformanceTestOptions) HA() bool

HA determines if a high-availability control-plane must be used

func (*ConformanceTestOptions) ShouldCleanIngressInstallation

func (options *ConformanceTestOptions) ShouldCleanIngressInstallation(t string) bool

ShouldCleanIngressInstallation checks if a particular ingress installation must be deleted post installation

func (*ConformanceTestOptions) ShouldTestIngressOfType

func (options *ConformanceTestOptions) ShouldTestIngressOfType(t string) bool

ShouldTestIngressOfType checks if a given type of ingress must be tested

func (*ConformanceTestOptions) SingleControlPlane

func (options *ConformanceTestOptions) SingleControlPlane() bool

SingleControlPlane determines if a singl CP must be used throughout

func (*ConformanceTestOptions) SkipEdges

func (options *ConformanceTestOptions) SkipEdges() bool

SkipEdges returns the value of options.TestCase.Edges.Skip

func (*ConformanceTestOptions) SkipIngress

func (options *ConformanceTestOptions) SkipIngress() bool

SkipIngress determines if ingress tests must be skipped

func (*ConformanceTestOptions) SkipInject

func (options *ConformanceTestOptions) SkipInject() bool

SkipInject determines if inject test must be skipped

func (*ConformanceTestOptions) SkipLifecycle

func (options *ConformanceTestOptions) SkipLifecycle() bool

SkipLifecycle determines if install tests must be skipped

func (*ConformanceTestOptions) SkipRoutes

func (options *ConformanceTestOptions) SkipRoutes() bool

SkipRoutes checks if tap tests should be skipped

func (*ConformanceTestOptions) SkipStat

func (options *ConformanceTestOptions) SkipStat() bool

SkipStat checks if `stat` test must be skipped

func (*ConformanceTestOptions) SkipTap

func (options *ConformanceTestOptions) SkipTap() bool

SkipTap checks if tap tests should be skipped

type ControlPlane

type ControlPlane struct {
	Namespace          string `yaml:"namespace,omitempty"`
	ControlPlaneConfig `yaml:"config,omitempty"`
}

ControlPlane wraps Namespace and ControlPlaneConfig

type ControlPlaneConfig

type ControlPlaneConfig struct {
	HA     bool                   `yaml:"ha,omitempty"`
	Flags  []string               `yaml:"flags,omitempty"`
	AddOns map[string]interface{} `yaml:"addOns,omitempty"`
}

ControlPlaneConfig holds the configuration for control plane installation

type Edges

type Edges struct {
	Skip  bool `yaml:"skip,omitempty"`
	Clean bool `yaml:"clean,omitempty"`
}

Edges holds the configuration for `linkerd edges` tests

type Ingress

type Ingress struct {
	Skip          bool `yaml:"skip,omitempty"`
	IngressConfig `yaml:"config,omitempty"`
}

Ingress holds the configuration for ingress test

type IngressConfig

type IngressConfig struct {
	Controllers []IngressControllerConfig `yaml:"controllers"`
}

IngressConfig holds the list of ingress controllers

type IngressControllerConfig

type IngressControllerConfig struct {
	Name  string `yaml:"name"`
	Clean bool   `yaml:"clean"`
}

IngressControllerConfig holds controller specific configuration

type Inject

type Inject struct {
	Skip  bool `yaml:"skip,omitempty"`
	Clean bool `yaml:"clean,omitempty"` // deletes all resources created while testing
}

Inject holds the inject test configuration

type Lifecycle

type Lifecycle struct {
	Skip               bool   `yaml:"skip,omitempty"`
	UpgradeFromVersion string `yaml:"upgradeFromVersion,omitempty"`
	Reinstall          bool   `yaml:"reinstall,omitempty"`
	Uninstall          bool   `yaml:"uninstall,omitempty"`
}

Lifecycle holds lifecycle test configuration

type Routes

type Routes struct {
	Skip  bool `yaml:"skip,omitempty"`
	Clean bool `yaml:"clean,omitempty"`
}

Routes holds the configuration for `routes` tests

type Stat

type Stat struct {
	Skip  bool `yaml:"skip,omitempty"`
	Clean bool `yaml:"clean,omitempty"`
}

Stat holds the configuration for stat test

type Tap

type Tap struct {
	Skip  bool `yaml:"skip,omitempty"`
	Clean bool `yaml:"clean,omitempty"`
}

type TestCase

type TestCase struct {
	Lifecycle `yaml:"lifecycle,omitempty"`
	Inject    `yaml:"inject"`
	Ingress   `yaml:"ingress"`
	Tap       `yaml:"tap"`
	Edges     `yaml:"edges"`
	Stat      `yaml:"stat"`
	Routes    `yaml:"routes"`
}

TestCase holds configuration of the various test cases

Jump to

Keyboard shortcuts

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