Documentation
¶
Index ¶
- Constants
- func NewExecutionsFilter() *filter
- type Filter
- type MongoRepository
- func (r *MongoRepository) DeleteAll(ctx context.Context) (err error)
- func (r *MongoRepository) DeleteByTest(ctx context.Context, testName string) (err error)
- func (r *MongoRepository) DeleteByTestSuite(ctx context.Context, testSuiteName string) (err error)
- func (r *MongoRepository) DeleteByTestSuites(ctx context.Context, testSuiteNames []string) (err error)
- func (r *MongoRepository) DeleteByTests(ctx context.Context, testNames []string) (err error)
- func (r *MongoRepository) DeleteForAllTestSuites(ctx context.Context) (err error)
- func (r *MongoRepository) EndExecution(ctx context.Context, id string, endTime time.Time, duration time.Duration) (err error)
- func (r *MongoRepository) Get(ctx context.Context, id string) (result testkube.Execution, err error)
- func (r *MongoRepository) GetByName(ctx context.Context, name string) (result testkube.Execution, err error)
- func (r *MongoRepository) GetByNameAndTest(ctx context.Context, name, testName string) (result testkube.Execution, err error)
- func (r *MongoRepository) GetExecutionTotals(ctx context.Context, paging bool, filter ...Filter) (totals testkube.ExecutionsTotals, err error)
- func (r *MongoRepository) GetExecutions(ctx context.Context, filter Filter) (result []testkube.Execution, err error)
- func (r *MongoRepository) GetLabels(ctx context.Context) (labels map[string][]string, err error)
- func (r *MongoRepository) GetLatestByTest(ctx context.Context, testName, sortField string) (result testkube.Execution, err error)
- func (r *MongoRepository) GetLatestByTests(ctx context.Context, testNames []string, sortField string) (executions []testkube.Execution, err error)
- func (r *MongoRepository) GetNewestExecutions(ctx context.Context, limit int) (result []testkube.Execution, err error)
- func (r *MongoRepository) GetNextExecutionNumber(ctx context.Context, testName string) (number int, err error)
- func (r *MongoRepository) GetTestMetrics(ctx context.Context, name string, limit, last int) (metrics testkube.ExecutionsMetrics, err error)
- func (r *MongoRepository) Insert(ctx context.Context, result testkube.Execution) (err error)
- func (r *MongoRepository) StartExecution(ctx context.Context, id string, startTime time.Time) (err error)
- func (r *MongoRepository) Update(ctx context.Context, result testkube.Execution) (err error)
- func (r *MongoRepository) UpdateResult(ctx context.Context, id string, result testkube.ExecutionResult) (err error)
- type Repository
- type Sequences
Constants ¶
View Source
const ( CollectionName = "results" CollectionSequences = "sequences" )
View Source
const PageDefaultLimit int = 100
Variables ¶
This section is empty.
Functions ¶
func NewExecutionsFilter ¶ added in v0.6.9
func NewExecutionsFilter() *filter
Types ¶
type Filter ¶ added in v0.6.9
type Filter interface {
TestName() string
TestNameDefined() bool
LastNDays() int
LastNDaysDefined() bool
StartDate() time.Time
StartDateDefined() bool
EndDate() time.Time
EndDateDefined() bool
Statuses() testkube.ExecutionStatuses
StatusesDefined() bool
Page() int
PageSize() int
TextSearchDefined() bool
TextSearch() string
Selector() string
TypeDefined() bool
Type() string
}
type MongoRepository ¶
type MongoRepository struct {
Coll *mongo.Collection
Sequences *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) DeleteByTest ¶ added in v1.2.14
func (r *MongoRepository) DeleteByTest(ctx context.Context, testName string) (err error)
DeleteByTest deletes execution results by test
func (*MongoRepository) DeleteByTestSuite ¶ added in v1.3.2
func (r *MongoRepository) DeleteByTestSuite(ctx context.Context, testSuiteName string) (err error)
DeleteByTestSuite deletes execution results by test suite
func (*MongoRepository) DeleteByTestSuites ¶ added in v1.3.2
func (r *MongoRepository) DeleteByTestSuites(ctx context.Context, testSuiteNames []string) (err error)
DeleteByTestSuites deletes execution results by test suites
func (*MongoRepository) DeleteByTests ¶ added in v1.2.14
func (r *MongoRepository) DeleteByTests(ctx context.Context, testNames []string) (err error)
DeleteByTests deletes execution results by tests
func (*MongoRepository) DeleteForAllTestSuites ¶ added in v1.3.2
func (r *MongoRepository) DeleteForAllTestSuites(ctx context.Context) (err error)
DeleteForAllTestSuites deletes execution results for all test suites
func (*MongoRepository) EndExecution ¶ added in v0.6.4
func (r *MongoRepository) EndExecution(ctx context.Context, id string, endTime time.Time, duration time.Duration) (err error)
EndExecution updates execution end time
func (*MongoRepository) GetByNameAndTest ¶ added in v0.9.5
func (*MongoRepository) GetExecutionTotals ¶ added in v0.6.9
func (r *MongoRepository) GetExecutionTotals(ctx context.Context, paging bool, filter ...Filter) (totals testkube.ExecutionsTotals, err error)
func (*MongoRepository) GetExecutions ¶
func (*MongoRepository) GetLatestByTest ¶ added in v0.11.6
func (*MongoRepository) GetLatestByTests ¶ added in v0.11.8
func (*MongoRepository) GetNewestExecutions ¶
func (*MongoRepository) GetNextExecutionNumber ¶ added in v1.4.5
func (*MongoRepository) GetTestMetrics ¶ added in v1.4.5
func (r *MongoRepository) GetTestMetrics(ctx context.Context, name string, limit, last int) (metrics testkube.ExecutionsMetrics, err error)
GetTestMetrics returns test executions metrics limited to number of executions or last N days
func (*MongoRepository) StartExecution ¶ added in v0.6.4
func (r *MongoRepository) StartExecution(ctx context.Context, id string, startTime time.Time) (err error)
StartExecution updates execution start time
func (*MongoRepository) UpdateResult ¶
func (r *MongoRepository) UpdateResult(ctx context.Context, id string, result testkube.ExecutionResult) (err error)
type Repository ¶
type Repository interface {
Sequences
// Get gets execution result by id
Get(ctx context.Context, id string) (testkube.Execution, error)
// GetByName gets execution result by name
GetByName(ctx context.Context, id string) (testkube.Execution, error)
// GetByNameAndTest gets execution result by name and test name
GetByNameAndTest(ctx context.Context, name, testName string) (testkube.Execution, error)
// GetLatestByTest gets latest execution result by test
GetLatestByTest(ctx context.Context, testName, sortField string) (testkube.Execution, error)
// GetLatestByTests gets latest execution results by test names
GetLatestByTests(ctx context.Context, testNames []string, sortField string) (executions []testkube.Execution, err error)
// GetExecutions gets executions using a filter, use filter with no data for all
GetExecutions(ctx context.Context, filter Filter) ([]testkube.Execution, error)
// GetExecutionTotals gets the statistics on number of executions using a filter, but without paging
GetExecutionTotals(ctx context.Context, paging bool, filter ...Filter) (result testkube.ExecutionsTotals, err error)
// Insert inserts new execution result
Insert(ctx context.Context, result testkube.Execution) error
// Update updates execution result
Update(ctx context.Context, result testkube.Execution) error
// UpdateExecution updates result in execution
UpdateResult(ctx context.Context, id string, execution testkube.ExecutionResult) 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
// GetLabels get all available labels
GetLabels(ctx context.Context) (labels map[string][]string, err error)
// DeleteByTest deletes execution results by test
DeleteByTest(ctx context.Context, testName string) 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
// DeleteByTests deletes execution results by tests
DeleteByTests(ctx context.Context, testNames []string) (err error)
// DeleteByTestSuites deletes execution results by test suites
DeleteByTestSuites(ctx context.Context, testSuiteNames []string) (err error)
// DeleteForAllTestSuites deletes execution results for all test suites
DeleteForAllTestSuites(ctx context.Context) (err error)
GetTestMetrics(ctx context.Context, name string, limit, last int) (metrics testkube.ExecutionsMetrics, err error)
}
Click to show internal directories.
Click to hide internal directories.