test

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertFileContainsMatch

func AssertFileContainsMatch(t *testing.T, zipFilename, fileInZip, regex string)

func AssertRemoteFileDoesNotExist

func AssertRemoteFileDoesNotExist(t *testing.T, credentials sftp.SSHCredentials, directory, regex string)

func AssertZipContainsFiles

func AssertZipContainsFiles(t *testing.T, filename string, files []string)

func DefaultContainerRequest

func DefaultContainerRequest(dockerContext, mysqlPass, mysqlDb string) testcontainers.ContainerRequest

Convenience function to create the most common container request.

func InstallWP

func InstallWP(t *testing.T, c *Container, siteUrl types.SiteUrl)

InstallWP uses wp-cli to install wordpress in the running container. It is a helper function that most tests will need to use in order to get a working wordpress installation.

func StartComposeContainers

func StartComposeContainers(t *testing.T, req ComposeRequest) map[string]*Container

StartComposeContainers uses testcontainers to start a containers from a compose file. It handles wrapping the containers in our own Container struct as well as cleaning up the containers when the test is finished. The individual containers are returned in a map keyed by their service name.

Types

type ComposeRequest

type ComposeRequest struct {
	PathToComposeFile string
	Services          []ComposeService
}

ComposeRequest contains the information needed to start a compose container.

func DefaultComposeRequest

func DefaultComposeRequest(pathToComposeFile string) ComposeRequest

Convenience function to create the most common compose request.

type ComposeService

type ComposeService struct {
	Name           string
	WaitStrategies []wait.Strategy
}

ComposeService are the individual services in a compose container.

type Container

type Container struct {
	// contains filtered or unexported fields
}

A Container is our wrapper around a testcontainers.Container

func StartContainer

func StartContainer(t *testing.T, req testcontainers.ContainerRequest) *Container

StartContainer uses testcontainers to start a container. It handles wrapping the container in our own Container struct as well as cleaning up the container when the test is finished.

func (*Container) MappedPort

func (c *Container) MappedPort(port nat.Port) string

MappedPort returns the mapped port for the exposed port from the container.

Jump to

Keyboard shortcuts

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