utils

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: Apache-2.0 Imports: 13 Imported by: 7

Documentation

Overview

package utils contain miscellaneous utility functions that can be useful when writing tests or working with this test framework.

Index

Constants

View Source
const (
	// DeleteAnnotation is added to Organizations created during testing.
	// This is to ensure only those with this annotation can be deleted to avoid accidentally deleting a shared Org.
	DeleteAnnotation = "e2e-test-cleanup"
)

Variables

This section is empty.

Functions

func GenerateRandomName

func GenerateRandomName(prefix string) string

GenerateRandomName produces a random name made up of lower case letters and number, prefixed with the given string and seprated with a hyphen. The generated name is limited to 20 characters.

func GetBaseLabels

func GetBaseLabels() map[string]string

GetBaseLabels returns a map of labels based on specific available environment variables being found

func GetGitHubToken

func GetGitHubToken() string

GetGitHubToken returns a GitHub token (if found) from either: - The `GITHUB_TOKEN` env var value - The contents of the file defined by the `GITHUB_TOKEN_FILE` env var

func GetUpgradeReleasesToTest

func GetUpgradeReleasesToTest(provider string) (from string, to string, err error)

GetUpgradeReleasesToTest returns the 'from' and 'to' release versions that should be used for upgrade tests.

It checks the `E2E_RELEASE_VERSION` and `E2E_RELEASE_PRE_UPGRADE` environment variables. If `E2E_RELEASE_PRE_UPGRADE` is set to the value of `previous_major` it'll lookup the latest release for the previous major and return that as the 'from' release.

A `provider` must be provided so that the correct releases can be looked up from `giantswarm/releases`.

func SafeToDelete

func SafeToDelete(annotations map[string]string) bool

SafeToDelete checks if the provided annotations contains an annotation specific to E2E testing

func ShouldSkipUpgrade

func ShouldSkipUpgrade() bool

ShouldSkipUpgrade checks for the required environment variables needed to run the upgrade test suite

func StringToPointer

func StringToPointer(str string) *string

StringToPointer returns a pointer to the provided string

Types

type Release

type Release struct {
	Version string `json:"version"`
}

type ReleasesFile

type ReleasesFile struct {
	Releases []Release `json:"releases"`
}

Jump to

Keyboard shortcuts

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