test

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultProject = "default"
	FakeJWTToken   = "" /* 335-byte string literal not displayed */
)

Variables

View Source
var (
	// TODO: would be nice to get this from "github.com/ninech/apis/apps/v1alpha1"
	AppSizeNotSet apps.ApplicationSize = ""
	AppMicro      apps.ApplicationSize = "micro"
	AppMini       apps.ApplicationSize = "mini"
	AppStandard1  apps.ApplicationSize = "standard-1"

	StatusSuperseded apps.ReleaseProcessStatus = "superseded"
	StatusAvailable  apps.ReleaseProcessStatus = "available"
)

Functions

func CloudVirtualMachine added in v1.5.0

func CloudVirtualMachine(name, namespace, location string, powerstate infrastructure.VirtualMachinePowerState) *infrastructure.CloudVirtualMachine

func CountLines

func CountLines(s string) int

func CreateTestKubeconfig

func CreateTestKubeconfig(client *api.Client, organization string) (string, error)

CreateTestKubeconfig creates a test kubeconfig which contains a nctl extension config with the given organization

func GenerateED25519PrivateKey added in v1.3.0

func GenerateED25519PrivateKey() (string, error)

GenerateED25519PrivateKey generates an ED25519 private key

func GenerateRSAPrivateKey added in v1.3.0

func GenerateRSAPrivateKey() (string, error)

GenerateRSAPrivateKey generates an RSA private key

func KeyValueStore added in v1.4.0

func KeyValueStore(name, project, location string) *storage.KeyValueStore

func MustParseTime

func MustParseTime(format string, value string) time.Time

func MySQL added in v1.4.0

func MySQL(name, project, location string) *storage.MySQL

func NewGitInformationService added in v1.3.0

func NewGitInformationService() *gitInformationService

NewGitInformationService returns a new git information service mock. It can be used to verify requests sent to it and also to just return with a previously set response.

func Postgres added in v1.6.0

func Postgres(name, project, location string) *storage.Postgres

func Projects

func Projects(organization string, names ...string) []client.Object

Projects returns projects with the given organization namespace set

func SetupClient

func SetupClient(opts ...ClientSetupOption) (*api.Client, error)

Types

type ClientSetupOption added in v1.7.6

type ClientSetupOption func(*clientSetup)

func WithDefaultProject added in v1.7.6

func WithDefaultProject(project string) ClientSetupOption

WithDefaultProject sets the default project of the client

func WithInterceptorFuncs added in v1.7.6

func WithInterceptorFuncs(f interceptor.Funcs) ClientSetupOption

func WithKubeconfig added in v1.7.6

func WithKubeconfig(t *testing.T) ClientSetupOption

WithKubeconfig creates a fake kubeconfig which gets removed once the passed test finished

func WithNameIndexFor added in v1.7.6

func WithNameIndexFor(obj runtime.Object) ClientSetupOption

WithNameIndexFor adds a name index to the fake client set for the passed object type

func WithObjects added in v1.7.6

func WithObjects(objects ...client.Object) ClientSetupOption

WithObjects sets the objects which can be returned from the client

func WithOrganization added in v1.7.6

func WithOrganization(org string) ClientSetupOption

WithOrganization sets the organization of the client

func WithProjects added in v1.7.6

func WithProjects(projects ...string) ClientSetupOption

WithProjects exclusively sets the projects which should be created

func WithProjectsFromResources added in v1.7.6

func WithProjectsFromResources(resources ...client.Object) ClientSetupOption

WithProjectsFromResources reads the namespaces of all given resources and adds them (unique) to the clientSetups project list. Use this on your own risk in combination with `WithProjects`. Make make sure that `WithProjects` is set before this function call in a functional options list. Otherwise you will overwrite the results from this function.

type GitInfoServiceParsed added in v1.3.0

type GitInfoServiceParsed struct {
	Token   string
	Method  string
	Request apps.GitExploreRequest
}

GitInfoServiceParsed represents are parsed request received by the git information service

type GitInformationServiceResponse added in v1.3.0

type GitInformationServiceResponse struct {
	// Code is the status code to be set
	Code int
	// Content describes the GitExploreResponse to be returned.
	Content apps.GitExploreResponse
	// Raw allows to return any text instead of a real GitExploreResponse.
	// If it is set, it has precedence over the Content field.
	Raw *string
}

GitInformationServiceResponse describes a response of the git information service

type VerifyRequestFunc added in v1.3.0

type VerifyRequestFunc func(p GitInfoServiceParsed, err error)

VerifyRequestFunc can be used to verify the parsed request which was sent to the git information service

Jump to

Keyboard shortcuts

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