mirror of
https://github.com/hanzoai/status.git
synced 2026-10-30 18:21:48 +00:00
The import path a reader types is the one the org owns, rather than the forge that happens to host the bytes. hanzo.ai serves the go-import meta and points it at the same repository, so where the code lives does not change. Rewritten by role. A bare repository URL — a clone target, a badge, a build context — still names where the code is and stays on github.com.
56 lines
1.4 KiB
Go
56 lines
1.4 KiB
Go
package suite
|
|
|
|
import (
|
|
"time"
|
|
|
|
"hanzo.ai/status/config/endpoint"
|
|
)
|
|
|
|
// Result represents the result of a suite execution
|
|
type Result struct {
|
|
// Name of the suite
|
|
Name string `json:"name,omitempty"`
|
|
|
|
// Group of the suite
|
|
Group string `json:"group,omitempty"`
|
|
|
|
// Success indicates whether all required endpoints succeeded
|
|
Success bool `json:"success"`
|
|
|
|
// Timestamp is when the suite execution started
|
|
Timestamp time.Time `json:"timestamp"`
|
|
|
|
// Duration is how long the entire suite execution took
|
|
Duration time.Duration `json:"duration"`
|
|
|
|
// EndpointResults contains the results of each endpoint execution
|
|
EndpointResults []*endpoint.Result `json:"endpointResults"`
|
|
|
|
// Context is the final state of the context after all endpoints executed
|
|
Context map[string]interface{} `json:"-"`
|
|
|
|
// Errors contains any suite-level errors
|
|
Errors []string `json:"errors,omitempty"`
|
|
}
|
|
|
|
// AddError adds an error to the suite result
|
|
func (r *Result) AddError(err string) {
|
|
r.Errors = append(r.Errors, err)
|
|
}
|
|
|
|
// CalculateSuccess determines if the suite execution was successful
|
|
func (r *Result) CalculateSuccess() {
|
|
r.Success = true
|
|
// Check if any endpoints failed (all endpoints are required)
|
|
for _, epResult := range r.EndpointResults {
|
|
if !epResult.Success {
|
|
r.Success = false
|
|
break
|
|
}
|
|
}
|
|
// Also check for suite-level errors
|
|
if len(r.Errors) > 0 {
|
|
r.Success = false
|
|
}
|
|
}
|