testresult

package
v1.2.25 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const CollectionName = "testresults"
View Source
const PageDefaultLimit int = 100

Variables

This section is empty.

Functions

func NewExecutionsFilter

func NewExecutionsFilter() *filter

Types

type Filter

type Filter interface {
	Name() string
	NameDefined() bool
	StartDate() time.Time
	StartDateDefined() bool
	EndDate() time.Time
	EndDateDefined() bool
	Statuses() testkube.TestSuiteExecutionStatuses
	StatusesDefined() bool
	Page() int
	PageSize() int
	TextSearchDefined() bool
	TextSearch() string
	Selector() string
}

type MongoRepository

type MongoRepository struct {
	Coll *mongo.Collection
}

func NewMongoRespository

func NewMongoRespository(db *mongo.Database) *MongoRepository

func (*MongoRepository) DeleteAll added in v1.2.14

func (r *MongoRepository) DeleteAll(ctx context.Context) (err error)

DeleteAll deletes all execution results

func (*MongoRepository) DeleteByTestSuite added in v1.2.14

func (r *MongoRepository) DeleteByTestSuite(ctx context.Context, testSuiteName string) (err error)

DeleteByTest deletes execution results by test suite

func (*MongoRepository) DeleteByTestSuites added in v1.2.14

func (r *MongoRepository) DeleteByTestSuites(ctx context.Context, testSuiteNames []string) (err error)

DeleteByTestSuites deletes execution results by test suites

func (*MongoRepository) EndExecution

func (r *MongoRepository) EndExecution(ctx context.Context, id string, endTime time.Time, duration time.Duration) (err error)

EndExecution updates execution end time

func (*MongoRepository) Get

func (r *MongoRepository) Get(ctx context.Context, id string) (result testkube.TestSuiteExecution, err error)

func (*MongoRepository) GetByNameAndTestSuite added in v1.2.14

func (r *MongoRepository) GetByNameAndTestSuite(ctx context.Context, name, testSuiteName string) (result testkube.TestSuiteExecution, err error)

func (*MongoRepository) GetExecutions

func (r *MongoRepository) GetExecutions(ctx context.Context, filter Filter) (result []testkube.TestSuiteExecution, err error)

func (*MongoRepository) GetExecutionsTotals

func (r *MongoRepository) GetExecutionsTotals(ctx context.Context, filter ...Filter) (totals testkube.ExecutionsTotals, err error)

func (*MongoRepository) GetLatestByTestSuite added in v1.2.14

func (r *MongoRepository) GetLatestByTestSuite(ctx context.Context, testSuiteName, sortField string) (result testkube.TestSuiteExecution, err error)

func (*MongoRepository) GetLatestByTestSuites added in v1.2.14

func (r *MongoRepository) GetLatestByTestSuites(ctx context.Context, testSuiteNames []string, sortField string) (executions []testkube.TestSuiteExecution, err error)

func (*MongoRepository) GetNewestExecutions

func (r *MongoRepository) GetNewestExecutions(ctx context.Context, limit int) (result []testkube.TestSuiteExecution, err error)

func (*MongoRepository) Insert

func (r *MongoRepository) Insert(ctx context.Context, result testkube.TestSuiteExecution) (err error)

func (*MongoRepository) StartExecution

func (r *MongoRepository) StartExecution(ctx context.Context, id string, startTime time.Time) (err error)

StartExecution updates execution start time

func (*MongoRepository) Update

func (r *MongoRepository) Update(ctx context.Context, result testkube.TestSuiteExecution) (err error)

type Repository

type Repository interface {
	// Get gets execution result by id
	Get(ctx context.Context, id string) (testkube.TestSuiteExecution, error)
	// GetByNameAndTestSuite gets execution result by name
	GetByNameAndTestSuite(ctx context.Context, name, testSuiteName string) (testkube.TestSuiteExecution, error)
	// GetLatestByTestSuite gets latest execution result by test suite
	GetLatestByTestSuite(ctx context.Context, testSuiteName, sortField string) (testkube.TestSuiteExecution, error)
	// GetLatestByTestSuites gets latest execution results by test suite names
	GetLatestByTestSuites(ctx context.Context, testSuiteNames []string, sortField string) (executions []testkube.TestSuiteExecution, err error)
	// GetExecutionsTotals gets executions total stats using a filter, use filter with no data for all
	GetExecutionsTotals(ctx context.Context, filter ...Filter) (totals testkube.ExecutionsTotals, err error)
	// GetExecutions gets executions using a filter, use filter with no data for all
	GetExecutions(ctx context.Context, filter Filter) ([]testkube.TestSuiteExecution, error)
	// Insert inserts new execution result
	Insert(ctx context.Context, result testkube.TestSuiteExecution) error
	// Update updates execution result
	Update(ctx context.Context, result testkube.TestSuiteExecution) error
	// StartExecution updates execution start time
	StartExecution(ctx context.Context, id string, startTime time.Time) error
	// EndExecution updates execution end time
	EndExecution(ctx context.Context, id string, endTime time.Time, duration time.Duration) error
	// DeleteByTestSuite deletes execution results by test suite
	DeleteByTestSuite(ctx context.Context, testSuiteName string) error
	// DeleteAll deletes all execution results
	DeleteAll(ctx context.Context) error
	// DeleteByTestSuites deletes execution results by test suites
	DeleteByTestSuites(ctx context.Context, testSuiteNames []string) (err error)
}

Jump to

Keyboard shortcuts

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