Documentation
¶
Overview ¶
- Copyright contributors to the Galasa project *
- SPDX-License-Identifier: EPL-2.0
Package launcher contains an abstraction of a launcher which can launch things.
There are two main implementations of launcher: - The remoteLauncher which can launch a testRun inside a container on a remote Galasa server - The jvmLauncher which can launch each testRun within a java virtual machine locally on this machine.
These launcher implementations share many aspects. Specifically: - They are invoked by the same 'submitter' object. - They all implement the launcher interface, allowing the launching of a test, and the monitoring of its' status after the event.
This allows them to both produce results in the same format, so the same reporting routines can be used for the various report formats.
Copyright contributors to the Galasa project *
SPDX-License-Identifier: EPL-2.0
Copyright contributors to the Galasa project *
SPDX-License-Identifier: EPL-2.0
Copyright contributors to the Galasa project *
SPDX-License-Identifier: EPL-2.0
Copyright contributors to the Galasa project *
SPDX-License-Identifier: EPL-2.0
Copyright contributors to the Galasa project *
SPDX-License-Identifier: EPL-2.0
Copyright contributors to the Galasa project *
SPDX-License-Identifier: EPL-2.0
Copyright contributors to the Galasa project *
SPDX-License-Identifier: EPL-2.0
Copyright contributors to the Galasa project *
SPDX-License-Identifier: EPL-2.0
Index ¶
- Constants
- func NewMockProcess() *mockProcess
- type JVMOutputProcessor
- type JvmLauncher
- func (launcher *JvmLauncher) GetRunsByGroup(groupName string) (*galasaapi.TestRuns, error)
- func (launcher *JvmLauncher) GetRunsById(runId string) (*galasaapi.Run, error)
- func (launcher *JvmLauncher) GetRunsBySubmissionId(submissionId string, groupId string) (*galasaapi.Run, error)
- func (launcher *JvmLauncher) GetStreams() ([]string, error)
- func (launcher *JvmLauncher) GetTestCatalog(stream string) (TestCatalog, error)
- func (launcher *JvmLauncher) SubmitTestRun(groupName string, className string, requestType string, requestor string, ...) (*galasaapi.TestRuns, error)
- type LaunchParameters
- type Launcher
- type LocalTest
- type MockLauncher
- func (launcher *MockLauncher) GetRecordedLaunchRecords() []LaunchParameters
- func (launcher *MockLauncher) GetRunsByGroup(groupName string) (*galasaapi.TestRuns, error)
- func (launcher *MockLauncher) GetRunsById(runId string) (*galasaapi.Run, error)
- func (launcher *MockLauncher) GetRunsBySubmissionId(submissionId string, groupId string) (*galasaapi.Run, error)
- func (launcher *MockLauncher) GetStreams() ([]string, error)
- func (launcher *MockLauncher) GetTestCatalog(stream string) (TestCatalog, error)
- func (launcher *MockLauncher) SubmitTestRun(groupName string, className string, requestType string, requestor string, ...) (*galasaapi.TestRuns, error)
- type Process
- type ProcessFactory
- type RemoteLauncher
- func (launcher *RemoteLauncher) GetRunsByGroup(groupName string) (*galasaapi.TestRuns, error)
- func (launcher *RemoteLauncher) GetRunsById(runId string) (*galasaapi.Run, error)
- func (launcher *RemoteLauncher) GetRunsBySubmissionId(submissionId string, groupId string) (*galasaapi.Run, error)
- func (launcher *RemoteLauncher) GetStreams() ([]string, error)
- func (launcher *RemoteLauncher) GetTestCatalog(stream string) (TestCatalog, error)
- func (launcher *RemoteLauncher) SubmitTestRun(groupName string, className string, requestType string, requestor string, ...) (*galasaapi.TestRuns, error)
- type RunsSubmitLocalCmdParameters
- type TestCatalog
- type TestLocation
- type TestResultsSummary
Constants ¶
const (
DEBUG_PORT_DEFAULT uint32 = 2970
)
const (
SHUTDOWN_FRAMEWORK_EYE_CATCHER = `d.g.f.Framework - Framework shutdown`
)
Variables ¶
This section is empty.
Functions ¶
func NewMockProcess ¶
func NewMockProcess() *mockProcess
Types ¶
type JVMOutputProcessor ¶
type JVMOutputProcessor struct {
// contains filtered or unexported fields
}
JVMOutputProcessor Sometjing which pretends to be an io.Writer interface implementation, and can be placed as stdout or stderr for a JVM process. The JVM process will write out trace statements to stdout, and this object listens to it. We watch the trace data as it arrives, searching for some data we want to extract from the JVM and Galasa framework as it executes. Ideally we'd gather the data in some other way, like in a file to which the properties we need are dumped... but using trace works for now and was quick to implement in the CLI component, rather than demand changes to the framework component also. Items we detect are stored in the structure below as we find them.
func NewJVMOutputProcessor ¶
func NewJVMOutputProcessor() *JVMOutputProcessor
Create a new JVM processor.
type JvmLauncher ¶
type JvmLauncher struct {
// contains filtered or unexported fields
}
JvmLauncher can act as a launcher, it's given test cases which need to be executed, and it launches them within a local JVM.
func NewJVMLauncher ¶
func NewJVMLauncher( factory spi.Factory, bootstrapProps props.JavaProperties, embeddedFileSystem embedded.ReadOnlyFileSystem, runsSubmitLocalCmdParams *RunsSubmitLocalCmdParameters, processFactory ProcessFactory, galasaHome spi.GalasaHome, timedSleeper spi.TimedSleeper, ) (*JvmLauncher, error)
NewJVMLauncher creates a JVM launcher. Primes it with references to services which can be used to launch JVM servers. We get the caller's timer service so we can interrupt the caller when we are done.
func (*JvmLauncher) GetRunsByGroup ¶
func (launcher *JvmLauncher) GetRunsByGroup(groupName string) (*galasaapi.TestRuns, error)
func (*JvmLauncher) GetRunsById ¶
func (launcher *JvmLauncher) GetRunsById(runId string) (*galasaapi.Run, error)
GetRunsById gets the Run information for the run with a specific run identifier
func (*JvmLauncher) GetRunsBySubmissionId ¶ added in v0.40.0
func (launcher *JvmLauncher) GetRunsBySubmissionId(submissionId string, groupId string) (*galasaapi.Run, error)
Gets a run based on the submission ID of that run. For local runs, the submission ID is the same as the test run id.
func (*JvmLauncher) GetStreams ¶
func (launcher *JvmLauncher) GetStreams() ([]string, error)
GetStreams gets a list of streams available on this launcher
func (*JvmLauncher) GetTestCatalog ¶
func (launcher *JvmLauncher) GetTestCatalog(stream string) (TestCatalog, error)
GetTestCatalog gets the test catalog for a given stream.
func (*JvmLauncher) SubmitTestRun ¶
func (launcher *JvmLauncher) SubmitTestRun( groupName string, className string, requestType string, requestor string, stream string, obrFromPortfolio string, isTraceEnabled bool, gherkinURL string, GherkinFeature string, overrides map[string]interface{}, ) (*galasaapi.TestRuns, error)
SubmitTestRuns launch the test runs
groupName - The run group ID. Used to group all the TestRuns together so we can query the results later.
classNames - An array of strings in the form "<osgi-bundle-id>/<fully-qualified-java-classname> Note: There is no ".class" suffix needed for each entry. That is assumed.
requestType - A metadata marker to indicate how the testRun was scheduled. requestor - Who wanted the testRun to launch. stream - The stream the test run is part of isTraceEnabled - True of the trace for the test run should be gathered. overrides - A map of overrides of key-value pairs.
type LaunchParameters ¶
type LaunchParameters struct {
GroupName string
ClassName string
RequestType string
Requestor string
Stream string
ObrFromPortfolio string
IsTraceEnabled bool
GherkinURL string
GherkinFeature string
Overrides map[string]interface{}
}
Structure used to collect parameters which are sent to the mock, so we can get them back in the test and assert they had certain values.
type Launcher ¶
type Launcher interface {
// GetRunsByGroup gets the lust of test runs for this groupName
GetRunsByGroup(groupName string) (*galasaapi.TestRuns, error)
// SubmitTestRuns launch the test runs
SubmitTestRun(
groupName string,
className string,
requestType string,
requestor string,
stream string,
obrFromPortfolio string,
isTraceEnabled bool,
gherkinURL string,
GherkinFeature string,
overrides map[string]interface{},
) (*galasaapi.TestRuns, error)
// GetRunsById gets the Run information for the run with a specific run identifier
GetRunsById(runId string) (*galasaapi.Run, error)
// Gets a run based on the submission ID of that run.
GetRunsBySubmissionId(submissionId string, groupId string) (*galasaapi.Run, error)
// GetStreams gets a list of streams available on this launcher
GetStreams() ([]string, error)
// GetTestCatalog gets the test catalog for a given stream.
GetTestCatalog(stream string) (TestCatalog, error)
}
---------------------------------------------------------------------------------- Launcher something which launches and monitors tests in some environment.
type LocalTest ¶
type LocalTest struct {
// contains filtered or unexported fields
}
A local test which gets run.
func NewLocalTest ¶
func NewLocalTest( mainPollLoopSleeper spi.TimedSleeper, fileSystem spi.FileSystem, processFactory ProcessFactory, ) *LocalTest
A structure which tells us all we know about a JVM process we launched.
type MockLauncher ¶
type MockLauncher struct {
// contains filtered or unexported fields
}
func NewMockLauncher ¶
func NewMockLauncher() *MockLauncher
func (*MockLauncher) GetRecordedLaunchRecords ¶
func (launcher *MockLauncher) GetRecordedLaunchRecords() []LaunchParameters
func (*MockLauncher) GetRunsByGroup ¶
func (launcher *MockLauncher) GetRunsByGroup(groupName string) (*galasaapi.TestRuns, error)
GetRunsByGroup gets the lust of test runs for this groupName
func (*MockLauncher) GetRunsById ¶
func (launcher *MockLauncher) GetRunsById(runId string) (*galasaapi.Run, error)
GetRunsById gets the Run information for the run with a specific run identifier
func (*MockLauncher) GetRunsBySubmissionId ¶ added in v0.40.0
func (launcher *MockLauncher) GetRunsBySubmissionId(submissionId string, groupId string) (*galasaapi.Run, error)
Gets a run based on the submission ID of that run.
func (*MockLauncher) GetStreams ¶
func (launcher *MockLauncher) GetStreams() ([]string, error)
GetStreams gets a list of streams available on this launcher
func (*MockLauncher) GetTestCatalog ¶
func (launcher *MockLauncher) GetTestCatalog(stream string) (TestCatalog, error)
GetTestCatalog gets the test catalog for a given stream.
func (*MockLauncher) SubmitTestRun ¶
func (launcher *MockLauncher) SubmitTestRun( groupName string, className string, requestType string, requestor string, stream string, obrFromPortfolio string, isTraceEnabled bool, GherkinURL string, GherkinFeature string, overrides map[string]interface{}, ) (*galasaapi.TestRuns, error)
SubmitTestRuns launch the test runs
type Process ¶
type Process interface {
// Start the process, giving it a command with arguments, and somewhere
// into which it can write to stdout and stderr.
Start(cmd string, args []string, stdOut io.Writer, stdErr io.Writer) error
// Wait for the process to complete. This is a blocking call.
Wait() error
}
A process is something which can be started, and waited upon.
type ProcessFactory ¶
type ProcessFactory interface {
NewProcess() Process
}
ProcessFactory is something which can create new processes. This allows us to supply a process factory whcih creates mock instances of processes for unit testing.
func NewMockProcessFactory ¶
func NewMockProcessFactory(mockToServeUp *mockProcess) ProcessFactory
A mock process factory returns a mock process.
func NewRealProcessFactory ¶
func NewRealProcessFactory() ProcessFactory
NewRealProcessFactory used to create a factory which can create real processes.
type RemoteLauncher ¶
type RemoteLauncher struct {
// contains filtered or unexported fields
}
RemoteLauncher A launcher, which launches and monitors tests on a remote ecosystem via HTTP/HTTPS.
func NewRemoteLauncher ¶
func NewRemoteLauncher(commsClient api.APICommsClient) *RemoteLauncher
NewRemoteLauncher create a remote launcher.
func (*RemoteLauncher) GetRunsByGroup ¶
func (launcher *RemoteLauncher) GetRunsByGroup(groupName string) (*galasaapi.TestRuns, error)
GetRunsByGroup get all the testruns which are associated with a named group.
func (*RemoteLauncher) GetRunsById ¶
func (launcher *RemoteLauncher) GetRunsById(runId string) (*galasaapi.Run, error)
func (*RemoteLauncher) GetRunsBySubmissionId ¶ added in v0.40.0
func (launcher *RemoteLauncher) GetRunsBySubmissionId(submissionId string, groupId string) (*galasaapi.Run, error)
Gets the latest run based on the submission ID of that run. For local runs, the submission ID is the same as the test run id.
func (*RemoteLauncher) GetStreams ¶
func (launcher *RemoteLauncher) GetStreams() ([]string, error)
func (*RemoteLauncher) GetTestCatalog ¶
func (launcher *RemoteLauncher) GetTestCatalog(stream string) (TestCatalog, error)
func (*RemoteLauncher) SubmitTestRun ¶
type RunsSubmitLocalCmdParameters ¶
type RunsSubmitLocalCmdParameters struct {
// A list of OBRs, which we hope one of these contains the tests we want to run.
Obrs []string
// The local maven repo, eg: file:///home/.m2/repository, where we can load the galasa uber-obr
LocalMaven string
// The remote maven repo, eg: maven central, where we can load the galasa uber-obr
RemoteMaven string
// The version of galasa we want to launch. This indicates which uber-obr will be
// loaded.
TargetGalasaVersion string
// Should the JVM be launched in debug mode ?
IsDebugEnabled bool
// When launched in debug mode, which port should the JVM use to talk to the Java
// debugger ? This port is either listened on, or attached to depending on the
// DebugMode field.
DebugPort uint32
// A string indicating whether the test JVM should 'attach' to the debug port
// to talk to the Java debugger (JDB), or whether it should 'listen' on a port
// ready for the JDB to attach to.
DebugMode string
// A string containing the url of the gherkin test file to be exceuted
GherkinURL string
}
These parameters are gathered from the command-line and passed into the laucher.
type TestCatalog ¶
type TestCatalog map[string]interface{}
type TestLocation ¶
TestLocation the user passes us this information in one string. We split it up into these useful chunks.
type TestResultsSummary ¶
We gather a summary of passes and failures from the test results we read from ras/<runId>/structure.json