Documentation
¶
Index ¶
- func BuildTestAttemptID(runID, testID, executionID string, attemptIndex int32) string
- func ModelsForMigration() []interface{}
- func RunStartEventToAllEntities(req *events.ReportRunStartEventRequest) (*TestRun, *RunExecution, []*Suite, []*Test)
- type ActiveTestStepsDocument
- type Attachment
- type LiveStepBufferDocument
- type OutputDocument
- type RawMessagesRunDocument
- type RawMessagesRunSummary
- type RetainedMessage
- type RunExecution
- type RunStat
- type Step
- type StepDocument
- type Suite
- type Test
- type TestAttempt
- type TestErrorDocument
- type TestFailureDocument
- type TestRun
- type TestRunDocument
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTestAttemptID ¶ added in v0.3.0
func ModelsForMigration ¶ added in v0.2.0
func ModelsForMigration() []interface{}
ModelsForMigration lists models in schema creation order.
func RunStartEventToAllEntities ¶ added in v0.6.0
func RunStartEventToAllEntities(req *events.ReportRunStartEventRequest) (*TestRun, *RunExecution, []*Suite, []*Test)
Types ¶
type ActiveTestStepsDocument ¶ added in v0.2.0
type ActiveTestStepsDocument struct {
TestID string `bson:"test_id" json:"testId"`
ExecutionID string `bson:"execution_id,omitempty" json:"executionId,omitempty"`
RetryIndex int32 `bson:"retry_index" json:"retryIndex"`
Status string `bson:"status,omitempty" json:"status,omitempty"`
Steps []*StepDocument `bson:"steps,omitempty" json:"steps,omitempty"`
FirstEventAt *time.Time `bson:"first_event_at,omitempty" json:"firstEventAt,omitempty"`
LastEventAt *time.Time `bson:"last_event_at,omitempty" json:"lastEventAt,omitempty"`
FlushStartedAt *time.Time `bson:"flush_started_at,omitempty" json:"flushStartedAt,omitempty"`
TTLAt *time.Time `bson:"ttl_at,omitempty" json:"ttlAt,omitempty"`
CreatedAt time.Time `bson:"created_at" json:"createdAt"`
UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"`
}
ActiveTestStepsDocument stores transient in-flight steps for a single active test attempt. The owning TestRunDocument keys this object by test id in ActiveTestSteps.
type Attachment ¶ added in v0.2.0
type Attachment struct {
ID string `gorm:"column:id;type:text;primaryKey" json:"id"`
RunID string `gorm:"column:run_id;type:text;not null;index:idx_attachments_run" json:"runId"`
TestID string `gorm:"column:test_id;type:text;not null;index:idx_attachments_test" json:"testId"`
TestAttemptID string `gorm:"column:test_attempt_id;type:text;not null;index:idx_attachments_attempt" json:"testAttemptId"`
StepID *string `gorm:"column:step_id;type:text" json:"stepId,omitempty"`
Kind string `gorm:"column:kind;type:text" json:"kind,omitempty"`
Name string `gorm:"column:name;type:text" json:"name,omitempty"`
ContentType string `gorm:"column:content_type;type:text" json:"contentType,omitempty"`
SizeBytes int64 `gorm:"column:size_bytes" json:"sizeBytes,omitempty"`
StorageKey string `gorm:"column:storage_key;type:text" json:"storageKey,omitempty"`
Checksum string `gorm:"column:checksum;type:text" json:"checksum,omitempty"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime;index:idx_attachments_created_at" json:"createdAt"`
DeletedAt *time.Time `gorm:"column:deleted_at" json:"deletedAt,omitempty"`
}
Attachment maps to PostgreSQL attachments metadata.
func (Attachment) TableName ¶ added in v0.2.0
func (Attachment) TableName() string
type LiveStepBufferDocument ¶ added in v0.2.0
type LiveStepBufferDocument struct {
ID string `bson:"_id" json:"id"`
RunID string `bson:"run_id" json:"runId"`
ExecutionID string `bson:"execution_id,omitempty" json:"executionId,omitempty"`
TestID string `bson:"test_id" json:"testId"`
AttemptIndex int32 `bson:"attempt_index" json:"attemptIndex"`
Status string `bson:"status,omitempty" json:"status,omitempty"`
Steps []*StepDocument `bson:"steps,omitempty" json:"steps,omitempty"`
FirstEventAt *time.Time `bson:"first_event_at,omitempty" json:"firstEventAt,omitempty"`
LastEventAt *time.Time `bson:"last_event_at,omitempty" json:"lastEventAt,omitempty"`
FlushStartedAt *time.Time `bson:"flush_started_at,omitempty" json:"flushStartedAt,omitempty"`
TTLAt *time.Time `bson:"ttl_at,omitempty" json:"ttlAt,omitempty"`
CreatedAt time.Time `bson:"created_at" json:"createdAt"`
UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"`
}
LiveStepBufferDocument is the standalone collection representation of an active step buffer. The collection is initialized separately so later phases can cut over from the embedded run-document buffer without another schema hop.
type OutputDocument ¶
type OutputDocument struct {
Message string `bson:"message,omitempty" json:"message,omitempty"`
Timestamp *time.Time `bson:"timestamp,omitempty" json:"timestamp,omitempty"`
}
OutputDocument represents stdout or stderr output
type RawMessagesRunDocument ¶ added in v0.1.1
type RawMessagesRunDocument struct {
// RunID is the test run identifier; used as the MongoDB _id.
RunID string `bson:"_id" json:"runId"`
// Messages is the ordered list of raw messages received for this run.
Messages []RetainedMessage `bson:"messages" json:"messages"`
// CreatedAt is the time the document was first created (first message for the run).
CreatedAt time.Time `bson:"created_at" json:"createdAt"`
// UpdatedAt is the time the last message was appended to this document.
UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"`
}
RawMessagesRunDocument groups all retained NATS messages that belong to a single test run. The document _id is the run_id, so every message for a run is co-located in one document, making replay and audit straightforward.
type RawMessagesRunSummary ¶ added in v0.1.1
type RawMessagesRunSummary struct {
// RunID is the retained run identifier (_id in MongoDB).
RunID string `bson:"_id" json:"runId"`
// MessageCount is the number of retained messages for this run.
MessageCount int `bson:"message_count" json:"messageCount"`
// CreatedAt is when the retention document was first created.
CreatedAt time.Time `bson:"created_at" json:"createdAt"`
// UpdatedAt is when the retention document was last appended to.
UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"`
}
RawMessagesRunSummary is a lightweight listing item for runs that have retained raw messages.
type RetainedMessage ¶ added in v0.1.1
type RetainedMessage struct {
// Subject is the NATS subject on which the message was received.
Subject string `bson:"subject" json:"subject"`
// EventType is the decoded event type from the message envelope.
EventType string `bson:"event_type" json:"eventType"`
// Payload contains the parsed JSON of the full NATS message (event envelope).
Payload map[string]interface{} `bson:"payload" json:"payload"`
// Sequence is the JetStream sequence number of the message within the stream.
Sequence uint64 `bson:"sequence,omitempty" json:"sequence,omitempty"`
// Stream is the name of the JetStream stream this message was consumed from.
Stream string `bson:"stream,omitempty" json:"stream,omitempty"`
// ReceivedAt is the time the message was received and stored.
ReceivedAt time.Time `bson:"received_at" json:"receivedAt"`
}
RetainedMessage is a single NATS message captured within a run's retention log. Multiple RetainedMessages are embedded in a RawMessagesRunDocument.
type RunExecution ¶ added in v0.3.0
type RunExecution struct {
ID string `gorm:"column:id;type:text;primaryKey" json:"id"`
RunID string `gorm:"column:run_id;type:text;not null;primaryKey;index:idx_run_executions_run_status,priority:1" json:"runId"`
Name string `gorm:"column:name;type:text" json:"name,omitempty"`
Status string `gorm:"column:status;type:text;index:idx_run_executions_run_status,priority:2" json:"status,omitempty"`
IsShard bool `gorm:"column:is_shard" json:"isShard,omitempty"`
ShardIndex *int32 `gorm:"column:shard_index" json:"shardIndex,omitempty"`
ShardCountExpected *int32 `gorm:"column:shard_total" json:"shardCountExpected,omitempty"`
Metadata map[string]interface{} `gorm:"column:metadata;type:jsonb;serializer:json" json:"metadata,omitempty"`
StartTime *time.Time `gorm:"column:started_at;index:idx_run_executions_started_at" json:"startTime,omitempty"`
EndTime *time.Time `gorm:"column:finished_at" json:"endTime,omitempty"`
Duration *int64 `gorm:"column:duration" json:"duration,omitempty"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updatedAt"`
}
RunExecution maps to the PostgreSQL run_executions table and captures execution-scoped state beneath a logical run.
func RunEndEventToRunExecution ¶ added in v0.3.0
func RunEndEventToRunExecution(req *events.TestRunEndEventRequest) *RunExecution
RunEndEventToRunExecution maps a run-end event to an execution-scoped update.
func (RunExecution) TableName ¶ added in v0.3.0
func (RunExecution) TableName() string
type RunStat ¶ added in v0.5.0
type RunStat struct {
RunID string `gorm:"column:run_id;type:text;primaryKey" json:"runId"`
Name string `gorm:"column:name;type:text" json:"name"`
Total int32 `gorm:"column:total" json:"total"`
Passed int32 `gorm:"column:passed" json:"passed"`
Failed int32 `gorm:"column:failed" json:"failed"`
Flaky int32 `gorm:"column:flaky" json:"flaky"`
Skipped int32 `gorm:"column:skipped" json:"skipped"`
Broken int32 `gorm:"column:broken" json:"broken"`
TimedOut int32 `gorm:"column:timedout" json:"timedOut"`
Interrupted int32 `gorm:"column:interrupted" json:"interrupted"`
Unknown int32 `gorm:"column:unknown" json:"unknown"`
NotRun int32 `gorm:"column:not_run" json:"notRun"`
Running int32 `gorm:"column:running" json:"running"`
Duration int64 `gorm:"column:duration" json:"duration"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updatedAt"`
}
type Step ¶ added in v0.2.4
type Step json.RawMessage
func StepFromDocuments ¶ added in v0.2.4
func StepFromDocuments(steps []*StepDocument) (*Step, error)
func (Step) MarshalJSON ¶ added in v0.2.4
func (*Step) UnmarshalJSON ¶ added in v0.2.4
type StepDocument ¶
type StepDocument struct {
ID string `bson:"id" json:"id"`
RunID string `bson:"run_id,omitempty" json:"runId,omitempty"`
ExecutionID string `bson:"execution_id,omitempty" json:"executionId,omitempty"`
TestCaseRunID string `bson:"test_case_run_id,omitempty" json:"testCaseRunId,omitempty"`
ParentStepID string `bson:"parent_step_id,omitempty" json:"parentStepId,omitempty"`
Title string `bson:"title,omitempty" json:"title,omitempty"`
Description string `bson:"description,omitempty" json:"description,omitempty"`
StartTime *time.Time `bson:"start_time,omitempty" json:"startTime,omitempty"`
Duration *int64 `bson:"duration,omitempty" json:"duration,omitempty"`
Type string `bson:"type,omitempty" json:"type,omitempty"`
Metadata map[string]interface{} `bson:"metadata,omitempty" json:"metadata,omitempty"`
Tags []string `bson:"tags,omitempty" json:"tags,omitempty"`
WorkerIndex string `bson:"worker_index,omitempty" json:"workerIndex,omitempty"`
Status string `bson:"status,omitempty" json:"status,omitempty"`
Category string `bson:"category,omitempty" json:"category,omitempty"`
Location string `bson:"location,omitempty" json:"location,omitempty"`
RetryIndex int32 `bson:"retry_index,omitempty" json:"retryIndex,omitempty"`
// Error fields
Error string `bson:"error,omitempty" json:"error,omitempty"` // Single error message
Errors []string `bson:"errors,omitempty" json:"errors,omitempty"` // Array of error messages
CreatedAt time.Time `bson:"created_at" json:"createdAt"`
UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"`
// Nested steps (for step hierarchies)
Steps []*StepDocument `bson:"steps,omitempty" json:"steps,omitempty"`
}
StepDocument represents a test step embedded within a test or parent step.
type Suite ¶ added in v0.2.0
type Suite struct {
ID string `gorm:"column:id;type:text;primaryKey" json:"id"`
RunID string `` /* 186-byte string literal not displayed */
ExternalSuiteID string `gorm:"column:external_suite_id;type:text;index:idx_suites_run_external_suite_id,priority:2" json:"externalSuiteId,omitempty"`
ParentSuiteID *string `gorm:"column:parent_suite_id;type:text" json:"parentSuiteId,omitempty"`
Name string `gorm:"column:name;type:text" json:"name,omitempty"`
Description string `gorm:"column:description;type:text" json:"description,omitempty"`
Status string `gorm:"column:status;type:text;index:idx_suites_run_status,priority:2" json:"status,omitempty"`
Metadata map[string]interface{} `gorm:"column:metadata;type:jsonb;serializer:json" json:"metadata,omitempty"`
Duration *int64 `gorm:"column:duration" json:"duration,omitempty"`
Location string `gorm:"column:location;type:text" json:"location,omitempty"`
Type string `gorm:"column:type;type:text" json:"type,omitempty"`
TestSuiteSpecID string `gorm:"column:test_suite_spec_id;type:text" json:"testSuiteSpecId,omitempty"`
InitiatedBy string `gorm:"column:initiated_by;type:text" json:"initiatedBy,omitempty"`
ProjectName string `gorm:"column:project_name;type:text" json:"projectName,omitempty"`
Author string `gorm:"column:author;type:text" json:"author,omitempty"`
Owner string `gorm:"column:owner;type:text" json:"owner,omitempty"`
TestCaseIDs []string `gorm:"column:test_case_ids;type:jsonb;serializer:json" json:"testCaseIds,omitempty"`
SubSuiteIDs []string `gorm:"column:sub_suite_ids;type:jsonb;serializer:json" json:"subSuiteIds,omitempty"`
Tags []string `gorm:"column:tags;type:jsonb;serializer:json" json:"tags,omitempty"`
StartTime *time.Time `gorm:"column:started_at" json:"startTime,omitempty"`
EndTime *time.Time `gorm:"column:finished_at" json:"endTime,omitempty"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updatedAt"`
Suites []*Suite `gorm:"foreignKey:ParentSuiteID,RunID;references:ID,RunID" json:"suites,omitempty"`
Tests []*Test `gorm:"foreignKey:SuiteID,RunID;references:ID,RunID" json:"tests,omitempty"`
}
Suite maps to the PostgreSQL suites table.
func SuiteRunToRelationalSuite ¶ added in v0.3.0
func SuiteRunToRelationalSuite(protoSuite *entities.TestSuiteRun) *Suite
type Test ¶ added in v0.2.0
type Test struct {
ID string `gorm:"column:id;type:text;primaryKey" json:"id"`
RunID string `` /* 144-byte string literal not displayed */
ExternalTestID string `` /* 170-byte string literal not displayed */
SuiteID *string `` /* 156-byte string literal not displayed */
Name string `gorm:"column:name;type:text" json:"name,omitempty"`
Title string `gorm:"column:title;type:text" json:"title,omitempty"`
Description string `gorm:"column:description;type:text" json:"description,omitempty"`
Status string `gorm:"column:status;type:text;index:idx_tests_suite_status,priority:2" json:"status,omitempty"`
StartTime *time.Time `gorm:"column:started_at" json:"startTime,omitempty"`
EndTime *time.Time `gorm:"column:finished_at" json:"endTime,omitempty"`
Duration *int64 `gorm:"column:duration" json:"duration,omitempty"`
Metadata map[string]interface{} `gorm:"column:metadata;type:jsonb;serializer:json" json:"metadata,omitempty"`
Tags []string `gorm:"column:tags;type:jsonb;serializer:json" json:"tags,omitempty"`
Location string `gorm:"column:location;type:text" json:"location,omitempty"`
RetryCount *int32 `gorm:"column:retry_count" json:"retryCount,omitempty"`
RetryIndex *int32 `gorm:"column:retry_index" json:"retryIndex,omitempty"`
Timeout *int32 `gorm:"column:timeout" json:"timeout,omitempty"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updatedAt"`
Attempts []TestAttempt `gorm:"foreignKey:TestID,RunID;references:ID,RunID" json:"attempts,omitempty"`
}
Test maps to the PostgreSQL tests table.
func TestCaseRunToRelationalTest ¶ added in v0.2.0
func TestCaseRunToRelationalTest(protoTest *entities.TestCaseRun) *Test
TestCaseRunToRelationalTest maps a TestCaseRun payload to the relational tests row.
type TestAttempt ¶ added in v0.2.0
type TestAttempt struct {
ID string `gorm:"column:id;type:text;primaryKey" json:"id"`
RunID string `` /* 156-byte string literal not displayed */
ExecutionID string `` /* 185-byte string literal not displayed */
TestID string `` /* 165-byte string literal not displayed */
AttemptIndex int32 `` /* 167-byte string literal not displayed */
Status string `gorm:"column:status;type:text;index:idx_attempts_status_finished_at,priority:1" json:"status,omitempty"`
StartTime *time.Time `gorm:"column:started_at" json:"startTime,omitempty"`
EndTime *time.Time `gorm:"column:finished_at;index:idx_attempts_status_finished_at,priority:2" json:"endTime,omitempty"`
Duration *int64 `gorm:"column:duration" json:"duration,omitempty"`
Steps *Step `gorm:"column:steps;type:jsonb" json:"steps,omitempty"`
StepsCount int32 `gorm:"column:steps_count" json:"stepsCount,omitempty"`
Metadata map[string]interface{} `gorm:"column:metadata;type:jsonb;serializer:json" json:"metadata,omitempty"`
Attachments []map[string]interface{} `gorm:"column:attachments;type:jsonb;serializer:json" json:"attachments,omitempty"`
ErrorMessage string `gorm:"column:error_message;type:text" json:"errorMessage,omitempty"`
StackTrace string `gorm:"column:stack_trace;type:text" json:"stackTrace,omitempty"`
ErrorList []string `gorm:"column:error_list;type:jsonb;serializer:json" json:"errorList,omitempty"`
Failures []*TestFailureDocument `gorm:"column:failures;type:jsonb;serializer:json" json:"failures,omitempty"`
Errors []*TestErrorDocument `gorm:"column:errors;type:jsonb;serializer:json" json:"errors,omitempty"`
StdOut []*OutputDocument `gorm:"column:stdout;type:jsonb;serializer:json" json:"stdout,omitempty"`
StdErr []*OutputDocument `gorm:"column:stderr;type:jsonb;serializer:json" json:"stderr,omitempty"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updatedAt"`
AttachmentsRows []Attachment `gorm:"foreignKey:TestAttemptID;references:ID" json:"attachmentsRows,omitempty"`
}
TestAttempt maps to PostgreSQL test_attempts. Steps are stored on the attempt row as requested.
func TestCaseRunToRelationalAttempt ¶ added in v0.2.0
func TestCaseRunToRelationalAttempt(protoTest *entities.TestCaseRun, attachments []map[string]interface{}) *TestAttempt
TestCaseRunToRelationalAttempt maps a TestCaseRun payload to the relational test_attempts row.
func (TestAttempt) TableName ¶ added in v0.2.0
func (TestAttempt) TableName() string
type TestErrorDocument ¶
type TestErrorDocument struct {
ErrorMessage string `bson:"error_message,omitempty" json:"errorMessage,omitempty"`
StackTrace string `bson:"stack_trace,omitempty" json:"stackTrace,omitempty"`
Timestamp *time.Time `bson:"timestamp,omitempty" json:"timestamp,omitempty"`
Attachments []map[string]interface{} `bson:"attachments,omitempty" json:"attachments,omitempty"`
}
TestErrorDocument represents a test error with details
type TestFailureDocument ¶
type TestFailureDocument struct {
FailureMessage string `bson:"failure_message,omitempty" json:"failureMessage,omitempty"`
StackTrace string `bson:"stack_trace,omitempty" json:"stackTrace,omitempty"`
Timestamp *time.Time `bson:"timestamp,omitempty" json:"timestamp,omitempty"`
Attachments []map[string]interface{} `bson:"attachments,omitempty" json:"attachments,omitempty"`
}
TestFailureDocument represents a test failure with details
type TestRun ¶ added in v0.2.0
type TestRun struct {
ID string `gorm:"column:id;type:text;primaryKey" json:"id"`
Name string `gorm:"column:name;type:text" json:"name,omitempty"`
Description string `gorm:"column:description;type:text" json:"description,omitempty"`
Status string `gorm:"column:status;type:text;index:idx_runs_status_started_at,priority:1" json:"status,omitempty"`
Metadata map[string]interface{} `gorm:"column:metadata;type:jsonb;serializer:json" json:"metadata,omitempty"`
Duration *int64 `gorm:"column:duration" json:"duration,omitempty"`
InitiatedBy string `gorm:"column:initiated_by;type:text" json:"initiatedBy,omitempty"`
ProjectName string `gorm:"column:project_name;type:text" json:"projectName,omitempty"`
StartTime *time.Time `gorm:"column:started_at;index:idx_runs_status_started_at,priority:2;index:idx_runs_started_at" json:"startTime,omitempty"`
EndTime *time.Time `gorm:"column:finished_at" json:"endTime,omitempty"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updatedAt"`
Executions []*RunExecution `gorm:"foreignKey:RunID;references:ID" json:"executions,omitempty"`
Suites []*Suite `gorm:"foreignKey:RunID;references:ID" json:"suites,omitempty"`
Tests []*Test `gorm:"foreignKey:RunID;references:ID" json:"tests,omitempty"`
}
TestRun maps to the PostgreSQL runs table. It intentionally mirrors TestRunDocument fields where practical.
func RunEndEventToTestRun ¶ added in v0.2.0
func RunEndEventToTestRun(req *events.TestRunEndEventRequest) TestRun
runEndEventToTestRun maps a TestRunEndEventRequest to TestRun. The returned fields are intended for a partial update to finalize the run's terminal state.
type TestRunDocument ¶
type TestRunDocument struct {
ID string `bson:"_id" json:"id"`
// ActiveTestSteps buffers in-flight step trees by test id while the attempt is running.
ActiveTestSteps map[string]*ActiveTestStepsDocument `bson:"active_test_steps,omitempty" json:"activeTestSteps,omitempty"`
}
TestRunDocument represents the MongoDB document structure for a test run, including active test steps buffering.