testresult

package
v0.0.0-...-5f5e9cb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 10 Imported by: 28

Documentation

Overview

Package testresult models test results, which are posted by tasks during execution.

Index

Constants

View Source
const (
	SortByStartKey      = "start"
	SortByDurationKey   = "duration"
	SortByTestNameKey   = "test_name"
	SortByStatusKey     = "status"
	SortByBaseStatusKey = "base_status"
)

Valid sort by keys.

View Source
const (
	Collection = "test_results"
)

Variables

View Source
var (
	IdKey                           = bsonutil.MustHaveTag(DbTaskTestResults{}, "ID")
	StatsKey                        = bsonutil.MustHaveTag(DbTaskTestResults{}, "Stats")
	TotalCountKey                   = bsonutil.MustHaveTag(TaskTestResultsStats{}, "TotalCount")
	FailedCountKey                  = bsonutil.MustHaveTag(TaskTestResultsStats{}, "FailedCount")
	TestResultsInfoKey              = bsonutil.MustHaveTag(DbTaskTestResults{}, "Info")
	TestResultsFailedTestsSampleKey = bsonutil.MustHaveTag(DbTaskTestResults{}, "FailedTestsSample")
	TestResultsInfoTaskIDKey        = bsonutil.MustHaveTag(TestResultsInfo{}, "TaskID")
	TestResultsInfoExecutionKey     = bsonutil.MustHaveTag(TestResultsInfo{}, "Execution")
)

Functions

func PartitionKey

func PartitionKey(createdAt time.Time, project string, id string) string

PartitionKey returns the partition key for the S3 bucket in Presto.

Types

type DbTaskTestResults

type DbTaskTestResults struct {
	ID          string               `bson:"_id"`
	Stats       TaskTestResultsStats `bson:"stats"`
	Info        TestResultsInfo      `bson:"info"`
	CreatedAt   time.Time            `bson:"created_at"`
	CompletedAt time.Time            `bson:"completed_at"`
	// FailedTestsSample is the first X failing tests of the test Results.
	// This is an optimization for Evergreen's UI features that display a
	// limited number of failing tests for a task.
	FailedTestsSample []string     `bson:"failed_tests_sample"`
	Results           []TestResult `bson:"-"`
}

type ParquetTestResult

type ParquetTestResult struct {
	TestName        string       `parquet:"name=test_name"`
	DisplayTestName *string      `parquet:"name=display_test_name"`
	GroupID         *string      `parquet:"name=group_id"`
	Status          string       `parquet:"name=status"`
	LogInfo         *TestLogInfo `parquet:"name=log_info"`
	TaskCreateTime  time.Time    `parquet:"name=task_create_time, timeunit=MILLIS"`
	TestStartTime   time.Time    `parquet:"name=test_start_time, timeunit=MILLIS"`
	TestEndTime     time.Time    `parquet:"name=test_end_time, timeunit=MILLIS"`

	// Legacy test log fields.
	LogTestName *string `parquet:"name=log_test_name"`
	LogURL      *string `parquet:"name=log_url"`
	RawLogURL   *string `parquet:"name=raw_log_url"`
	LineNum     *int32  `parquet:"name=line_num"`
}

ParquetTestResult describes a single test result to be stored in Apache Parquet file format.

type ParquetTestResults

type ParquetTestResults struct {
	Version         string              `parquet:"name=version"`
	Variant         string              `parquet:"name=variant"`
	TaskName        string              `parquet:"name=task_name"`
	DisplayTaskName *string             `parquet:"name=display_task_name"`
	TaskID          string              `parquet:"name=task_id"`
	DisplayTaskID   *string             `parquet:"name=display_task_id"`
	Execution       int32               `parquet:"name=execution"`
	Requester       string              `parquet:"name=request_type"`
	CreatedAt       time.Time           `parquet:"name=created_at, timeunit=MILLIS"`
	Results         []ParquetTestResult `parquet:"name=results"`
}

ParquetTestResults describes a set of test results from a task execution to be stored in Apache Parquet format.

func (ParquetTestResults) ConvertToTestResultSlice

func (r ParquetTestResults) ConvertToTestResultSlice() []TestResult

type SortBy

type SortBy struct {
	Key      string
	OrderDSC bool
}

SortBy describes the properties by which to sort a set of test results.

type TaskTestResults

type TaskTestResults struct {
	Stats   TaskTestResultsStats `json:"stats"`
	Results []TestResult         `json:"results"`
}

TaskTestResults represents a set of test results. These results may come from a single task run or multiple related task runs, such as execution tasks within a display task.

type TaskTestResultsFailedSample

type TaskTestResultsFailedSample struct {
	TaskID                  string   `json:"task_id"`
	Execution               int      `json:"execution"`
	MatchingFailedTestNames []string `json:"matching_failed_test_names"`
	TotalFailedNames        int      `json:"total_failed_names"`
}

TaskTestResultsFailedSample represents a sample of failed test names from an Evergreen task run.

type TaskTestResultsStats

