helpers

package
v0.0.0-...-19ab7e0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_PAUSE_PORT = "38501"

Variables

This section is empty.

Functions

func CheckExternalServiceConditions

func CheckExternalServiceConditions(t *testing.T, registrationName string, opts *k8s.KubectlOptions)

func CheckForPriorInstallations

func CheckForPriorInstallations(t *testing.T, client kubernetes.Interface, options *helm.Options, chartName, labelSelector string)

CheckForPriorInstallations checks if there is an existing Helm release for this Helm chart already installed. If there is, it fails the tests.

func Cleanup

func Cleanup(t testutil.TestingTB, noCleanupOnFailure bool, noCleanup bool, cleanup func())

Cleanup will both register a cleanup function with t and SetupInterruptHandler to make sure resources get cleaned up if an interrupt signal is caught.

func GetCRDRemoveFinalizers

func GetCRDRemoveFinalizers(t testutil.TestingTB, options *k8s.KubectlOptions)

getCRDRemoveFinalizers gets CRDs with finalizers and removes them.

func MergeMaps

func MergeMaps(a, b map[string]string)

MergeMaps will merge the values in b with values in a and save in a. If there are conflicts, the values in b will overwrite the values in a.

func RandomName

func RandomName() string

RandomName generates a random string with a 'test-' prefix.

func RegisterExternalServiceCRD

func RegisterExternalServiceCRD(t *testing.T, k8sOptions K8sOptions, consulOptions ConsulOptions)

func RunCommand

func RunCommand(t testutil.TestingTB, options *k8s.KubectlOptions, command Command) (string, error)

func SetupInterruptHandler

func SetupInterruptHandler(cleanup func())

SetupInterruptHandler sets up a goroutine that will wait for interrupt signals and call cleanup function when it catches it.

func VerifyFederation

func VerifyFederation(t *testing.T, primaryClient, secondaryClient *api.Client, releaseName string, secure bool)

VerifyFederation checks that the WAN federation between servers is successful by first checking members are alive from the perspective of both servers. If secure is true, it will also check that the ACL replication is running on the secondary server.

func WaitForInput

func WaitForInput(t *testing.T)

WaitForInput starts a http server on a random port (which is output in the logs) and waits until you issue a request to that endpoint to continue the tests. This is useful for debugging tests that require inspecting the current state of a running cluster and you don't need to use long sleeps.

Types

type CRD

type CRD struct {
	Items []struct {
		Metadata struct {
			Name       string   `json:"name"`
			Finalizers []string `json:"finalizers"`
		} `json:"metadata"`
	} `json:"items"`
}

CRD struct to parse CRD JSON output.

type Command

type Command struct {
	Command    string            // The command to run
	Args       []string          // The args to pass to the command
	WorkingDir string            // The working directory
	Env        map[string]string // Additional environment variables to set
	Logger     *terratestLogger.Logger
}

type ConsulOptions

type ConsulOptions struct {
	ConsulClient                    *api.Client
	Namespace                       string
	ExternalServiceNameRegistration string
}

type K8sOptions

type K8sOptions struct {
	Options             *k8s.KubectlOptions
	NoCleanupOnFailure  bool
	NoCleanup           bool
	KustomizeConfigPath string
}

Jump to

Keyboard shortcuts

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