helpers

package
v0.0.0-...-534e0d3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 RegisterExternalService

func RegisterExternalService(t *testing.T, consulClient *api.Client, namespace, name, address string, port int)

RegisterExternalService registers an external service to a virtual node in Consul for testing purposes. This function takes a testing.T object, a Consul client, service namespace, service name, address, and port as parameters. It registers the service with Consul, and if a namespace is provided, it also creates the namespace in Consul. It uses the provided testing.T object to log registration details and verify the registration process. If the registration fails, the test calling the function will fail.

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.

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
}

Jump to

Keyboard shortcuts

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