testutils

package
v0.0.0-...-beef95b Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func NewCFN

NewCFN will return a mock CloudFormation client to test with

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type AWS

type AWS struct {
	Config bool
	// contains filtered or unexported fields
}

AWS wraps all the test mocking for the AWS Client

func NewAWS

func NewAWS() *AWS

NewAWS will initialize a mocked AWS Client

func (*AWS) Configure

func (a *AWS) Configure(*selfv1alpha1.ConfigAWS) error

Configure will setup the mocking client using the self.Config Custom Resource

func (*AWS) Configured

func (a *AWS) Configured() error

Configured will return nil to simulate a configured client

func (*AWS) GetClient

func (a *AWS) GetClient(region string) cloudformationiface.CloudFormationAPI

GetClient will return a single AWS CloudFormation Client for us-west-2

func (*AWS) GetClients

func (a *AWS) GetClients() map[string]cloudformationiface.CloudFormationAPI

GetClients will return slice with a single AWS CloudFormation Client for us-west-2

func (*AWS) GetDefaultRegion

func (a *AWS) GetDefaultRegion() string

GetDefaultRegion will return the base region to deploy into

func (*AWS) GetNotificationARN

func (a *AWS) GetNotificationARN() string

GetNotificationARN will return the SQS CloudFormation ARN

func (*AWS) GetSession

func (a *AWS) GetSession(region string) *session.Session

GetSession will return a session for a region

func (*AWS) GetSessions

func (a *AWS) GetSessions() map[string]*session.Session

GetSessions will return all sessions

func (*AWS) SetClient

func (a *AWS) SetClient(region string, iface cloudformationiface.CloudFormationAPI) bool

SetClient will add a new AWS Region client so that the controller can span more regions

func (*AWS) SetSession

func (a *AWS) SetSession(region string, sess *session.Session) bool

SetSession will set a session by region

type Token

type Token struct {
	Token string
}

Token is a mocked token client

func NewToken

func NewToken() Token

NewToken returns a token with a stubbed value

func (Token) Generate

func (t Token) Generate() string

Generate returns the base stubbed value

Jump to

Keyboard shortcuts

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