testresults

package
v0.0.0-...-9d66df0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	SortByStart      = "start"
	SortByDuration   = "duration"
	SortByTestName   = "test_name"
	SortByStatus     = "status"
	SortByBaseStatus = "base_status"
)

Valid sort by keys.

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context, opts GetOptions) ([]byte, int, error)

Get returns the test results requested via HTTP to a Cedar service along with the status code of the request.

func GetFailedSamples

func GetFailedSamples(ctx context.Context, opts GetFailedSampleOptions) ([]byte, error)

GetFailedSamples returns the failed samples requested via HTTP to a Cedar service.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides a wrapper around a gRPC client for sending test results to Cedar.

func NewClient

func NewClient(ctx context.Context, opts timber.ConnectionOptions) (*Client, error)

NewClient returns a Client to send test results to Cedar. If authentication credentials are not specified, then an insecure connection will be established with the specified address and port.

func NewClientWithExistingConnection

func NewClientWithExistingConnection(ctx context.Context, conn *grpc.ClientConn) (*Client, error)

NewClientWithExistingConnection returns a Client to send test results to Cedar using the given client connection. The given client connection's lifetime will not be managed by this client.

func (*Client) AddResults

func (c *Client) AddResults(ctx context.Context, r Results) error

AddResults adds a set of test results to the record.

func (*Client) CloseClient

func (c *Client) CloseClient() error

CloseClient closes the client connection if it was created via NewClient. If an existing connection was used to create the client, it will not be closed.

func (*Client) CloseRecord

func (c *Client) CloseRecord(ctx context.Context, id string) error

CloseRecord marks a record as completed.

func (*Client) CreateRecord

func (c *Client) CreateRecord(ctx context.Context, opts CreateOptions) (string, error)

CreateRecord creates a new metadata record in Cedar with the given options.

type CreateOptions

type CreateOptions 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"`
	TaskID          string `bson:"task_id" json:"task_id" yaml:"task_id"`
	TaskName        string `bson:"task_name" json:"task_name" yaml:"task_name"`
	DisplayTaskName string `bson:"display_task_name" json:"display_task_name" yaml:"display_task_name"`
	DisplayTaskID   string `bson:"display_task_id" json:"display_task_id" yaml:"display_task_id"`
	Execution       int32  `bson:"execution" json:"execution" yaml:"execution"`
	RequestType     string `bson:"request_type" json:"request_type" yaml:"request_type"`
	Mainline        bool   `bson:"mainline" json:"mainline" yaml:"mainline"`
}

CreateOptions represent options to create a new test results record.

type FailedTestSampleOptions

type FailedTestSampleOptions struct {
	Tasks        []TaskInfo `json:"tasks"`
	RegexFilters []string   `json:"regex_filters,omitempty"`
}

FailedTestSampleOptions specifies the tasks to get the sample for and regexes to filter the test names by.

type FilterOptions

type FilterOptions struct {
	TestName            string        `json:"test_name,omitempty"`
	ExcludeDisplayNames bool          `json:"exclude_display_names"`
	Statuses            []string      `json:"statuses,omitempty"`
	GroupID             string        `json:"group_id,omitempty"`
	Sort                []SortBy      `json:"sort"`
	Limit               int           `json:"limit,omitempty"`
	Page                int           `json:"page,omitempty"`
	BaseTasks           []TaskOptions `json:"base_tasks,omitempty"`
}

FilterOptions represent the parameters for filtering, sorting, and paginating test results. These options are only supported on select routes.

type GetFailedSampleOptions

type GetFailedSampleOptions struct {
	Cedar timber.GetOptions

	// Request information. See Cedar's REST documentation for more
	// information:
	// `https://github.com/evergreen-ci/cedar/wiki/Rest-V1-Usage`.
	SampleOptions FailedTestSampleOptions
}

GetFailedSampleOptions specify the required and optional information to create the failed test sample HTTP GET request to Cedar.

func (GetFailedSampleOptions) Validate

func (opts GetFailedSampleOptions) Validate() error

Validate ensures GetSampleOptions is configured correctly.

type GetOptions

type GetOptions struct {
	Cedar timber.GetOptions

	// Request information. See Cedar's REST documentation for more
	// information:
	// `https://github.com/evergreen-ci/cedar/wiki/Rest-V1-Usage`.
	Tasks        []TaskOptions
	Filter       *FilterOptions
	FailedSample bool
	Stats        bool
}

GetOptions specify the required and optional information to create the test results HTTP GET request to Cedar.

func (GetOptions) Validate

func (opts GetOptions) Validate() error

Validate ensures TestResultsGetOptions is configured correctly.

type LogInfo

type LogInfo struct {
	LogName       string
	LogsToMerge   []string
	LineNum       int32
	RenderingType *string
	Version       int32
}

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

type Result

type Result struct {
	TestName        string    `bson:"test_name" json:"test_name" yaml:"test_name"`
	DisplayTestName string    `bson:"display_test_name" json:"display_test_name" yaml:"display_test_name"`
	GroupID         string    `bson:"group_id" json:"group_id" yaml:"group_id"`
	Trial           int32     `bson:"trial" json:"trial" yaml:"trial"`
	Status          string    `bson:"status" json:"status" yaml:"status"`
	LogInfo         *LogInfo  `bson:"log_info" json:"log_info" yaml:"log_info"`
	TaskCreated     time.Time `bson:"task_created" json:"task_created" yaml:"task_created"`
	TestStarted     time.Time `bson:"test_started" json:"test_started" yaml:"test_started"`
	TestEnded       time.Time `bson:"test_ended" json:"test_ended" yaml:"test_ended"`

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

Result represents a single test result.

type Results

type Results struct {
	ID      string
	Results []Result
}

Results represent a set of test results.

type SortBy

type SortBy struct {
	Key      string `json:"key"`
	OrderDSC bool   `json:"order_dsc"`
}

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

type TaskInfo

type TaskInfo struct {
	TaskID      string `json:"task_id"`
	Execution   int    `json:"execution"`
	DisplayTask bool   `json:"display_task"`
}

TaskInfo specifies a set of test results to find.

type TaskOptions

type TaskOptions struct {
	TaskID    string `json:"task_id"`
	Execution int    `json:"execution"`
}

TaskOptions specify the information required to fetch test results by task.

Jump to

Keyboard shortcuts

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