Documentation
¶
Index ¶
- Constants
- Variables
- func LogAggregateReports(logger *log.Logger, reports []AggregateReport)
- func LogMetadataEntries(logger *log.Logger, metadata []MetadataEntry)
- func LogUploadSummary(logger *log.Logger, uploadedCount int, reports []AggregateReport)
- func RenderEmbeddedTemplate(path string, data any) (buf bytes.Buffer, err error)
- func RenderLocalTemplate(path string, data any) (buf bytes.Buffer, err error)
- func UploadAggregateReports(reports []AggregateReport, metadata []MetadataEntry, config Config, ...) error
- func UploadSingleAggregateReport(report AggregateReport, metadata []MetadataEntry, config Config, token string) error
- type AggregateReport
- type Config
- type ConfigSpec
- type Counts
- type IssueDesiredStateFields
- type JiraClient
- type JiraConfig
- type JiraIssue
- type JiraIssueDesiredStateConditionalConfig
- type JiraIssueDesiredStateConfig
- type JiraIssueDesiredStateDescriptionConfig
- type JiraIssueDesiredStateSummaryConfig
- type JiraIssueDiscoveryConfig
- type JiraIssueDiscoveryLabelsConfig
- type JiraIssueDiscoverySummaryConfig
- type JiraServerConfig
- type MetadataEntry
- type ReportingConfig
- type ReportingRouteConfig
- type ReportingTestCaseConfig
- type ReportingTestSuiteConfig
- type TestSuite
Constants ¶
const MatchAllSymbol = "*"
MatchAllSymbol defines which symbol will be used to represent a rule that accepts any string as input.
Variables ¶
var ( InfoLog = log.New(os.Stdout, "[INFO] ", logFlags) WarnLog = log.New(os.Stdout, "[WARN] ", logFlags) ErrorLog = log.New(os.Stderr, "[ERROR] ", logFlags) )
var EmbeddedDefaultConfig []byte
var EmbeddedTemplatesFS embed.FS
Functions ¶
func LogAggregateReports ¶
func LogAggregateReports(logger *log.Logger, reports []AggregateReport)
LogAggregateReports dumps the AggregateReports in a human-readable form to a given logger.
func LogMetadataEntries ¶ added in v0.1.5
func LogMetadataEntries(logger *log.Logger, metadata []MetadataEntry)
LogMetadataEntries pretty-prints all system and user-provided metadata entries using a given logger.
func LogUploadSummary ¶
func LogUploadSummary(logger *log.Logger, uploadedCount int, reports []AggregateReport)
LogUploadSummary logs a simple summary message displaying how many AggregateReports were successfully uploaded.
func RenderEmbeddedTemplate ¶
func RenderLocalTemplate ¶
func UploadAggregateReports ¶
func UploadAggregateReports(reports []AggregateReport, metadata []MetadataEntry, config Config, token string) error
UploadAggregateReports takes multiple AggregateReports and uploads them all to their corresponding destinations.
func UploadSingleAggregateReport ¶
func UploadSingleAggregateReport(report AggregateReport, metadata []MetadataEntry, config Config, token string) error
UploadSingleAggregateReport uploads a given AggregateReport to its destination.
Types ¶
type AggregateReport ¶
AggregateReport stores information about all Test Suites and Test Cases that should be reported to a selected Jira Issue (Destination).
func ProcessJUnitReports ¶
func ProcessJUnitReports(paths []string, config ReportingConfig) (reports []AggregateReport, err error)
ProcessJUnitReports loads and analyzes JUnit Test Reports according to the routing config defined by the user.
func ProcessJUnitSuites ¶
func ProcessJUnitSuites(suites []junit.Suite, route ReportingRouteConfig) (report AggregateReport)
ProcessJUnitSuites processes all loaded Test Suites according to a given routing configuration. A single AggregateReport will be created for each route defined by the user. If any Test Suites or Test Cases match any of the rules defined for this route, they will be added to the Report.
func (*AggregateReport) AggregateCounts ¶
func (r *AggregateReport) AggregateCounts()
AggregateCounts takes all Test Suites contained in the report and calculates the total sum on all Counters.
type Config ¶
type Config struct {
APIVersion string `mapstructure:"apiVersion"`
Spec ConfigSpec `mapstructure:"spec"`
}
type ConfigSpec ¶
type ConfigSpec struct {
Jira JiraConfig `mapstructure:"jira"`
Reporting ReportingConfig `mapstructure:"reporting"`
}
type IssueDesiredStateFields ¶
IssueDesiredStateFields stores values that are expected to be sent to Jira in order for the Jira Issue to reach the desired state.
type JiraClient ¶
JiraClient manages communication with the Jira REST API.
func (JiraClient) CreateSubtask ¶
func (c JiraClient) CreateSubtask(parent string, summary string, description string, labels []string) (string, error)
CreateSubtask sends a request to create a Sub-task under a given parent Issue.
func (JiraClient) GetIssue ¶
func (c JiraClient) GetIssue(id string) (issue JiraIssue, err error)
GetIssue sends a request to Jira REST API to fetch an Issue with the given ID.
func (JiraClient) UpdateIssue ¶
func (c JiraClient) UpdateIssue(id string, summary string, description string, labels []string) error
UpdateIssue sends a request to Jira REST API to update an Issue with the given ID.
type JiraConfig ¶
type JiraConfig struct {
Server JiraServerConfig `mapstructure:"server"`
Discovery JiraIssueDiscoveryConfig `mapstructure:"discovery"`
DesiredState JiraIssueDesiredStateConfig `mapstructure:"desiredState"`
}
type JiraIssue ¶
type JiraIssue struct {
ID string
Type string
Parent *JiraIssue
Summary string
Description string
Labels []string
SubTasks []*JiraIssue
}
JiraIssue represents an Issue as returned by the Jira REST API.
func (*JiraIssue) IsLabeledWithAnyOf ¶
IsLabeledWithAnyOf provides a convenience method to check whether the Jira Issue is labeled with at least one of the labels given by the user.
type JiraIssueDesiredStateConditionalConfig ¶
type JiraIssueDesiredStateConditionalConfig struct {
Labels []string `mapstructure:"labels"`
}
type JiraIssueDesiredStateConfig ¶
type JiraIssueDesiredStateConfig struct {
Summary JiraIssueDesiredStateSummaryConfig `mapstructure:"summary"`
Description JiraIssueDesiredStateDescriptionConfig `mapstructure:"description"`
OnSuccess JiraIssueDesiredStateConditionalConfig `mapstructure:"onSuccess"`
OnFailure JiraIssueDesiredStateConditionalConfig `mapstructure:"onFailure"`
}
type JiraIssueDesiredStateDescriptionConfig ¶
type JiraIssueDesiredStateDescriptionConfig struct {
TemplatePath string `mapstructure:"templatePath"`
}
type JiraIssueDiscoveryConfig ¶
type JiraIssueDiscoveryConfig struct {
Summary JiraIssueDiscoverySummaryConfig `mapstructure:"summary"`
Labels JiraIssueDiscoveryLabelsConfig `mapstructure:"labels"`
}
type JiraIssueDiscoveryLabelsConfig ¶
type JiraIssueDiscoveryLabelsConfig struct {
RequiredAnyOf []string `mapstructure:"requiredAnyOf"`
}
type JiraIssueDiscoverySummaryConfig ¶
type JiraIssueDiscoverySummaryConfig struct {
RequiredPrefix string `mapstructure:"requiredPrefix"`
}
type JiraServerConfig ¶
type JiraServerConfig struct {
URL string `mapstructure:"url"`
}
type MetadataEntry ¶ added in v0.1.5
MetadataEntry represents a single key-value pair of metadata set by the user.
type ReportingConfig ¶
type ReportingConfig struct {
Routing []ReportingRouteConfig `mapstructure:"routing"`
}
type ReportingRouteConfig ¶
type ReportingRouteConfig struct {
Destination string `mapstructure:"destination"`
TestSuites []ReportingTestSuiteConfig `mapstructure:"testSuites"`
}
type ReportingTestCaseConfig ¶
type ReportingTestSuiteConfig ¶
type ReportingTestSuiteConfig struct {
Name string `mapstructure:"name"`
Property string `mapstructure:"property"`
TestCases []ReportingTestCaseConfig `mapstructure:"testCases"`
}