ospreytest

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2018 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCustomNamespaceToContexts added in v1.2.0

func AddCustomNamespaceToContexts(namespaceSuffix, kubeconfig string, targetedOspreys []*TestOsprey) error

AddCustomNamespaceToContexts adds a namespace to each context in the kubeconfig file the name of the namespace will be

func Client

func Client(args ...string) clitest.TestCommand

Client returns a TestCommand for the osprey binary with the provided args arguments.

func Login added in v1.2.0

func Login(args ...string) clitest.LoginCommand

Login returns a LoginCommand for the osprey binary with the provided args arguments.

func OspreyTargetOutput added in v1.2.0

func OspreyTargetOutput(environment string) string

OspreyTargetOutput returns the name and aliases output format for the environment.

func OspreyconfigAliasName added in v1.2.0

func OspreyconfigAliasName(environment string) string

OspreyconfigAliasName returns the ospreyconfig target's alias for the environment.

func OspreyconfigTargetName added in v1.2.0

func OspreyconfigTargetName(environment string) string

OspreyconfigTargetName returns the ospreyconfig target's name for the environment.

func StopOsprey

func StopOsprey(server *TestOsprey) error

StopOsprey stops the TestOsprey server. Returns an error if any happened.

func WithoutToken

func WithoutToken(authInfo *clientgo.AuthInfo) *clientgo.AuthInfo

WithoutToken creates a DeepCopy() of authInfo without an id-token.

Types

type TestConfig

type TestConfig struct {
	*ospreyClient.Config
	ConfigFile string
}

TestConfig represents an Osprey client configuration file used for testing.

func BuildCADataConfig added in v1.1.0

func BuildCADataConfig(testDir string, servers []*TestOsprey, caData bool, caPath string) (*TestConfig, error)

BuildCADataConfig creates an ospreyconfig file with as many targets as servers are provided. It uses testDir as the home for the .kube and .osprey folders. It also base64 encodes the CA data instead of using the file path.

func BuildConfig

func BuildConfig(testDir, defaultGroup string, targetGroups map[string][]string, servers []*TestOsprey) (*TestConfig, error)

BuildConfig creates an ospreyconfig file using the groups provided for the targets. It uses testDir as the home for the .kube and .osprey folders.

func BuildFullConfig added in v1.2.0

func BuildFullConfig(testDir, defaultGroup string, targetGroups map[string][]string, servers []*TestOsprey, caData bool, caPath string) (*TestConfig, error)

BuildFullConfig creates an ospreyconfig file with as many targets as servers are provided. The targets will contain the groups that have been specified. It uses testDir as the home for the .kube and .osprey folders. If caData is true, it base64 encodes the CA data instead of using the file path.

type TestOsprey

type TestOsprey struct {
	clitest.AsyncTestCommand
	Port         int32
	Environment  string
	APIServerURL string
	APIServerCA  string
	Secret       string
	URL          string
	IssuerURL    string
	IssuerPath   string
	IssuerCA     string
	KeyFile      string
	CertFile     string
	TestDir      string
}

TestOsprey represents an Osprey server instance used for testing.

func GetOspreysByGroup added in v1.2.0

func GetOspreysByGroup(group, defaultGroup string, environmentGroups map[string][]string, ospreys []*TestOsprey) []*TestOsprey

GetOspreysByGroup returns the ospreys matching by group or default group given the environmentGroups definition.

func StartOspreys

func StartOspreys(testDir string, dexes []*dextest.TestDex, portsFrom int32) ([]*TestOsprey, error)

StartOspreys creates one Osprey test server per TestDex provided, using ports starting from portsFrom. The Osprey directory will be testDir/dex.Environment.

func (*TestOsprey) CallHealthcheck added in v1.1.0

func (o *TestOsprey) CallHealthcheck() (*http.Response, error)

CallHealthcheck returns the current status of osprey's healthcheck as an http response and error

func (*TestOsprey) CustomAliasNamespace added in v1.2.0

func (o *TestOsprey) CustomAliasNamespace(suffix string) string

CustomAliasNamespace returns the name for a namespace appending the suffix to the osprey's alias name.

func (*TestOsprey) CustomTargetNamespace added in v1.2.0

func (o *TestOsprey) CustomTargetNamespace(suffix string) string

CustomTargetNamespace returns the name for a namespace appending the suffix to the osprey's target name.

func (*TestOsprey) OspreyconfigAliasName

func (o *TestOsprey) OspreyconfigAliasName() string

OspreyconfigAliasName returns the ospreyconfig target's alias for the TestOsprey instance.

func (*TestOsprey) OspreyconfigTargetName

func (o *TestOsprey) OspreyconfigTargetName() string

OspreyconfigTargetName returns the ospreyconfig target's name for the TestOsprey instance.

func (*TestOsprey) ToGroupClaims

func (o *TestOsprey) ToGroupClaims(authInfo *clientgo.AuthInfo) ([]string, error)

ToGroupClaims returns the groups contained in the groups claim of the id-token for the authInfo. If no tokens exists it returns an empty slice.

func (*TestOsprey) ToKubeconfigCluster

func (o *TestOsprey) ToKubeconfigCluster(locationOfOrigin string) *clientgo.Cluster

ToKubeconfigCluster returns a *Cluster representation of the TestOsprey instance.

func (*TestOsprey) ToKubeconfigContext

func (o *TestOsprey) ToKubeconfigContext(locationOfOrigin string) *clientgo.Context

ToKubeconfigContext returns a *Context representation of the TestOsprey instance.

func (*TestOsprey) ToKubeconfigUserWithoutToken

func (o *TestOsprey) ToKubeconfigUserWithoutToken(locationOfOrigin string) *clientgo.AuthInfo

ToKubeconfigUserWithoutToken returns an *AuthInfo representation, with an empty id-token, of the TestOsprey instance.

Jump to

Keyboard shortcuts

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