Documentation
¶
Index ¶
- Constants
- func BuildEnv(options StartOptions, envOptions EnvOptions) []string
- func CheckMockStatus(port int) error
- func EnsureFileCacheDir() (string, error)
- func GetConfiguredVersion(engineType EngineType, override string, allowCached bool) string
- func GetConfiguredVersionOrResolve(engineType EngineType, override string, allowCached bool, resolveIfLatest bool) string
- func GetHighestVersion(engines []EngineMetadata) string
- func IsMockUp(port int) (success bool)
- func PopulateHealth(mock *ManagedMock)
- func RegisterEngine(engineType EngineType, ...)
- func RegisterLibrary(engineType EngineType, b func() EngineLibrary)
- func ResolveLatestToVersion(engineType EngineType, allowCached bool) (string, error)
- func SanitiseVersionOutput(s string) string
- func WaitForOp(desc string, timeoutDuration time.Duration, abortC chan bool, ...) (success bool)
- func WaitForUrl(desc string, url string, abortC chan bool) (success bool)
- func WaitUntilUp(port int, shutDownC chan bool) (success bool)
- type EngineLibrary
- type EngineMetadata
- type EngineType
- type EnvOptions
- type ManagedMock
- type MockEngine
- type MockHealth
- type Provider
- type PullPolicy
- type StartOptions
Constants ¶
View Source
const DefaultDebugPort = 8000
Variables ¶
This section is empty.
Functions ¶
func BuildEnv ¶
func BuildEnv(options StartOptions, envOptions EnvOptions) []string
func CheckMockStatus ¶
CheckMockStatus invokes the status endpoint on the specified port and checks it returns an HTTP 200 status.
func EnsureFileCacheDir ¶
func GetConfiguredVersion ¶
func GetConfiguredVersion(engineType EngineType, override string, allowCached bool) string
func GetConfiguredVersionOrResolve ¶
func GetConfiguredVersionOrResolve(engineType EngineType, override string, allowCached bool, resolveIfLatest bool) string
func GetHighestVersion ¶
func GetHighestVersion(engines []EngineMetadata) string
func IsMockUp ¶
IsMockUp invokes the status endpoint on the specified port and returns a boolean indicating whether it is healthy.
func PopulateHealth ¶
func PopulateHealth(mock *ManagedMock)
func RegisterEngine ¶
func RegisterEngine(engineType EngineType, b func(configDir string, startOptions StartOptions) MockEngine)
func RegisterLibrary ¶
func RegisterLibrary(engineType EngineType, b func() EngineLibrary)
func ResolveLatestToVersion ¶
func ResolveLatestToVersion(engineType EngineType, allowCached bool) (string, error)
func SanitiseVersionOutput ¶
func WaitUntilUp ¶
Types ¶
type EngineLibrary ¶
type EngineLibrary interface {
CheckPrereqs() (bool, []string)
List() ([]EngineMetadata, error)
GetProvider(version string) Provider
// IsSealedDistro indicates whether a library represents a fixed distribution.
// Fixed distributions have a single version, so do not support version
// resolution or fetching engine binaries.
IsSealedDistro() bool
// ShouldEnsurePlugins indicates whether missing default plugins should be
// installed before starting the engine.
ShouldEnsurePlugins() bool
}
func GetLibrary ¶
func GetLibrary(engineType EngineType) EngineLibrary
type EngineMetadata ¶
type EngineMetadata struct {
EngineType EngineType
Version string
}
func (*EngineMetadata) Build ¶
func (e *EngineMetadata) Build(configDir string, startOptions StartOptions) MockEngine
type EngineType ¶
type EngineType string
const ( EngineTypeNone EngineType = "" EngineTypeAwsLambda EngineType = "awslambda" EngineTypeDockerCore EngineType = "docker" EngineTypeDockerAll EngineType = "docker-all" EngineTypeDockerDistroless EngineType = "docker-distroless" EngineTypeJvmSingleJar EngineType = "jvm" EngineTypeJvmUnpacked EngineType = "unpacked" EngineTypeGolang EngineType = "golang" )
func EnumerateLibraries ¶
func EnumerateLibraries() []EngineType
func GetConfiguredType ¶
func GetConfiguredType(override string) EngineType
func GetConfiguredTypeWithDefault ¶
func GetConfiguredTypeWithDefault(override string, defaultType EngineType) EngineType
type EnvOptions ¶
type ManagedMock ¶
type ManagedMock struct {
ID string
Name string
Port int
Health MockHealth
}
type MockEngine ¶
type MockEngine interface {
Start(wg *sync.WaitGroup) (success bool)
Stop(wg *sync.WaitGroup)
StopImmediately(wg *sync.WaitGroup)
Restart(wg *sync.WaitGroup)
ListAllManaged() ([]ManagedMock, error)
StopAllManaged() int
GetVersionString() (string, error)
}
func BuildEngine ¶
func BuildEngine(engineType EngineType, configDir string, startOptions StartOptions) MockEngine
BuildEngine is a convenience function that gets the library for the given engine type, obtains a provider for the version specified in the start options, then invokes the provider's builder function.
Note that the provider's Provide() function is not invoked explicitly, although it may be invoked implicitly from the builder function.
type MockHealth ¶
type MockHealth string
const ( MockHealthHealthy MockHealth = "healthy" MockHealthUnhealthy MockHealth = "unhealthy" MockHealthUnknown MockHealth = "unknown" )
type Provider ¶
type Provider interface {
Satisfied() bool
Provide(policy PullPolicy) error
GetEngineType() EngineType
Build(configDir string, startOptions StartOptions) MockEngine
// Bundle creates a single archive file containing the engine binary and
// configuration files. The archive is written to the specified destination.
// If the engine type is 'docker', destination should be a valid image name.
Bundle(configDir string, dest string) error
}
type PullPolicy ¶
type PullPolicy int
const ( PullSkip PullPolicy = iota PullAlways PullPolicy = iota PullIfNotPresent PullPolicy = iota )
Click to show internal directories.
Click to hide internal directories.