integration

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const GoogleAppCredentialsEnv = "GOOGLE_APPLICATION_CREDENTIALS"

GoogleAppCredentialsEnv is the environment variable expected to be populated with a path to a Service Account File for testing Application Default Credentials

View Source
const NoLongEnv = "SKIP_LONG_TESTS"

NoLongEnv must be set in the environment to enable skipping long running tests

View Source
const NoLongMsg = "environment variable %s filled, skipping long test"

NoLongMsg is the template used when BucketNoLongEnv's environment variable has not been populated.

View Source
const ServiceAccountFileEnv = "GOOGLE_SERVICE_ACCOUNT"

ServiceAccountFileEnv is the environment variable expected to be populated with a Service Account File for testing

View Source
const ServiceAccountFileMsg = "environment variable %s expected to contain a valid Service Account File but was empty"

ServiceAccountFileMsg is the template used when ServiceAccountFileEnv has not been populated

Variables

This section is empty.

Functions

func AsDefaultCredentials

func AsDefaultCredentials(ctx *AssertContext)

AsDefaultCredentials configures the AssertContext to authenticate using Application Default Credentials populated using the testing service account file.

func AsReadOnlyCredentials

func AsReadOnlyCredentials(ctx *AssertContext)

AsReadOnlyCredentials configures the AssertContext to be used soley for public, read-only operations.

func AsStaticCredentials

func AsStaticCredentials(ctx *AssertContext)

AsStaticCredentials configures the AssertContext to authenticate explicitly using a Service Account File

func AssertLifecycleWorks

func AssertLifecycleWorks(gcsCLIPath string, ctx AssertContext)

AssertLifecycleWorks tests the main blobstore object lifecycle from creation to deletion.

This is using gomega matchers, so it will fail if called outside an 'It' test.

func GenerateRandomString

func GenerateRandomString(params ...int) string

GenerateRandomString generates a random string of desired length (default: 25)

func MakeConfigFile

func MakeConfigFile(cfg *config.GCSCli) string

MakeConfigFile creates a config file from a GCSCli config struct

func MakeContentFile

func MakeContentFile(content string) string

MakeContentFile creates a temporary file with content to upload to GCS

func RunGCSCLI

func RunGCSCLI(gcsCLIPath, configPath, subcommand string,
	args ...string) (*gexec.Session, error)

RunGCSCLI run the gcscli and outputs the session after waiting for it to finish

Types

type AssertContext

type AssertContext struct {
	// Config is the configuration used to
	Config *config.GCSCli
	// ConfigPath is the path to the file containing the
	// serialized content of Config.
	ConfigPath string

	// GCSFileName is the name of whatever blob is generated in an
	// assertion. It is the assert's responsibility to remove the blob.
	GCSFileName string
	// ExpectedString is the generated content used in an assertion.
	ExpectedString string
	// ContentFile is the path of the file containing ExpectedString
	ContentFile string
	// contains filtered or unexported fields
}

AssertContext contains the generated content to be used within tests.

This allows Assertions to not have to worry about setup and teardown.

func NewAssertContext

func NewAssertContext(options ...AssertContextConfigOption) AssertContext

NewAssertContext returns an AssertContext with all fields which can be generated filled in.

func (*AssertContext) AddConfig

func (ctx *AssertContext) AddConfig(config *config.GCSCli)

AddConfig includes the config.GCSCli required for AssertContext

Configuration is typically not available immediately before a test can be run, hence the need to add it later.

func (*AssertContext) Cleanup

func (ctx *AssertContext) Cleanup()

Cleanup removes artifacts generated by the AssertContext.

func (*AssertContext) Clone

func (ctx *AssertContext) Clone(options ...AssertContextConfigOption) AssertContext

Clone returns a new AssertContext configured using the provided options. This overwrites the previous options of the context.

This is useful in assertions where initial setup must be done under one form of authentication and the actual assertion is done under another.

Note: The returned AssertContext is a distinct AssertContext, Cleanup must be called to remove testing files from the filesystem.

type AssertContextConfigOption

type AssertContextConfigOption func(ctx *AssertContext)

AssertContextConfigOption is an option used for configuring an AssertContext's handling of the config.

The behavior for an AssertContextAuthOption is applied when config is added

Jump to

Keyboard shortcuts

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