Documentation ¶
Index ¶
- Constants
- type AssertAndCommander
- type CommandFactorier
- type Commander
- type DockerComposeStack
- func (s *DockerComposeStack) Down() error
- func (s *DockerComposeStack) DownAndUp() error
- func (c *DockerComposeStack) Execute(cmd Commander) error
- func (c *DockerComposeStack) ExecuteAndCompare(cmd AssertAndCommander, expectedResult string) error
- func (s *DockerComposeStack) Options(opts ...DockerComposeStackOptionsFunc)
- func (s *DockerComposeStack) Up() error
- type DockerComposeStackOptionsFunc
- func WithDownCommand(cmd Commander) DockerComposeStackOptionsFunc
- func WithStackPostDownCommand(cmd ...Commander) DockerComposeStackOptionsFunc
- func WithStackPostUpCommand(cmd ...Commander) DockerComposeStackOptionsFunc
- func WithStackPreDownCommand(cmd ...Commander) DockerComposeStackOptionsFunc
- func WithStackPreUpCommand(cmd ...Commander) DockerComposeStackOptionsFunc
- func WithUpCommand(cmd Commander) DockerComposeStackOptionsFunc
- type DockerComposeTerratestCommand
- func (c *DockerComposeTerratestCommand) AssertExectedResult(expected, result string)
- func (c *DockerComposeTerratestCommand) Execute() (string, error)
- func (c *DockerComposeTerratestCommand) WithCommand(cmd string) *DockerComposeTerratestCommand
- func (c *DockerComposeTerratestCommand) WithCommandArgs(args string) *DockerComposeTerratestCommand
- func (c *DockerComposeTerratestCommand) WithVerbose() *DockerComposeTerratestCommand
- type DockerComposeTerratestCommandFactory
- type FunctionalTestsSuite
- type OptionsFunc
- type QuiteLogger
- type RetryCommand
Constants ¶
const ( // BuildCommand is the command to build or rebuild services BuildCommand = "build" // DownCommand is the command to stop and remove containers and networks DownCommand = "down" // ExecCommand is the command to execute a command in a running container. ExecCommand = "exec" // KillCommand is the command to force stop service containers. KillCommand = "kill" // LogsCommand is the command to view output from containers LogsCommand = "logs" // RestartCommand is the command to restart service containers RestartCommand = "restart" // RmCommand is the command to removes stopped service containers RmCommand = "rm" // RunCommand is the command to run a one-off command on a service. RunCommand = "run" // StartCommand is the command to start services StartCommand = "start" // StopCommand is the command to stop services StopCommand = "stop" // UpCommand is the command to create and start containers UpCommand = "up" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssertAndCommander ¶
type CommandFactorier ¶
type CommandFactorier interface {
Command(command string) *DockerComposeTerratestCommand
}
type DockerComposeStack ¶
type DockerComposeStack struct { DownCommand Commander PostDownCommand []Commander PostUpCommand []Commander PreDownCommand []Commander PreUpCommand []Commander UpCommand Commander }
DockerComposeStack is a struct that defines the docker compose stack where the test will be executed
func NewDockerComposeStack ¶
func NewDockerComposeStack(opts ...DockerComposeStackOptionsFunc) *DockerComposeStack
NewDockerComposeStack creates a new DockerComposeStack
func (*DockerComposeStack) Down ¶
func (s *DockerComposeStack) Down() error
Down stops and removes the stack where the tests were executed
func (*DockerComposeStack) DownAndUp ¶
func (s *DockerComposeStack) DownAndUp() error
DownAndUp cleans up the stack and creates and starts it again
func (*DockerComposeStack) Execute ¶
func (c *DockerComposeStack) Execute(cmd Commander) error
Execute executes a command in the stack
func (*DockerComposeStack) ExecuteAndCompare ¶
func (c *DockerComposeStack) ExecuteAndCompare(cmd AssertAndCommander, expectedResult string) error
ExecuteAndCompare executes a command in the stack and compares the result with the expected result
func (*DockerComposeStack) Options ¶
func (s *DockerComposeStack) Options(opts ...DockerComposeStackOptionsFunc)
Options sets options for the DockerComposeStack
func (*DockerComposeStack) Up ¶
func (s *DockerComposeStack) Up() error
Up creates and starts the stack where the tests will be executed
type DockerComposeStackOptionsFunc ¶
type DockerComposeStackOptionsFunc func(*DockerComposeStack)
DockerComposeStackOptionsFunc is a function used to configure the service
func WithDownCommand ¶
func WithDownCommand(cmd Commander) DockerComposeStackOptionsFunc
WithDownCommand sets the down command for the DockerComposeStack
func WithStackPostDownCommand ¶
func WithStackPostDownCommand(cmd ...Commander) DockerComposeStackOptionsFunc
WithStackPostDownCommand sets the post-down commands for the DockerComposeStack
func WithStackPostUpCommand ¶
func WithStackPostUpCommand(cmd ...Commander) DockerComposeStackOptionsFunc
WithStackPostUpCommand sets the post-up commands for the DockerComposeStack
func WithStackPreDownCommand ¶
func WithStackPreDownCommand(cmd ...Commander) DockerComposeStackOptionsFunc
WithStackPreDownCommand sets the pre-down commands for the DockerComposeStack
func WithStackPreUpCommand ¶
func WithStackPreUpCommand(cmd ...Commander) DockerComposeStackOptionsFunc
WithStackPreUpCommand sets the pre-up commands for the DockerComposeStack
func WithUpCommand ¶
func WithUpCommand(cmd Commander) DockerComposeStackOptionsFunc
WithUpCommand sets the up command for the DockerComposeStack
type DockerComposeTerratestCommand ¶
type DockerComposeTerratestCommand struct {
// contains filtered or unexported fields
}
DockerComposeTerratestCommand that defines a Terratest docker-compose command
func NewDockerComposeTerratestCommand ¶
func NewDockerComposeTerratestCommand(t *testing.T, options *docker.Options) *DockerComposeTerratestCommand
NewDockerComposeTerratestCommand creates a new DockerComposeTerratestCommand
func (*DockerComposeTerratestCommand) AssertExectedResult ¶
func (c *DockerComposeTerratestCommand) AssertExectedResult(expected, result string)
func (*DockerComposeTerratestCommand) Execute ¶
func (c *DockerComposeTerratestCommand) Execute() (string, error)
Execute runs the DockerComposeTerratestCommand
func (*DockerComposeTerratestCommand) WithCommand ¶
func (c *DockerComposeTerratestCommand) WithCommand(cmd string) *DockerComposeTerratestCommand
WithCommand sets the command for the DockerComposeTerratestCommand
func (*DockerComposeTerratestCommand) WithCommandArgs ¶
func (c *DockerComposeTerratestCommand) WithCommandArgs(args string) *DockerComposeTerratestCommand
WithCommandArgs sets the command arguments for the DockerComposeTerratestCommand
func (*DockerComposeTerratestCommand) WithVerbose ¶
func (c *DockerComposeTerratestCommand) WithVerbose() *DockerComposeTerratestCommand
WithVerbose sets the verbose flag for the DockerComposeTerratestCommand
type DockerComposeTerratestCommandFactory ¶
type DockerComposeTerratestCommandFactory struct {
// contains filtered or unexported fields
}
DockerComposeTerratestCommandFactory that defines a Terratest docker-compose command factory
func NewDockerComposeTerratestCommandFactory ¶
func NewDockerComposeTerratestCommandFactory(t *testing.T, options *docker.Options) *DockerComposeTerratestCommandFactory
NewDockerComposeTerratestCommandFactory creates a new DockerComposeTerratestCommandFactory
func (*DockerComposeTerratestCommandFactory) Command ¶
func (f *DockerComposeTerratestCommandFactory) Command(cmd string) *DockerComposeTerratestCommand
Command creates a new DockerComposeTerratestCommand for the command cmd
type FunctionalTestsSuite ¶
type FunctionalTestsSuite struct { suite.Suite CommandFactory CommandFactorier SetupSuiteFunc func() error Stack *DockerComposeStack TearDownSuitFunc func() error }
FunctionalTestsSuite is a struct that defines the functional test suite
func NewFunctionalTestsSuite ¶
func NewFunctionalTestsSuite(opts ...OptionsFunc) *FunctionalTestsSuite
NewFunctionalTestsSuite creates a new FunctionalTestsSuite
func (*FunctionalTestsSuite) Options ¶
func (suite *FunctionalTestsSuite) Options(opts ...OptionsFunc)
Options sets options for the FunctionalTestsSuite
func (*FunctionalTestsSuite) SetupSuite ¶
func (suite *FunctionalTestsSuite) SetupSuite()
SetupSuite runs before the tests and setups the test suite
func (*FunctionalTestsSuite) TearDownSuite ¶
func (suite *FunctionalTestsSuite) TearDownSuite()
TearDownSuite runs after the tests and tears down the test suite
type OptionsFunc ¶
type OptionsFunc func(*FunctionalTestsSuite)
OptionsFunc is a function used to configure the FunctionalTestsSuite
func WithCommandFactory ¶
func WithCommandFactory(factory CommandFactorier) OptionsFunc
WithCommandFactory sets the command factory for the FunctionalTestsSuite
func WithSetupSuiteFunc ¶
func WithSetupSuiteFunc(f func() error) OptionsFunc
WithSetupSuiteFunc sets the setup suite function for the FunctionalTestsSuite
func WithStack ¶
func WithStack(stack *DockerComposeStack) OptionsFunc
WithStack sets the stack for the FunctionalTestsSuite
func WithTearDownSuiteFunc ¶
func WithTearDownSuiteFunc(f func() error) OptionsFunc
WithTearDownSuiteFunc sets the tear down suite function for the FunctionalTestsSuite
type QuiteLogger ¶
type QuiteLogger struct{}
type RetryCommand ¶
type RetryCommand struct {
// contains filtered or unexported fields
}
func NewRetryCommand ¶
func NewRetryCommand(commander Commander) *RetryCommand
func (*RetryCommand) Execute ¶
func (r *RetryCommand) Execute() (string, error)
func (*RetryCommand) WithPostRetryCommand ¶
func (r *RetryCommand) WithPostRetryCommand(cmd ...Commander) *RetryCommand
func (*RetryCommand) WithRetry ¶
func (r *RetryCommand) WithRetry(retry int) *RetryCommand
func (*RetryCommand) WithWaitTimeTillNextRetrySeconds ¶
func (r *RetryCommand) WithWaitTimeTillNextRetrySeconds(waitTimeTillNextRetrySeconds int) *RetryCommand