Documentation ¶
Overview ¶
Package utils contains commonly useful functions from Deis testing.
Index ¶
- Variables
- func AppsDestroyTest(t *testing.T, params *DeisTestConfig)
- func AuthPasswd(t *testing.T, params *DeisTestConfig, password string)
- 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 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 = "deis "
Deis points to the CLI used to run tests.
Functions ¶
func AppsDestroyTest ¶
func AppsDestroyTest(t *testing.T, params *DeisTestConfig)
AppsDestroyTest destroys a Deis app and checks that it was successful.
func AuthPasswd ¶
func AuthPasswd(t *testing.T, params *DeisTestConfig, password string)
AuthPasswd tests whether `deis auth:passwd` updates a user's password.
func BuildTag ¶
func BuildTag() string
BuildTag returns the $BUILD_TAG environment variable or `git rev-parse` output.
func CheckList ¶
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 ¶
func CurlApp(t *testing.T, cfg DeisTestConfig)
CurlApp is a convenience function to see if the example app is running.
func CurlWithFail ¶
CurlWithFail connects to a Deis endpoint to see if the example app is running.
func Execute ¶
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 ¶
func GetRandomApp() string
GetRandomApp returns a known working example app at random for testing.
func HostAddress ¶
func HostAddress() string
HostAddress returns the host IP for accessing etcd and Deis services.
func Hostname ¶
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 ¶
func ImagePrefix() string
ImagePrefix returns the $IMAGE_PREFIX environment variable or `deis/`
func NewID ¶
func NewID() string
NewID returns the first part of a random RFC 4122 UUID See http://play.golang.org/p/4FkNSiUDMg
func RandomPort ¶
func RandomPort() string
RandomPort returns an unused TCP listen port on the host.
Types ¶
type DeisTestConfig ¶
type DeisTestConfig struct { AuthKey string Hosts string Domain string SSHKey string ClusterName string UserName string Password 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 ¶
func GetGlobalConfig() *DeisTestConfig
GetGlobalConfig returns a test configuration object.