data

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

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildloggerOptions

type BuildloggerOptions struct {
	ID             string
	TaskID         string
	TestName       string
	EmptyTestName  bool
	Execution      int
	EmptyExecution bool
	ProcessName    string
	Group          string
	Tags           []string
	TimeRange      dbModel.TimeRange
	PrintTime      bool
	PrintPriority  bool
	Limit          int
	Tail           int
	SoftSizeLimit  int
}

BuildloggerOptions contains arguments for buildlogger related Connector functions.

type Connector

type Connector interface {
	// GetBaseURL returns the API service URL.
	GetBaseURL() string

	//////////////////
	// Buildlogger Log
	//////////////////
	// FindLogById returns the buildlogger log with the given ID. The time
	// returned is the next timestamp for pagination and the bool indicates
	// whether the log is paginated or not. If the log is not paginated,
	// the timestamp should be ignored.
	// ID, PrintTime, PrintPriority, TimeRange, Limit, and SoftSizeLimit
	// are respected from BuildloggerOptions.
	FindLogByID(context.Context, BuildloggerOptions) ([]byte, time.Time, bool, error)
	// FindLogMetadataByID returns the metadata for the buildlogger log
	// with the given ID.
	FindLogMetadataByID(context.Context, string) (*model.APILog, error)
	// FindLogsByTaskID returns the buildlogger logs with the given task
	// id. The time returned is the next timestamp for pagination and the
	// bool indicates whether the logs are paginated or not. If the logs
	// are not paginated, the timestamp should be ignored.
	// TaskID, ProcessName, Execution, Tags, TimeRange, PrintTime,
	// PrintPriority, Limit, Tail, and SoftSizeLimit are respected from
	// BuildloggerOptions.
	FindLogsByTaskID(context.Context, BuildloggerOptions) ([]byte, time.Time, bool, error)
	// FindLogsByTaskID returns the metadata for the buildlogger logs with
	// the given task ID and tags.
	FindLogMetadataByTaskID(context.Context, BuildloggerOptions) ([]model.APILog, error)
	// FindLogsByTestName returns the buildlogger logs with the given task
	// ID and test name. The time returned is the next timestamp for
	// pagination and the bool indicates whether the logs are paginated
	// or not. If the logs are not paginated, the timestamp should be
	// ignored.
	// TaskID, TestName, ProcessName, Execution, Tags, TimeRange,
	// PrintTime, PrintPriority, Limit, and SoftSizeLimit are respected
	// from BuildloggerOptions.
	FindLogsByTestName(context.Context, BuildloggerOptions) ([]byte, time.Time, bool, error)
	// FindLogsByTestName returns the metadata for the buildlogger logs
	// with the given task ID, test name, and tags.
	FindLogMetadataByTestName(context.Context, BuildloggerOptions) ([]model.APILog, error)
	// FindGroupedLogs finds logs that are grouped via a "group id" held in
	// the tags field. These groups have a hierarchy of test level and task
	// level. This function returns logs with the given task ID and group
	// id. The time returned is the next timestamp for pagination and the
	// bool indicates whether the logs are paginated or not. If the logs
	// are not paginated, the timestamp should be ignored.
	// TaskID, TestName, Execution, Tags, TimeRange, PrintTime,
	// PrintPriority, Limit, and SoftSizeLimit are respected from
	// BuildloggerOptions.
	FindGroupedLogs(context.Context, BuildloggerOptions) ([]byte, time.Time, bool, error)

	///////////////
	// Test Results
	///////////////
	// FindTestResults returns the merged test results of the given tasks
	// and optional filter, sort, and pagination options.
	FindTestResults(context.Context, []TestResultsTaskOptions, *TestResultsFilterAndSortOptions) (*model.APITestResults, error)
	// FindTestResultsStats returns basic aggregated stats of test results
	// results for the given tasks.
	FindTestResultsStats(context.Context, []TestResultsTaskOptions) (*model.APITestResultsStats, error)
	// FindTestResultsSample returns a merged list of the failed test
	// results samples for the given tasks.
	FindFailedTestResultsSample(context.Context, []TestResultsTaskOptions) ([]string, error)
	// FindFailedTestResultsSamples returns failed test result samples for
	// the given tasks and optional regex filters.
	FindFailedTestResultsSamples(context.Context, []TestResultsTaskOptions, []string) ([]model.APITestResultsSample, error)
}

Connector abstracts the link between cedar's service and API layers, allowing for changes in the service architecture without forcing changes to the API.

func CreateNewDBConnector

func CreateNewDBConnector(env cedar.Environment, baseURL string) Connector

CreateNewDBConnector is the entry point for creating a new Connector backed by DBConnector.

type DBConnector

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

DBConnector is a struct that implements the Connector interface backed by the service layer of Cedar.

func (*DBConnector) FindFailedTestResultsSample

func (dbc *DBConnector) FindFailedTestResultsSample(ctx context.Context, opts []TestResultsTaskOptions) ([]string, error)

func (*DBConnector) FindFailedTestResultsSamples

func (dbc *DBConnector) FindFailedTestResultsSamples(ctx context.Context, taskOpts []TestResultsTaskOptions, regexFilters []string) ([]model.APITestResultsSample, error)

func (*DBConnector) FindGroupedLogs

func (dbc *DBConnector) FindGroupedLogs(ctx context.Context, opts BuildloggerOptions) ([]byte, time.Time, bool, error)

func (*DBConnector) FindLogByID

