Documentation ¶
Overview ¶
Package utils contains commonly useful functions from Deis testing.
Index ¶
- Variables
- func AppsDestroyTest(t *testing.T, params *DeisTestConfig)
- func BuildTag() string
- func Chdir(app string) error
- func CheckList(t *testing.T, cmd string, params interface{}, contain string, notflag bool)
- func CreateFile(path string) error
- func Curl(t *testing.T, url string)
- func CurlApp(t *testing.T, cfg DeisTestConfig)
- func CurlWithFail(t *testing.T, url string, failFlag bool, expect string)
- func Execute(t *testing.T, cmd string, params interface{}, failFlag bool, expect string)
- func GetRandomApp() string
- func HTTPClient() *http.Client
- func HostAddress() string
- func Hostname() string
- func ImagePrefix() string
- func NewID() string
- func RandomPort() string
- func Rmdir(app string) error
- func RunCommandWithStdoutStderr(cmd *exec.Cmd) (bytes.Buffer, bytes.Buffer, error)
- type DeisTestConfig
Constants ¶
This section is empty.
Variables ¶
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 CheckList ¶ added in v0.11.0
CheckList executes a command and optionally tests whether its output does or does not contain a given string.
func CreateFile ¶
CreateFile creates an empty file at the specified path.
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
CurlWithFail connects to a Deis endpoint to see if the example app is running.
func Execute ¶ added in v0.11.0
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
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.
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.