Documentation ¶
Overview ¶
* 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
* 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
* 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
- Variables
- func AddClassFlag(command *cobra.Command, flags *utils.TestSelectionFlagValues, isRequired bool, ...)
- func AddClassesToPortfolio(testSelection *TestSelection, testOverrides *map[string]string, ...)
- func AddCommandFlags(command *cobra.Command, flags *utils.TestSelectionFlagValues)
- func AddGherkinFlag(command *cobra.Command, flags *utils.TestSelectionFlagValues, isRequired bool, ...)
- func AreSelectionFlagsProvided(flags *utils.TestSelectionFlagValues) bool
- func CancelRun(runName string, timeService utils.TimeService, console utils.Console, ...) error
- func CountTotalFailedRuns(finishedRuns map[string]*TestRun, lostRuns map[string]*TestRun) int
- func CreateEmptyArtifactFile(fileSystem files.FileSystem, targetFilePath string) (io.WriteCloser, error)
- func CreateFormatters() map[string]runsformatter.RunsFormatter
- func DeepClone(original map[string]*TestRun) map[string]*TestRun
- func DownloadArtifacts(runName string, forceDownload bool, fileSystem files.FileSystem, ...) error
- func FinalHumanReadableReport(finishedRuns map[string]*TestRun, lostRuns map[string]*TestRun)
- func FinalHumanReadableReportAsString(finishedRuns map[string]*TestRun, lostRuns map[string]*TestRun) string
- func FormattableTestFromGalasaApi(runs []galasaapi.Run, apiServerUrl string) []runsformatter.FormattableTest
- func FormattableTestFromTestRun(finishedMap map[string]*TestRun, lostMap map[string]*TestRun) []runsformatter.FormattableTest
- func GetArtifactPathsFromRestApi(runId string, apiClient *galasaapi.APIClient) ([]string, error)
- func GetFileFromRestApi(runId string, artifactPath string, apiClient *galasaapi.APIClient) (io.Reader, bool, *http.Response, error)
- func GetFormatterNamesString(validFormatters map[string]runsformatter.RunsFormatter) string
- func GetRunDetailsFromRasSearchRuns(runs []galasaapi.Run, apiClient *galasaapi.APIClient) ([]galasaapi.Run, error)
- func GetRuns(runName string, age string, requestorParameter string, resultParameter string, ...) error
- func GetRunsFromRestApi(runName string, requestorParameter string, resultParameter string, ...) ([]galasaapi.Run, error)
- func GetStreams(launcher launcher.Launcher) ([]string, error)
- func GetTimeUnitsForErrorMessage() string
- func GetTimeUnitsMap() map[string]*TimeUnit
- func InterrimProgressReport(readyRuns []TestRun, submittedRuns map[string]*TestRun, ...)
- func InterrimProgressReportAsString(readyRuns []TestRun, submittedRuns map[string]*TestRun, ...) string
- func NewTestSelectionFlagValues() *utils.TestSelectionFlagValues
- func ReportJSON(fileSystem files.FileSystem, reportJsonFilename string, ...) error
- func ReportJunit(fileSystem files.FileSystem, reportJunitFilename string, groupName string, ...) error
- func ReportYaml(fileSystem files.FileSystem, reportYamlFilename string, ...) error
- func ResetRun(runName string, timeService utils.TimeService, console utils.Console, ...) error
- func TransferContent(sourceFile io.Reader, targetFile io.WriteCloser, targetFilePath string) error
- func ValidateResultParameter(resultInputString string, apiClient *galasaapi.APIClient) (string, error)
- func ValidateRunName(runName string) error
- func ValidateStream(validStreamNames []string, streamNameToCheck string) error
- func WriteArtifactToFileSystem(fileSystem files.FileSystem, targetFilePath string, artifactPath string, ...) error
- func WritePortfolio(fileSystem files.FileSystem, filename string, portfolio *Portfolio) error
- type JunitFailure
- type JunitTestCase
- type JunitTestSuite
- type JunitTestSuites
- type ObrBasedValidator
- type Portfolio
- type PortfolioClass
- type PortfolioMetadata
- type StreamBasedValidator
- type Submitter
- type TestClass
- type TestMethod
- type TestReport
- type TestRun
- type TestSelection
- type TestSelectionFlagValidator
- type TimeUnit
Constants ¶
const ( RESULT_PASSED = "Passed" RESULT_PASSED_WITH_DEFECTS = "Passed With Defects" RESULT_FAILED = "Failed" RESULT_FAILED_WITH_DEFECTS = "Failed With Defects" RESULT_LOST = "Lost" RESULT_ENVFAIL = "EnvFail" )
const ( // Inside the portfolio file, it must carry a format field with this value inside. PORTOLIO_DECLARED_FORMAT_VERSION = "v1alpha" // Inside the portfolio file, it should claim to be a resource of this kind. PORTFOLIO_DECLARED_RESOURCE_KIND = "galasa.dev/testPortfolio" )
const ( DEFAULT_POLL_INTERVAL_SECONDS int = 30 MAX_INT int = int(^uint(0) >> 1) DEFAULT_PROGRESS_REPORT_INTERVAL_MINUTES int = 5 DEFAULT_THROTTLE_TESTS_AT_ONCE int = 3 )
const ( // An active run that should be finished now. RUN_U123_FIRST_RUN = `` /* 555-byte string literal not displayed */ // An active run RUN_U123_RE_RUN = `` /* 555-byte string literal not displayed */ // Another active run RUN_U123_RE_RUN_2 = `` /* 555-byte string literal not displayed */ // A finished run RUN_U120 = `` /* 767-byte string literal not displayed */ // Another finished run RUN_U121 = `` /* 767-byte string literal not displayed */ )
const ( INT_TYPE_VARIANT_PLAIN_INT = 0 INT_TYPE_VARIANT_INT8 = 8 INT_TYPE_VARIANT_INT16 = 16 INT_TYPE_VARIANT_INT32 = 32 INT_TYPE_VARIANT_INT64 = 64 )
Variables ¶
var ( CANCEL_STATUS = "finished" CANCEL_RESULT = "cancelled" )
var ( RESET_STATUS = "queued" RESET_RESULT = "" )
var ( TIME_UNIT_WEEKS = newTimeUnit("weeks", "w", 10080) TIME_UNIT_DAYS = newTimeUnit("days", "d", 1440) TIME_UNIT_HOURS = newTimeUnit("hours", "h", 60) TIME_UNIT_MINUTES = newTimeUnit("minutes", "m", 1) )
var ( // Expect the pattern letters + number // ^ matches the start of the string // $ matches the end of the string // If ^ and $ are not specified, then M2M2 would match (two instances of the match)! RUN_NAME_PATTERN *regexp.Regexp = regexp.MustCompile("^[a-zA-Z]+[0-9]+$") )
Functions ¶
func AddClassFlag ¶
func AddClassesToPortfolio ¶
func AddClassesToPortfolio(testSelection *TestSelection, testOverrides *map[string]string, portfolio *Portfolio)
func AddCommandFlags ¶
func AddCommandFlags(command *cobra.Command, flags *utils.TestSelectionFlagValues)
Adds a ton of flags to a cobra command like 'runs prepare' or 'runs submit'. The flags are consistently added as a result.
func AddGherkinFlag ¶ added in v0.32.0
func AreSelectionFlagsProvided ¶
func AreSelectionFlagsProvided(flags *utils.TestSelectionFlagValues) bool
func CountTotalFailedRuns ¶
func CreateEmptyArtifactFile ¶
func CreateEmptyArtifactFile(fileSystem files.FileSystem, targetFilePath string) (io.WriteCloser, error)
Creates an empty file representing an artifact that is being written. Any parent directories that do not exist will be created. Returns the empty file that was created or an error if any file creation operations failed.
func CreateFormatters ¶
func CreateFormatters() map[string]runsformatter.RunsFormatter
func DownloadArtifacts ¶
func DownloadArtifacts( runName string, forceDownload bool, fileSystem files.FileSystem, timeService utils.TimeService, console utils.Console, apiClient *galasaapi.APIClient, runDownloadTargetFolder string, ) error
DownloadArtifacts - performs all the logic to implement the `galasactl runs download` command, but in a unit-testable manner.
func FinalHumanReadableReport ¶
FinalHumanReadableReport - Creates a human readable report of how it went.
func FormattableTestFromGalasaApi ¶
func FormattableTestFromGalasaApi(runs []galasaapi.Run, apiServerUrl string) []runsformatter.FormattableTest
func FormattableTestFromTestRun ¶
func FormattableTestFromTestRun(finishedMap map[string]*TestRun, lostMap map[string]*TestRun) []runsformatter.FormattableTest
func GetArtifactPathsFromRestApi ¶
Retrieves the paths of all artifacts for a given test run using its runId.
func GetFileFromRestApi ¶
func GetFileFromRestApi(runId string, artifactPath string, apiClient *galasaapi.APIClient) (io.Reader, bool, *http.Response, error)
GetFileFromRestApi Retrieves an artifact for a given test run using its runId from the ecosystem API. Note: The call leaves closing the http request as a responsibility of the caller.
func GetFormatterNamesString ¶
func GetFormatterNamesString(validFormatters map[string]runsformatter.RunsFormatter) string
GetFormatterNamesString builds a string of comma separated, quoted formatter names
func GetRuns ¶
func GetRuns( runName string, age string, requestorParameter string, resultParameter string, shouldGetActive bool, outputFormatString string, timeService utils.TimeService, console utils.Console, apiServerUrl string, apiClient *galasaapi.APIClient, ) error
GetRuns - performs all the logic to implement the `galasactl runs get` command, but in a unit-testable manner.
func GetRunsFromRestApi ¶
func GetRunsFromRestApi( runName string, requestorParameter string, resultParameter string, fromAgeMins int, toAgeMins int, shouldGetActive bool, timeService utils.TimeService, apiClient *galasaapi.APIClient, ) ([]galasaapi.Run, error)
Retrieves test runs from the ecosystem API that match a given runName. Multiple test runs can be returned as the runName is not unique.
func GetTimeUnitsForErrorMessage ¶
func GetTimeUnitsForErrorMessage() string
func GetTimeUnitsMap ¶
func InterrimProgressReport ¶
func NewTestSelectionFlagValues ¶
func NewTestSelectionFlagValues() *utils.TestSelectionFlagValues
func ReportJSON ¶
func ReportJunit ¶
func ReportYaml ¶
func TransferContent ¶
Writes the contents of a given source file into a given target file using a buffer to read and write the contents in chunks.
func ValidateResultParameter ¶
func ValidateRunName ¶
ValidateRunName - Checks that a run name is valid, as much as we can. Returns an error if it's invalid, nil if it looks valid. This function does not consult with an ecosystem, just checks the format of the runName.
func ValidateStream ¶
func WriteArtifactToFileSystem ¶
func WriteArtifactToFileSystem( fileSystem files.FileSystem, targetFilePath string, artifactPath string, fileDownloaded io.Reader, shouldOverwrite bool, console utils.Console) error
Writes an artifact to the host's file system, creating a new directory for the run's artifacts to be written to. Existing files are only overwritten if the --force option is used as part of the "runs download" command.
func WritePortfolio ¶
func WritePortfolio(fileSystem files.FileSystem, filename string, portfolio *Portfolio) error
Types ¶
type JunitFailure ¶
type JunitTestCase ¶
type JunitTestCase struct { ID string `xml:"id,attr"` Name string `xml:"name,attr"` Time int `xml:"time,attr"` Failure *JunitFailure `xml:"failure"` }
type JunitTestSuite ¶
type JunitTestSuites ¶
type ObrBasedValidator ¶
type ObrBasedValidator struct { }
func (*ObrBasedValidator) Validate ¶
func (*ObrBasedValidator) Validate(flags *utils.TestSelectionFlagValues) error
type Portfolio ¶
type Portfolio struct { APIVersion string `yaml:"apiVersion"` Kind string `yaml:"kind"` Metadata PortfolioMetadata `yaml:"metadata"` Classes []PortfolioClass `yaml:"classes"` }
func NewPortfolio ¶
func NewPortfolio() *Portfolio
func ReadPortfolio ¶
func ReadPortfolio(fileSystem files.FileSystem, filename string) (*Portfolio, error)
type PortfolioClass ¶
type PortfolioMetadata ¶
type PortfolioMetadata struct {
Name string `yaml:"name"`
}
type StreamBasedValidator ¶
type StreamBasedValidator struct { }
func (*StreamBasedValidator) Validate ¶
func (*StreamBasedValidator) Validate(flags *utils.TestSelectionFlagValues) error
type Submitter ¶
type Submitter struct {
// contains filtered or unexported fields
}
func NewSubmitter ¶
func NewSubmitter( galasaHome utils.GalasaHome, fileSystem files.FileSystem, launcher launcher.Launcher, timeService utils.TimeService, env utils.Environment, console utils.Console, expander images.ImageExpander, ) *Submitter
func (*Submitter) ExecuteSubmitRuns ¶
func (submitter *Submitter) ExecuteSubmitRuns( params *utils.RunsSubmitCmdValues, TestSelectionFlagValues *utils.TestSelectionFlagValues, ) error
func (*Submitter) GetCurrentUserName ¶
type TestMethod ¶
type TestReport ¶
type TestReport struct {
Tests []TestRun `yaml:"tests" json:"tests"`
}
type TestRun ¶
type TestRun struct { Name string `yaml:"name" json:"name"` Bundle string `yaml:"bundle" json:"bundle"` Class string `yaml:"class" json:"class"` Stream string `yaml:"stream" json:"stream"` Obr string `yaml:"obr" json:"obr"` Status string `yaml:"status" json:"status"` QueuedTimeUTC string `yaml:"queued" json:"queued"` Requestor string `yaml:"requestor" json:"requestor"` Result string `yaml:"result" json:"result"` Overrides map[string]string `yaml:"overrides" json:"overrides"` Tests []TestMethod `yaml:"tests" json:"tests"` GherkinUrl string `yaml:"gherkin"` GherkinFeature string `yaml:"feature"` }
type TestSelection ¶
type TestSelection struct {
Classes []TestClass
}
func SelectTests ¶
func SelectTests(launcherInstance launcher.Launcher, flags *utils.TestSelectionFlagValues) (TestSelection, error)
type TestSelectionFlagValidator ¶
type TestSelectionFlagValidator interface {
Validate(flags *utils.TestSelectionFlagValues) error
}
func NewObrBasedValidator ¶
func NewObrBasedValidator() TestSelectionFlagValidator
func NewStreamBasedValidator ¶
func NewStreamBasedValidator() TestSelectionFlagValidator
type TimeUnit ¶
type TimeUnit struct {
// contains filtered or unexported fields
}
func GetTimeUnitsOrderedList ¶
func GetTimeUnitsOrderedList() []*TimeUnit