data

package
v0.0.0-...-6abc620 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 17 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

	////////////////////
	// PerformanceResult
	////////////////////
	// FindPerformanceResultById returns the performance result with the
	// given id.
	FindPerformanceResultById(context.Context, string) (*model.APIPerformanceResult, error)
	// RemovePerformanceResultById removes the performance result with the
	// given ID and its children.
	RemovePerformanceResultById(context.Context, string) (int, error)
	// FindPerformanceResults returns all performance results that match the
	// given options.
	FindPerformanceResults(context.Context, PerformanceOptions) ([]model.APIPerformanceResult, error)
	// FindPerformanceResultWithChildren returns the the performance result
	// with the given ID and its children up to the given depth and
	// filtered by the optional tags.
	FindPerformanceResultWithChildren(context.Context, string, int, ...string) ([]model.APIPerformanceResult, error)
	// ScheduleSignalProcessingRecalculateJobs returns once a signal
	// processing recalculation job has been scheduled for each type of
	// test (project/variant/task/test combo).
	ScheduleSignalProcessingRecalculateJobs(context.Context) error

	//////////////////
	// 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) FindPerformanceResultById

func (dbc *DBConnector) FindPerformanceResultById(ctx context.Context, id string) (*dataModel.APIPerformanceResult, error)

FindPerformanceResultById queries the DB to find the performance result with the given ID.

func (*DBConnector) FindPerformanceResultWithChildren

func (dbc *DBConnector) FindPerformanceResultWithChildren(ctx context.Context, id string, maxDepth int, tags ...string) ([]dataModel.APIPerformanceResult, error)

FindPerformanceResultWithChildren queries the DB to find a performance result with the given ID and its children up to maxDepth and filtered by tags. If maxDepth is less than 0, the child search is exhaustive.

func (*DBConnector) FindPerformanceResults

func (dbc *DBConnector) FindPerformanceResults(ctx context.Context, opts PerformanceOptions) ([]dataModel.APIPerformanceResult, error)

FindPerformanceResults queries the DB to find all performance results that match the given options. If querying by task name, results are sorted (descending) by the Evergreen order.

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

func (*DBConnector) RemovePerformanceResultById

func (dbc *DBConnector) RemovePerformanceResultById(ctx context.Context, id string) (int, error)

RemovePerformanceResultById removes the performance result with the given ID from the DB. Note that this function deletes all children. No error is returned if the ID does not exist.

func (*DBConnector) ScheduleSignalProcessingRecalculateJobs

func (dbc *DBConnector) ScheduleSignalProcessingRecalculateJobs(ctx context.Context) error

ScheduleSignalProcessingRecalculateJobs schedules signal processing recalculation jobs for each project/version/task/test/args combination.

type MockConnector

type MockConnector struct {
	CachedPerformanceResults map[string]model.PerformanceResult
	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) FindPerformanceResultById

func (mc *MockConnector) FindPerformanceResultById(_ context.Context, id string) (*dataModel.APIPerformanceResult, error)

FindPerformanceResultById queries the mock cache to find the performance result with the given ID.

func (*MockConnector) FindPerformanceResultWithChildren

func (mc *MockConnector) FindPerformanceResultWithChildren(ctx context.Context, id string, maxDepth int, tags ...string) ([]dataModel.APIPerformanceResult, error)

FindPerformanceResultWithChildren queries the mock cache to find a performance result with the given ID and its children up to maxDepth and filtered by tags. If maxDepth is less than 0, the child search is exhaustive.

func (*MockConnector) FindPerformanceResults

func (mc *MockConnector) FindPerformanceResults(_ context.Context, opts PerformanceOptions) ([]dataModel.APIPerformanceResult, error)

FindPerformanceResults finds the performance results matching the given options.

func (*MockConnector) FindTestResultsStats

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

func (*MockConnector) GetBaseURL

func (mc *MockConnector) GetBaseURL() string

func (*MockConnector) RemovePerformanceResultById

func (mc *MockConnector) RemovePerformanceResultById(_ context.Context, id string) (int, error)

RemovePerformanceResultById removes the performance result with the given ID from the mock cache. Note that this function deletes all children. No error is returned if the ID does not exist.

func (*MockConnector) ScheduleSignalProcessingRecalculateJobs

func (mc *MockConnector) ScheduleSignalProcessingRecalculateJobs(ctx context.Context) error

ScheduleSignalProcessingRecalculateJobs schedules signal processing recalculation jobs for each project/version/task/test combination

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