func (dbc *DBConnector) FindLogByID(ctx context.Context, opts BuildloggerOptions) ([]byte, time.Time, bool, error)

func (*DBConnector) FindLogMetadataByID

func (dbc *DBConnector) FindLogMetadataByID(ctx context.Context, id string) (*model.APILog, error)

func (*DBConnector) FindLogMetadataByTaskID

func (dbc *DBConnector) FindLogMetadataByTaskID(ctx context.Context, opts BuildloggerOptions) ([]model.APILog, error)

func (*DBConnector) FindLogMetadataByTestName

func (dbc *DBConnector) FindLogMetadataByTestName(ctx context.Context, opts BuildloggerOptions) ([]model.APILog, error)

func (*DBConnector) FindLogsByTaskID

func (dbc *DBConnector) FindLogsByTaskID(ctx context.Context, opts BuildloggerOptions) ([]byte, time.Time, bool, error)

func (*DBConnector) FindLogsByTestName

func (dbc *DBConnector) FindLogsByTestName(ctx context.Context, opts BuildloggerOptions) ([]byte, time.Time, bool, error)

func (*DBConnector) FindTestResults

func (dbc *DBConnector) FindTestResults(ctx context.Context, taskOpts []TestResultsTaskOptions, filterOpts *TestResultsFilterAndSortOptions) (*model.APITestResults, error)

func (*DBConnector) FindTestResultsStats

func (dbc *DBConnector) FindTestResultsStats(ctx context.Context, opts []TestResultsTaskOptions) (*model.APITestResultsStats, error)

func (*DBConnector) GetBaseURL

func (dbc *DBConnector) GetBaseURL() string

type MockConnector

type MockConnector struct {
	ChildMap   map[string][]string
	CachedLogs map[string]model.Log
	Users      map[string]bool
	Bucket     string
	// contains filtered or unexported fields
}

MockConnector is a struct that implements the Connector interface backed by a mock Cedar service layer.

func (*MockConnector) FindFailedTestResultsSample

func (mc *MockConnector) FindFailedTestResultsSample(ctx context.Context, _ []TestResultsTaskOptions) ([]string, error)

func (*MockConnector) FindFailedTestResultsSamples

func (mc *MockConnector) FindFailedTestResultsSamples(ctx context.Context, _ []TestResultsTaskOptions, _ []string) ([]model.APITestResultsSample, error)

func (*MockConnector) FindGroupedLogs

func (mc *MockConnector) FindGroupedLogs(ctx context.Context, opts BuildloggerOptions) ([]byte, time.Time, bool, error)

func (*MockConnector) FindLogByID

func (mc *MockConnector) FindLogByID(ctx context.Context, opts BuildloggerOptions) ([]byte, time.Time, bool, error)

func (*MockConnector) FindLogMetadataByID

func (mc *MockConnector) FindLogMetadataByID(ctx context.Context, id string) (*model.APILog, error)

func (*MockConnector) FindLogMetadataByTaskID

func (mc *MockConnector) FindLogMetadataByTaskID(ctx context.Context, opts BuildloggerOptions) ([]model.APILog, error)

func (*MockConnector) FindLogMetadataByTestName

func (mc *MockConnector) FindLogMetadataByTestName(ctx context.Context, opts BuildloggerOptions) ([]model.APILog, error)

func (*MockConnector) FindLogsByTaskID

func (mc *MockConnector) FindLogsByTaskID(ctx context.Context, opts BuildloggerOptions) ([]byte, time.Time, bool, error)

func (*MockConnector) FindLogsByTestName

func (mc *MockConnector) FindLogsByTestName(ctx context.Context, opts BuildloggerOptions) ([]byte, time.Time, bool, error)

func (*MockConnector) FindTestResultsStats

func (mc *MockConnector) FindTestResultsStats(_ context.Context, _ []TestResultsTaskOptions) (*model.APITestResultsStats, error)

func (*MockConnector) GetBaseURL

func (mc *MockConnector) GetBaseURL() string

type PerformanceOptions

type PerformanceOptions struct {
	Project   string
	Version   string
	Variant   string
	TaskID    string
	Execution int
	TaskName  string
	Tags      []string
	Interval  dbModel.TimeRange
	Limit     int
	Skip      int
}

PerformanceOptions holds all values required to find a specific PerformanceResult or PerformanceResults using connector functions.

type TestResultsFilterAndSortOptions

type TestResultsFilterAndSortOptions struct {
	TestName            string                   `json:"test_name"`
	ExcludeDisplayNames bool                     `json:"exclude_display_names"`
	Statuses            []string                 `json:"statuses"`
	GroupID             string                   `json:"group_id"`
	Sort                []TestResultsSortBy      `json:"sort"`
	Limit               int                      `json:"limit"`
	Page                int                      `json:"page"`
	BaseTasks           []TestResultsTaskOptions `json:"base_tasks"`

	// TODO (EVG-14306): Remove these two fields once Evergreen's GraphQL
	// service is no longer using them.
	SortBy       string `json:"sort_by"`
	SortOrderDSC bool   `json:"sort_order_dsc"`
}

TestResultsFilterAndSortOptions holds all values required for filtering, sorting, and paginating test results using the Connector functions.

type TestResultsSortBy

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

TestResultsSortBy describes the properties by which to sort a set of test results using the Connector functions.

type TestResultsTaskOptions

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

TestResultsTaskOptions specify the arguments for fetching test results by task using the Connector functions.

Jump to

Keyboard shortcuts

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