Documentation ¶
Index ¶
- func CaptureStdOut() func() string
- func CaptureUserOut() func() string
- func Chdir(path string) func()
- func CleanupDir(dir string)
- func ClearDockerEnv()
- func ContainerCheck(checkName string, checkState string) (bool, error)
- func CreateTmpDir(prefix string) string
- func GetCachedArchive(siteName string, prefixString string, internalExtractionPath string, ...) (string, string, error)
- func OsTempDir() (string, error)
- func TimeTrack(start time.Time, name string) func()
- type TestSite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaptureStdOut ¶
func CaptureStdOut() func() string
CaptureStdOut captures Stdout to a string. Capturing starts when it is called. It returns an anonymous function that when called, will return a string containing the output during capture, and revert once again to the original value of os.StdOut.
func CaptureUserOut ¶ added in v0.9.4
func CaptureUserOut() func() string
CaptureUserOut captures output written to UserOut to a string. Capturing starts when it is called. It returns an anonymous function that when called, will return a string containing the output during capture, and revert once again to the original value of os.StdOut.
func Chdir ¶
func Chdir(path string) func()
Chdir will change to the directory for the site specified by TestSite. It returns an anonymous function which will return to the original working directory when called.
func ClearDockerEnv ¶
func ClearDockerEnv()
ClearDockerEnv unsets env vars set in platform DockerEnv() so that they can be set by another test run.
func ContainerCheck ¶
ContainerCheck determines if a given container name exists and matches a given state
func CreateTmpDir ¶
CreateTmpDir creates a temporary directory and returns its path as a string.
func GetCachedArchive ¶
func GetCachedArchive(siteName string, prefixString string, internalExtractionPath string, sourceURL string) (string, string, error)
GetCachedArchive returns a directory populated with the contents of the specified archive, either from cache or from downloading and creating cache. siteName is the site.Name used for storage prefixString is the prefix used to disambiguate downloads and extracts internalExtractionPath is the place in the archive to start extracting sourceURL is the actual URL to download. Returns the extracted path, the tarball path (both possibly cached), and an error value.
func OsTempDir ¶
OsTempDir gets os.TempDir() (usually provided by $TMPDIR) but expands any symlinks found within it. This wrapper function can prevent problems with docker-for-mac trying to use /var/..., which is not typically shared/mounted. It will be expanded via the /var symlink to /private/var/...
Types ¶
type TestSite ¶
type TestSite struct { // Name is the generic name of the site, and is used as the default dir. Name string // SourceURL is the URL of the source code tarball to be used for building the site. SourceURL string // ArchiveExtractionPath is the relative path within the tarball which should be extracted, ending with / ArchiveInternalExtractionPath string // FullSiteTarballURL is the URL of the tarball of a full site archive used for testing import. FullSiteTarballURL string // FilesTarballURL is the URL of the tarball of file uploads used for testing file import. FilesTarballURL string // FilesZipballURL is the URL of the zipball of file uploads used for testing file import. FilesZipballURL string // DBTarURL is the URL of the database dump tarball used for testing database import. DBTarURL string // DBZipURL is the URL of an optional zip-style db dump. DBZipURL string // Dir is the rooted full path of the test site Dir string // HTTPProbeURI is the URI that can be probed to look for a working web container HTTPProbeURI string // Docroot is the subdirectory witin the site that is the root/index.php Docroot string // Type is the type of application. This can be specified when a config file is not present // for a test site. Type string }
TestSite describes a site for testing, with name, URL of tarball, and optional dir.
func (*TestSite) Chdir ¶
func (site *TestSite) Chdir() func()
Chdir will change to the directory for the site specified by TestSite.