Documentation ¶
Index ¶
- func AddCustomNamespaceToContexts(namespaceSuffix, kubeconfig string, targetedOspreys []*TestOsprey) error
- func Client(args ...string) clitest.TestCommand
- func Login(args ...string) clitest.LoginCommand
- func OspreyTargetOutput(environment string) string
- func OspreyconfigAliasName(environment string) string
- func OspreyconfigTargetName(environment string) string
- func SaveConfig(config interface{}, path string) error
- func Stop(server *TestOsprey) error
- func WithoutToken(authInfo *clientgo.AuthInfo) *clientgo.AuthInfo
- type TestConfig
- func BuildCADataConfig(testDir, providerName string, servers []*TestOsprey, caData bool, ...) (*TestConfig, error)
- func BuildConfig(testDir, providerName, defaultGroup string, targetGroups map[string][]string, ...) (*TestConfig, error)
- func BuildFullConfig(testDir, providerName, defaultGroup string, targetGroups map[string][]string, ...) (*TestConfig, error)
- type TestOsprey
- func (o *TestOsprey) CallHealthcheck() (*http.Response, error)
- func (o *TestOsprey) CustomAliasNamespace(suffix string) string
- func (o *TestOsprey) CustomTargetNamespace(suffix string) string
- func (o *TestOsprey) OspreyconfigAliasName() string
- func (o *TestOsprey) OspreyconfigTargetName() string
- func (o *TestOsprey) ToGroupClaims(authInfo *clientgo.AuthInfo) ([]string, error)
- func (o *TestOsprey) ToKubeconfigCluster(locationOfOrigin string) *clientgo.Cluster
- func (o *TestOsprey) ToKubeconfigContext(locationOfOrigin string) *clientgo.Context
- func (o *TestOsprey) ToKubeconfigUserWithoutToken(locationOfOrigin string) *clientgo.AuthInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCustomNamespaceToContexts ¶
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 ¶
func Login(args ...string) clitest.LoginCommand
Login returns a LoginCommand for the osprey binary with the provided args arguments.
func OspreyTargetOutput ¶
OspreyTargetOutput returns the name and aliases output format for the environment.
func OspreyconfigAliasName ¶
OspreyconfigAliasName returns the ospreyconfig target's alias for the environment.
func OspreyconfigTargetName ¶
OspreyconfigTargetName returns the ospreyconfig target's name for the environment.
func SaveConfig ¶ added in v2.12.0
SaveConfig writes the osprey config to the specified path.
func Stop ¶
func Stop(server *TestOsprey) error
Stop stops the TestOsprey server. Returns an error if any happened.
Types ¶
type TestConfig ¶
type TestConfig struct { *client.Config LegacyConfig *client.ConfigV1 ConfigFile string LegacyConfigFile string }
TestConfig represents an Osprey client configuration file used for testing.
func BuildCADataConfig ¶
func BuildCADataConfig(testDir, providerName string, servers []*TestOsprey, caData bool, caPath, clientID, apiServerURL string, useGKEClientConfig bool) (*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, providerName, defaultGroup string, targetGroups map[string][]string, servers []*TestOsprey, clientID, apiServerURL string, useGKEClientConfig bool) (*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 ¶
func BuildFullConfig(testDir, providerName, defaultGroup string, targetGroups map[string][]string, servers []*TestOsprey, caData bool, caPath, clientID, apiServerURL string, useGKEClientConfig bool) (*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 ¶
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 Start ¶
Start creates one Osprey test server for the dex Server. Its directory will be testDir/dex.Environment
func StartOspreys ¶
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 ¶
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 ¶
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 ¶
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.