matchers

package
v0.18.8 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeAvailable

func BeAvailable() types.GomegaMatcher

BeAvailable matches if the actual occam.Container is running AND an HTTP request to at least one of its exposed ports completes without error.

func ContainLines

func ContainLines(expected ...interface{}) types.GomegaMatcher

ContainLines matches if all of the 'expected' matchers match with lines (i.e. newline-delimited substrings) in the 'actual' string or fmt.Stringer. Matching lines must appear in the order that the 'expected' matchers are passed.

func HaveDirectory added in v0.18.0

func HaveDirectory(path interface{}) types.GomegaMatcher

func HaveFile added in v0.18.0

func HaveFile(path interface{}) types.GomegaMatcher

func HaveFileWithContent added in v0.18.0

func HaveFileWithContent(path, matcher interface{}) types.GomegaMatcher

Types

type BeAFileMatchingMatcher added in v0.13.2

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

func BeAFileMatching added in v0.13.2

func BeAFileMatching(expected interface{}) *BeAFileMatchingMatcher

func (*BeAFileMatchingMatcher) FailureMessage added in v0.13.2

func (matcher *BeAFileMatchingMatcher) FailureMessage(_ interface{}) string

FailureMessage does not use the given param since it returns the expectedMatcher's failure message. Requires Match to be called first to populate the file contents.

func (*BeAFileMatchingMatcher) Match added in v0.13.2

func (matcher *BeAFileMatchingMatcher) Match(actual interface{}) (success bool, err error)

Match will return whether the expectedMatcher matches on the file contents. The file contents are saved for use in FailureMessage and NegatedFailureMessage.

func (*BeAFileMatchingMatcher) NegatedFailureMessage added in v0.13.2

func (matcher *BeAFileMatchingMatcher) NegatedFailureMessage(_ interface{}) string

NegatedFailureMessage does not use the given param since it returns the expectedMatcher's negated failure message. Requires Match to be called first to populate the file contents.

type BeAvailableMatcher

type BeAvailableMatcher struct {
	Docker occam.Docker
}

func (*BeAvailableMatcher) FailureMessage

func (m *BeAvailableMatcher) FailureMessage(actual interface{}) string

func (*BeAvailableMatcher) Match

func (*BeAvailableMatcher) Match(actual interface{}) (bool, error)

func (*BeAvailableMatcher) NegatedFailureMessage

func (m *BeAvailableMatcher) NegatedFailureMessage(actual interface{}) string
type Header struct {
	// contains filtered or unexported fields
}

func WithHeader added in v0.13.2

func WithHeader(key, value string) Header

type ServeMatcher added in v0.1.0

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

func Serve added in v0.1.0

func Serve(expected interface{}) *ServeMatcher

Serve matches if the actual occam.Container is running AND the response from an HTTP request to the container's exposed port matches the 'expected' matcher passed as an argument.

func (*ServeMatcher) FailureMessage added in v0.1.0

func (sm *ServeMatcher) FailureMessage(actual interface{}) (message string)

func (*ServeMatcher) Match added in v0.1.0

func (sm *ServeMatcher) Match(actual interface{}) (success bool, err error)

func (*ServeMatcher) NegatedFailureMessage added in v0.1.0

func (sm *ServeMatcher) NegatedFailureMessage(actual interface{}) (message string)

func (*ServeMatcher) OnPort added in v0.1.0

func (sm *ServeMatcher) OnPort(port int) *ServeMatcher

OnPort sets the container port that is expected to be exposed.

func (*ServeMatcher) WithClient added in v0.8.0

func (sm *ServeMatcher) WithClient(client *http.Client) *ServeMatcher

WithClient sets the http client that will be used to make the request. This allows for non-default client settings like custom redirect handling or adding a cookie jar.

func (*ServeMatcher) WithDocker added in v0.1.0

func (sm *ServeMatcher) WithDocker(docker occam.Docker) *ServeMatcher

WithDocker sets the occam.Docker that the matcher will use to access the 'actual' container's metadata.

func (*ServeMatcher) WithEndpoint added in v0.1.0

func (sm *ServeMatcher) WithEndpoint(endpoint string) *ServeMatcher

WithEndpoint sets the endpoint or subdirectory where the expected content should be available. For example, WithEndpoint("/health") will attempt to access the server's /health endpoint.

func (*ServeMatcher) WithProtocol added in v0.14.0

func (sm *ServeMatcher) WithProtocol(protocol string) *ServeMatcher

WithProtocol sets the protocol of the request. For example, WithProtocol("https") will make an https request

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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