framework

package
v0.0.0-...-200b26a Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUsername = "username@ibm.com"
	DefaultPassword = "password"
)
View Source
const (
	JwtConfigTemplate  = templatesDir + "/jwtconfig.yaml"
	OidcConfigTemplate = templatesDir + "/oidcconfig.yaml"
	PolicyTemplate     = templatesDir + "/policy.yaml"
)

Variables

This section is empty.

Functions

func RandString

func RandString(n int) string

Types

type AppIDManager

type AppIDManager struct {
	ClientID       string
	ClientSecret   string
	OAuthServerURL string
	Tokens         *authserver.TokenResponse
	// contains filtered or unexported fields
}

AppIDManager models the authorization server

func NewAppIDManager

func NewAppIDManager() *AppIDManager

NewAppIDManager creates a new manager from environment variables

func (*AppIDManager) DiscoveryURL

func (m *AppIDManager) DiscoveryURL() string

DiscoveryURL returns the well known URL of the AppIDManager

func (*AppIDManager) LoginToCloudDirectory

func (m *AppIDManager) LoginToCloudDirectory(t *testing.T, root string, path string, output interface{}) error

LoginToCloudDirectory logs in through an App ID cloud directory login widget returning the result from the login page

func (*AppIDManager) OK

func (m *AppIDManager) OK() bool

OK validates an AppIDManager

func (*AppIDManager) PublicKeysURL

func (m *AppIDManager) PublicKeysURL() string

PublicKeysURL returns the public keys URL of the AppIDManager

func (*AppIDManager) ROP

func (m *AppIDManager) ROP(username string, password string) error

ROP issues an ROP token flow again the authorization server instance

func (*AppIDManager) TokenURL

func (m *AppIDManager) TokenURL() string

TokenURL returns the token URL of the AppIDManager

type CRD

type CRD interface {
	GetName() string
	GetNamespace() string
}

CRD models a Kubernetes CRD exposing name and namespace

type CRDManager

type CRDManager struct {
	// contains filtered or unexported fields
}

CRD Manager maintains Kubernetes CRDs locally and provides helper methods create/update/delete them

func (*CRDManager) AddCRD

func (m *CRDManager) AddCRD(pathToTemplate string, data CRD) error

AddCRD adds a custom resource definition from a given file

func (*CRDManager) CleanUp

func (m *CRDManager) CleanUp() error

CleanUp delete stored CRDs from Kubernetes then purges the local store

func (*CRDManager) DeleteCRD

func (m *CRDManager) DeleteCRD(savedCRD CRD) error

DeleteCRD deletes a custom resource definition using a given CRD

type Context

type Context struct {
	CRDManager    *CRDManager
	AppIDManager  *AppIDManager
	Env           *Env
	SessionCookie *http.Cookie
	// contains filtered or unexported fields
}

Context models the test environment

func NewContext

func NewContext(testID string) *Context

NewContext creates a new test suite context

func (*Context) EnableRedirects

func (c *Context) EnableRedirects()

EnableRedirects configures the default client to follow HTTP redirects

func (*Context) SendRequest

func (c *Context) SendRequest(method string, path string, headers map[string]string) (*http.Response, error)

SendRequest issues a new http request with an authorization header

func (*Context) StopHttpRedirects

func (c *Context) StopHttpRedirects()

StopHttpRedirects configures the default client to ignore HTTP redirects

type Env

type Env struct {
	ClusterRoot string
	KubeConfig  string
}

Env models the kubernetes environment

func NewEnv

func NewEnv() *Env

NewEnv returns a new ENV instance

type ModifierFn

type ModifierFn func(ctx *Context) error

type Suite

type Suite struct {
	// contains filtered or unexported fields
}

Suite allows the test author to specify suite-related metadata and do setup in a fluent-style, before commencing execution.

func NewSuite

func NewSuite(testID string, m *testing.M) *Suite

NewSuite returns a new suite instance.

func (*Suite) Cleanup

func (s *Suite) Cleanup(fn ModifierFn) *Suite

Cleanup runs enqueues the given cleanup function to run after test execution.

func (*Suite) Run

func (s *Suite) Run()

Run the suite. This method calls os.Exit and does not return.

func (*Suite) Setup

func (s *Suite) Setup(fn ModifierFn) *Suite

Setup runs enqueues the given setup function to run before test execution.

type Test

type Test struct {
	// contains filtered or unexported fields
}

func NewTest

func NewTest(t *testing.T) *Test

func (*Test) Run

func (t *Test) Run(fn func(ctx *Context))

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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