testresult

package
v0.0.0-...-29e6843 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Collection is the name of the test results collection in the database.
	Collection = "testresults"
)

Variables

View Source
var (
	// BSON fields for the task struct
	IDKey        = bsonutil.MustHaveTag(TestResult{}, "ID")
	StatusKey    = bsonutil.MustHaveTag(TestResult{}, "Status")
	LineNumKey   = bsonutil.MustHaveTag(TestResult{}, "LineNum")
	TestFileKey  = bsonutil.MustHaveTag(TestResult{}, "TestFile")
	URLKey       = bsonutil.MustHaveTag(TestResult{}, "URL")
	LogIDKey     = bsonutil.MustHaveTag(TestResult{}, "LogID")
	URLRawKey    = bsonutil.MustHaveTag(TestResult{}, "URLRaw")
	ExitCodeKey  = bsonutil.MustHaveTag(TestResult{}, "ExitCode")
	StartTimeKey = bsonutil.MustHaveTag(TestResult{}, "StartTime")
	EndTimeKey   = bsonutil.MustHaveTag(TestResult{}, "EndTime")
	TaskIDKey    = bsonutil.MustHaveTag(TestResult{}, "TaskID")
	ExecutionKey = bsonutil.MustHaveTag(TestResult{}, "Execution")
)

Functions

func Aggregate

func Aggregate(pipeline []bson.M, results interface{}) error

Aggregate runs an aggregation against the testresults collection.

func ByTaskIDs

func ByTaskIDs(ids []string) db.Q

func InsertMany

func InsertMany(results []TestResult) error

func TestResultsQuery

func TestResultsQuery(taskId, testId, status string, limit, sort, execution int) db.Q

TestResultsQuery is a query for returning test results to the REST v2 API.

Types

type TestResult

type TestResult struct {
	ID        bson.ObjectId `bson:"_id,omitempty" json:"id"`
	Status    string        `json:"status" bson:"status"`
	TestFile  string        `json:"test_file" bson:"test_file"`
	URL       string        `json:"url" bson:"url,omitempty"`
	URLRaw    string        `json:"url_raw" bson:"url_raw,omitempty"`
	LogID     string        `json:"log_id,omitempty" bson:"log_id,omitempty"`
	LineNum   int           `json:"line_num,omitempty" bson:"line_num,omitempty"`
	ExitCode  int           `json:"exit_code" bson:"exit_code"`
	StartTime float64       `json:"start" bson:"start"`
	EndTime   float64       `json:"end" bson:"end"`

	// Together, TaskID and Execution identify the task which created this TestResult
	TaskID    string `bson:"task_id" json:"task_id"`
	Execution int    `bson:"task_execution" json:"task_execution"`

	// LogRaw is not persisted to the database
	LogRaw string `json:"log_raw" bson:"log_raw,omitempty"`
}

TestResult contains test data for a task.

func Find

func Find(query db.Q) ([]TestResult, error)

find returns all test results that satisfy the query. Returns an empty slice no tasks match.

func FindByTaskIDAndExecution

func FindByTaskIDAndExecution(taskID string, execution int) ([]TestResult, error)

FindByTaskIDAndExecution returns test results from the testresults collection for a given task.

func (*TestResult) Insert

func (t *TestResult) Insert() error

Insert writes a test result to the database.

Jump to

Keyboard shortcuts

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