type TaskTestResultsStats struct {
	TotalCount    int  `json:"total_count" bson:"total_count"`
	FailedCount   int  `json:"failed_count" bson:"failed_count"`
	FilteredCount *int `json:"filtered_count" bson:"-"`
}

TaskTestResultsStats represents basic statistics of a set of test results.

type TestLogInfo

type TestLogInfo struct {
	LogName       string    `json:"log_name" bson:"log_name" parquet:"name=logname"`
	LogsToMerge   []*string `json:"logs_to_merge" bson:"logs_to_merge" parquet:"name=logstomerge"`
	LineNum       int32     `json:"line_num" bson:"line_num" parquet:"name=linenum"`
	RenderingType *string   `json:"rendering_type" bson:"rendering_type" parquet:"name=renderingtype"`
	Version       int32     `json:"version" bson:"version"`
	// TODO: DEVPROD-19170 remove these fields
	// The following are deprecated fields used for tasks that wrote test results
	// through Cedar. These tasks wrote using custom parquet tags that included underscores.
	// Tasks that wrote test results directly to Evergreen will use the tags above that don't
	// contain any underscores, since when the evergreen test result service first launched
	// the fields above didn't contain parquet tags and hence defaulted to tag names with no underscores
	// because of how the parquet-go library automatically resolves tag names. Both fields are now
	// required to support backwards compatibility.
	LogNameCedar       string    `parquet:"name=log_name"`
	LogsToMergeCedar   []*string `parquet:"name=logs_to_merge"`
	LineNumCedar       int32     `parquet:"name=line_num"`
	RenderingTypeCedar *string   `parquet:"name=rendering_type"`
}

TestLogInfo describes a metadata for a test result's log stored using Evergreen logging.

type TestResult

type TestResult struct {
	TaskID          string       `json:"task_id" bson:"task_id"`
	Execution       int          `json:"execution" bson:"execution"`
	TestName        string       `json:"test_name" bson:"test_name"`
	GroupID         string       `json:"group_id" bson:"group_id"`
	DisplayTestName string       `json:"display_test_name" bson:"display_test_name"`
	Status          string       `json:"status" bson:"status"`
	BaseStatus      string       `json:"base_status" bson:"base_status"`
	LogInfo         *TestLogInfo `json:"log_info" bson:"log_info"`
	TestStartTime   time.Time    `json:"test_start_time" bson:"test_start_time"`
	TaskCreateTime  time.Time    `json:"task_create_time" bson:"task_create_time"`
	TestEndTime     time.Time    `json:"test_end_time" bson:"test_end_time"`

	// Legacy test log fields.
	LogTestName string `json:"log_test_name" bson:"log_test_name"`
	LogURL      string `json:"log_url" bson:"log_url"`
	RawLogURL   string `json:"raw_log_url" bson:"raw_log_url"`
	LineNum     int    `json:"line_num" bson:"line_num"`
}

TestResult represents a single test result from an Evergreen task run.

func (TestResult) Duration

func (tr TestResult) Duration() time.Duration

Duration returns the duration of the test.

func (TestResult) GetDisplayTestName

func (tr TestResult) GetDisplayTestName() string

GetDisplayTestName returns the name of the test that should be displayed in the UI. In most cases, this will just be TestName.

func (TestResult) GetLogTestName

func (tr TestResult) GetLogTestName() string

GetLogTestName returns the name of the test in the logging backend. This is used for test logs where the name of the test in the logging service may differ from that in the test results service.

func (TestResult) GetLogURL

func (tr TestResult) GetLogURL(env evergreen.Environment, viewer evergreen.LogViewer) string

GetLogURL returns the external or internal log URL for this test result.

It is not advisable to set URL or URLRaw with the output of this function as those fields are reserved for external logs and used to determine URL generation for other log viewers.

type TestResultsInfo

type TestResultsInfo struct {
	Project         string `bson:"project" json:"project" yaml:"project"`
	Version         string `bson:"version" json:"version" yaml:"version"`
	Variant         string `bson:"variant" json:"variant" yaml:"variant"`
	TaskName        string `bson:"task_name" json:"task_name" yaml:"task_name"`
	DisplayTaskName string `bson:"display_task_name,omitempty" json:"display_task_name" yaml:"display_task_name"`
	TaskID          string `bson:"task_id" json:"task_id" yaml:"task_id"`
	DisplayTaskID   string `bson:"display_task_id,omitempty" json:"display_task_id" yaml:"display_task_id"`
	Execution       int    `bson:"execution" json:"execution" yaml:"execution"`
	Requester       string `bson:"request_type" json:"request_type" yaml:"request_type"`
	Mainline        bool   `bson:"mainline" json:"mainline" yaml:"mainline"`
	Schema          int    `bson:"schema" json:"schema" yaml:"schema"`
}

TestResultsInfo describes information unique to a single task execution.

func (*TestResultsInfo) ID

func (t *TestResultsInfo) ID() string

ID creates a unique hash for a TestResultsInfo.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL