Documentation ¶
Index ¶
- Constants
- func BuildArgs(flags map[string]string) []string
- func EmptyFlags() map[string]string
- func Equals(value float64) func(sums ...float64) bool
- func EqualsAmongTwo(sums ...float64) bool
- func GenerateSeries(name string, ts time.Time) (series []prompb.TimeSeries, vector model.Vector)
- func GetRequest(url string) (*http.Response, error)
- func Greater(value float64) func(sums ...float64) bool
- func GreaterAmongTwo(sums ...float64) bool
- func Less(value float64) func(sums ...float64) bool
- func LessAmongTwo(sums ...float64) bool
- func MergeFlags(inputs ...map[string]string) map[string]string
- func RunCommandAndGetOutput(name string, args ...string) ([]byte, error)
- func TimeToMilliseconds(t time.Time) int64
- type Command
- type ConcreteService
- func (s *ConcreteService) Endpoint(port int) string
- func (s *ConcreteService) Kill() error
- func (s *ConcreteService) Name() string
- func (s *ConcreteService) NetworkEndpoint(port int) string
- func (s *ConcreteService) NetworkEndpointFor(networkName string, port int) string
- func (s *ConcreteService) Ready() error
- func (s *ConcreteService) SetBackoff(cfg util.BackoffConfig)
- func (s *ConcreteService) SetEnvVars(env map[string]string)
- func (s *ConcreteService) SetReadinessProbe(probe *ReadinessProbe)
- func (s *ConcreteService) SetUser(user string)
- func (s *ConcreteService) Start(networkName, sharedDir string) (err error)
- func (s *ConcreteService) Stop() error
- func (s *ConcreteService) WaitReady() (err error)
- func (s *ConcreteService) WaitStarted() (err error)
- type HTTPService
- func (s *HTTPService) HTTPEndpoint() string
- func (s *HTTPService) HTTPPort() int
- func (s *HTTPService) Metrics() (_ string, err error)
- func (s *HTTPService) NetworkHTTPEndpoint() string
- func (s *HTTPService) NetworkHTTPEndpointFor(networkName string) string
- func (s *HTTPService) WaitSumMetrics(isExpected func(sums ...float64) bool, metricNames ...string) error
- type LinePrefixWriter
- type ReadinessProbe
- type Scenario
- func (s *Scenario) Close()
- func (s *Scenario) NetworkName() string
- func (s *Scenario) SharedDir() string
- func (s *Scenario) Start(services ...Service) error
- func (s *Scenario) StartAndWaitReady(services ...Service) error
- func (s *Scenario) Stop(services ...Service) error
- func (s *Scenario) WaitReady(services ...Service) error
- type Service
Constants ¶
const (
)Variables ¶
This section is empty.
Functions ¶
func EmptyFlags ¶
func EqualsAmongTwo ¶
EqualsAmongTwo returns true if first sum is equal to the second. NOTE: Be careful on scrapes in between of process that changes two metrics. Those are usually not atomic.
func GenerateSeries ¶
func GreaterAmongTwo ¶
GreaterAmongTwo returns true if first sum is greater than second. NOTE: Be careful on scrapes in between of process that changes two metrics. Those are usually not atomic.
func LessAmongTwo ¶
LessAmongTwo returns true if first sum is smaller than second. NOTE: Be careful on scrapes in between of process that changes two metrics. Those are usually not atomic.
func RunCommandAndGetOutput ¶
func TimeToMilliseconds ¶
timeToMilliseconds returns the input time as milliseconds, using the same formula used by Prometheus in order to get the same timestamp when asserting on query results.
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func NewCommand ¶
type ConcreteService ¶
type ConcreteService struct {
// contains filtered or unexported fields
}
ConcreteService represents microservice with optional ports which will be discoverable from docker with <name>:<port>. For connecting from test, use `Endpoint` method.
ConcreteService can be reused (started and stopped many time), but it can represent only one running container at the time.
func NewConcreteService ¶
func NewConcreteService( name string, image string, command *Command, readiness *ReadinessProbe, networkPorts ...int, ) *ConcreteService
func (*ConcreteService) Endpoint ¶
func (s *ConcreteService) Endpoint(port int) string
Endpoint returns external (from host perspective) service endpoint (host:port) for given internal port. External means that it will be accessible only from host, but not from docker containers.
If your service is not running, this method returns incorrect `stopped` endpoint.
func (*ConcreteService) Kill ¶
func (s *ConcreteService) Kill() error
func (*ConcreteService) Name ¶
func (s *ConcreteService) Name() string
func (*ConcreteService) NetworkEndpoint ¶
func (s *ConcreteService) NetworkEndpoint(port int) string
NetworkEndpoint returns internal service endpoint (host:port) for given internal port. Internal means that it will be accessible only from docker containers within the network that this service is running in. If you configure your local resolver with docker DNS namespace you can access it from host as well. Use `Endpoint` for host access.
If your service is not running, use `NetworkEndpointFor` instead.
func (*ConcreteService) NetworkEndpointFor ¶
func (s *ConcreteService) NetworkEndpointFor(networkName string, port int) string
NetworkEndpointFor returns internal service endpoint (host:port) for given internal port and network. Internal means that it will be accessible only from docker containers within the given network. If you configure your local resolver with docker DNS namespace you can access it from host as well.
This method return correct endpoint for the service in any state.
func (*ConcreteService) Ready ¶
func (s *ConcreteService) Ready() error
func (*ConcreteService) SetBackoff ¶
func (s *ConcreteService) SetBackoff(cfg util.BackoffConfig)
func (*ConcreteService) SetEnvVars ¶
func (s *ConcreteService) SetEnvVars(env map[string]string)
func (*ConcreteService) SetReadinessProbe ¶
func (s *ConcreteService) SetReadinessProbe(probe *ReadinessProbe)
func (*ConcreteService) SetUser ¶
func (s *ConcreteService) SetUser(user string)
func (*ConcreteService) Start ¶
func (s *ConcreteService) Start(networkName, sharedDir string) (err error)
func (*ConcreteService) Stop ¶
func (s *ConcreteService) Stop() error
func (*ConcreteService) WaitReady ¶
func (s *ConcreteService) WaitReady() (err error)
func (*ConcreteService) WaitStarted ¶
func (s *ConcreteService) WaitStarted() (err error)
type HTTPService ¶
type HTTPService struct { *ConcreteService // contains filtered or unexported fields }
HTTPService represents opinionated microservice with at least HTTP port that as mandatory requirement, serves metrics.
func NewHTTPService ¶
func NewHTTPService( name string, image string, command *Command, readiness *ReadinessProbe, httpPort int, otherPorts ...int, ) *HTTPService
func (*HTTPService) HTTPEndpoint ¶
func (s *HTTPService) HTTPEndpoint() string
func (*HTTPService) HTTPPort ¶
func (s *HTTPService) HTTPPort() int
func (*HTTPService) Metrics ¶
func (s *HTTPService) Metrics() (_ string, err error)
func (*HTTPService) NetworkHTTPEndpoint ¶
func (s *HTTPService) NetworkHTTPEndpoint() string
func (*HTTPService) NetworkHTTPEndpointFor ¶
func (s *HTTPService) NetworkHTTPEndpointFor(networkName string) string
func (*HTTPService) WaitSumMetrics ¶
func (s *HTTPService) WaitSumMetrics(isExpected func(sums ...float64) bool, metricNames ...string) error
type LinePrefixWriter ¶
type LinePrefixWriter struct {
// contains filtered or unexported fields
}
type ReadinessProbe ¶
type ReadinessProbe struct {
// contains filtered or unexported fields
}
func NewReadinessProbe ¶
func NewReadinessProbe(port int, path string, expectedStatus int) *ReadinessProbe
func (*ReadinessProbe) Ready ¶
func (p *ReadinessProbe) Ready(localPort int) (err error)
type Scenario ¶
type Scenario struct {
// contains filtered or unexported fields
}
func NewScenario ¶
func (*Scenario) NetworkName ¶
NetworkName returns the network name that scenario is responsible for.
func (*Scenario) SharedDir ¶
SharedDir returns the absolute path of the directory on the host that is shared with all services in docker.