testutils

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnnotateNSDefaultAnnotations added in v1.1.1

func AnnotateNSDefaultAnnotations(ns string)

AnnotateNSDefaultAnnotations annotates a namespace with the default annotations.

func AnnotateNSSecondaryRoot

func AnnotateNSSecondaryRoot(ns string)

AnnotateNSSecondaryRoot annotates a namespace as secondary root.

func CleanupTestGroup

func CleanupTestGroup(groupName string)

CleanupTestGroups deletes a specific group

func CleanupTestMigrationHierarchies

func CleanupTestMigrationHierarchies(randPrefix string)

CleanupTestMigrationHierarchies finds the list of migrationhierarchies labeled as test migrationhierarchies and delegates to cleanupMigrationHierarchies function.

func CleanupTestNamespaces

func CleanupTestNamespaces(randPrefix string)

CleanupTestNamespaces finds the list of namespaces labeled as test namespaces and delegates to cleanupNamespaces function.

func CleanupTestUsers

func CleanupTestUsers(randPrefix string)

CleanupTestUsers finds the list of users labeled as test namespaces and delegates to cleanupUsers function

func ComplexFieldShouldContain

func ComplexFieldShouldContain(resource, ns, nm, field, want string)

func CreateGroup

func CreateGroup(g, u, randPrefix string)

CreateGroup creates the specified Group.

func CreateMigrationHierarchy

func CreateMigrationHierarchy(currentns, tons string, user string) string

CreateMigrationHierarchy creates the specified MigrationHierarchy.

func CreatePod

func CreatePod(ns, name, randPrefix, cpu, memory string)

CreatePod creates a pod in the specified namespace with the required cpu and memory(Gi).

func CreateResourceQuota

func CreateResourceQuota(nm, nsnm string, args ...string)

CreateResourceQuota creates/updates a ResourceQuota object in a given namespace and with the given resources.

func CreateRootNS

func CreateRootNS(nm, randPrefix string, rqDepth int)

CreateRootNS creates/updates a root name with a given name and with the required labels.

func CreateSubnamespace

func CreateSubnamespace(nm, nsnm, randPrefix string, isRp bool, args ...string)

CreateSubnamespace creates/updates the specified Subnamespace in the parent namespace with canned testing labels making it easier to look up and delete later, and with the given resources.

func CreateSubnamespaceWithScope

func CreateSubnamespaceWithScope(nm, nsnm, randPrefix string, isRp bool, operatorValue string, args ...string)

CreateSubnamespaceWithScope creates/updates the specified Subnamespace in the parent namespace with canned testing labels making it easier to look up and delete later, and with the given resources.

func CreateUpdateQuota

func CreateUpdateQuota(nm, nsnm, dsnm, user string, args ...string)

CreateUpdateQuota creates the specified UpdateQuota in the parent namespace with canned testing labels making it easier to look up and delete later, and with the given resources.

func CreateUser

func CreateUser(u, randPrefix string)

CreateUser creates the specified User.

func FieldShouldContain

func FieldShouldContain(resource, ns, nm, field, want string)

func FieldShouldNotContain

func FieldShouldNotContain(resource, ns, nm, field, want string)

func GenerateE2EGroupName

func GenerateE2EGroupName(nm string) string

func GenerateE2EName

func GenerateE2EName(nm, testPrefix, randPrefix string) string

GenerateE2EName generates a name for a namespace and subnamespace.

func GenerateE2EUserName

func GenerateE2EUserName(nm string) string

GenerateE2EUserName generates a name for a namespace and subnamespace.

func GrantTestingUserAdmin

func GrantTestingUserAdmin(user, ns string)

GrantTestingUserAdmin gives admin rolebinding to a user on a namnamespace.

func GrantTestingUserClusterAdmin

func GrantTestingUserClusterAdmin(user string)

GrantTestingUserClusterAdmin gives cluster-admin cluster-rolebinding to a user.

func LabelNSDefaultLabels added in v1.1.1

func LabelNSDefaultLabels(ns string)

LabelNSDefaultLabels labels a namespace with the default labels.

func LabelTestingMigrationHierarchies

func LabelTestingMigrationHierarchies(mh, randPrefix string)

LabelTestingMigrationHierarchies marks testing migrationhierarchies with a label for future search and lookup.

func LabelTestingNs

func LabelTestingNs(ns, randPrefix string)

LabelTestingNs marks testing namespaces with a label for future search and lookup.

func MustApplyYAML

func MustApplyYAML(s string)

func MustApplyYAMLAsUser

func MustApplyYAMLAsUser(s, u string)

func MustNotApplyYAML

func MustNotApplyYAML(s string)

func MustNotApplyYAMLAsUser

func MustNotApplyYAMLAsUser(s, u string)

func MustNotRun

func MustNotRun(cmdln ...string)

func MustRun

func MustRun(cmdln ...string)

func RandStr

func RandStr() string

RandStr generates a random string.

func RunCommand

func RunCommand(cmdln ...string) (string, error)

RunCommand passes all arguments to the OS to execute, and returns the combined stdout/stderr and error object. By default, each arg to this function may contain strings (e.g. "echo hello world"), in which case we split the strings on the spaces (so this would be equivalent to calling "echo", "hello", "world"). If you _actually_ need an OS argument with strings in it, pass it as an argument to this function surrounded by double quotes (e.g. "echo", "\"hello world\"" will be passed to the OS as two args, not three).

func RunShouldContain

func RunShouldContain(substr string, seconds float64, cmdln ...string)

func RunShouldNotContain

func RunShouldNotContain(substr string, seconds float64, cmdln ...string)

func ShouldNotCreateMigrationHierarchy

func ShouldNotCreateMigrationHierarchy(currentns, tons string)

ShouldNotCreateMigrationHierarchy should not be able to create the specified MigrationHierarchy.

func ShouldNotCreateSubnamespace

func ShouldNotCreateSubnamespace(nm, nsnm string, isRp bool, args ...string)

ShouldNotCreateSubnamespace should not be able to create the specified Subnamespace in the parent namespace and with the given resources.

func ShouldNotCreateUpdateQuota

func ShouldNotCreateUpdateQuota(nm, nsnm, dsnm, user string, args ...string)

ShouldNotCreateUpdateQuota should not be able to create the specified UpdateQuota in the parent namespace and with the given resources.

func ShouldNotUpdateSubnamespace

func ShouldNotUpdateSubnamespace(nm, nsnm string, isRp bool, args ...string)

ShouldNotUpdateSubnamespace should not be able to create the specified Subnamespace in the parent namespace and with the given resources.

func TryRun

func TryRun(cmdln ...string) error

func TryRunQuietly

func TryRunQuietly(cmdln ...string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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