utils

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package utils contains commonly useful functions from Deis testing.

Index

Constants

This section is empty.

Variables

View Source
var Deis = os.Getenv("DEIS_BINARY") + " "

Deis points to the CLI used to run tests.

Functions

func AppsDestroyTest added in v0.11.0

func AppsDestroyTest(t *testing.T, params *DeisTestConfig)

AppsDestroyTest destroys a Deis app and checks that it was successful.

func BuildTag added in v0.12.0

func BuildTag() string

BuildTag returns the $BUILD_TAG environment variable or `git rev-parse` output.

func Chdir

func Chdir(app string) error

Chdir sets the current working directory to the relative path specified.

func CheckList added in v0.11.0

func CheckList(
	t *testing.T, cmd string, params interface{}, contain string, notflag bool)

CheckList executes a command and optionally tests whether its output does or does not contain a given string.

func CreateFile

func CreateFile(path string) error

CreateFile creates an empty file at the specified path.

func Curl added in v0.11.0

func Curl(t *testing.T, url string)

Curl connects to an endpoint to see if the endpoint is responding.

func CurlApp added in v1.5.0

func CurlApp(t *testing.T, cfg DeisTestConfig)

CurlApp is a convenience function to see if the example app is running.

func CurlWithFail added in v1.1.0

func CurlWithFail(t *testing.T, url string, failFlag bool, expect string)

CurlWithFail connects to a Deis endpoint to see if the example app is running.

func Execute added in v0.11.0

func Execute(t *testing.T, cmd string, params interface{}, failFlag bool, expect string)

Execute takes command string and parameters required to execute the command, a failflag to check whether the command is expected to fail, and an expect string to check whether the command has failed according to failflag.

If failflag is true and the command failed, check the stdout and stderr for the expect string.

func GetRandomApp added in v0.11.0

func GetRandomApp() string

GetRandomApp returns a known working example app at random for testing.

func HTTPClient added in v1.9.0

func HTTPClient() *http.Client

HTTPClient returns a client for use with the integration tests.

func HostAddress added in v0.12.0

func HostAddress() string

HostAddress returns the host IP for accessing etcd and Deis services.

func Hostname added in v0.13.0

func Hostname() string

Hostname returns the hostname of the machine running the container, *not* the local machine We infer the hostname because we don't necessarily know how to log in.

func ImagePrefix added in v1.5.0

func ImagePrefix() string

ImagePrefix returns the $IMAGE_PREFIX environment variable or `deis/`

func NewID added in v0.11.0

func NewID() string

NewID returns the first part of a random RFC 4122 UUID See http://play.golang.org/p/4FkNSiUDMg

func RandomPort added in v0.12.0

func RandomPort() string

RandomPort returns an unused TCP listen port on the host.

func Rmdir

func Rmdir(app string) error

Rmdir removes a directory and its contents.

func RunCommandWithStdoutStderr

func RunCommandWithStdoutStderr(cmd *exec.Cmd) (bytes.Buffer, bytes.Buffer, error)

RunCommandWithStdoutStderr execs a command and returns its output.

Types

type DeisTestConfig added in v0.11.0

type DeisTestConfig struct {
	AuthKey            string
	Hosts              string
	Domain             string
	SSHKey             string
	ClusterName        string
	UserName           string
	Password           string
	NewPassword        string
	NewOwner           string
	Email              string
	ExampleApp         string
	AppDomain          string
	AppName            string
	ProcessNum         string
	ImageID            string
	Version            string
	AppUser            string
	SSLCertificatePath string
	SSLKeyPath         string
}

DeisTestConfig allows tests to be repeated against different targets, with different example apps, using specific credentials, and so on.

func GetGlobalConfig added in v0.11.0

func GetGlobalConfig() *DeisTestConfig

GetGlobalConfig returns a test configuration object.

Jump to

Keyboard shortcuts

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