Documentation
¶
Index ¶
- type Assertion
- type AssertionResult
- type Case
- type CaseRunResult
- type Diagnostics
- type EvalSource
- type Evaluation
- type EvaluationResult
- type ExecutionOptions
- type HarnessOptions
- type InlineArtifact
- type Issue
- type MockBehavior
- type MockHit
- type MockMiss
- type Mocks
- type OpMock
- type OpMockMatch
- type RenderedVarsDiagnostic
- type RuntimeConfig
- type TargetRecipe
- type TargetResolver
- type TestError
- type TestPolicy
- type TransitionDiagnostic
- type ValidationResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assertion ¶
type Assertion struct {
Type string `` /* 191-byte string literal not displayed */
Path string `json:"path,omitempty"`
Value interface{} `json:"value,omitempty"`
Regex string `json:"regex,omitempty"`
JsonPath string `json:"json_path,omitempty"`
NodePath string `json:"node_path,omitempty"`
Scope string `json:"scope,omitempty"`
FromState string `json:"from_state,omitempty"`
ToState string `json:"to_state,omitempty"`
Status string `json:"status,omitempty"`
Expr string `json:"expr,omitempty"`
}
type AssertionResult ¶
type Case ¶
type Case struct {
ID string `json:"id" validate:"required"`
Type string `json:"type" validate:"required,oneof=op_case recipe_case integration_case"`
Target map[string]interface{} `json:"target,omitempty"`
Inputs map[string]interface{} `json:"inputs,omitempty"`
Mocks Mocks `json:"mocks,omitempty"`
Assertions []Assertion `json:"assertions,omitempty"`
Evaluations []Evaluation `json:"evaluations,omitempty"`
Options map[string]interface{} `json:"options,omitempty"`
}
type CaseRunResult ¶
type CaseRunResult struct {
CaseId string `json:"case_id"`
Status string `json:"status"`
CaseHash string `json:"case_hash"`
DurationMs int64 `json:"duration_ms"`
FailureCategory string `json:"failure_category,omitempty"`
FailureReason string `json:"failure_reason,omitempty"`
Outputs map[string]interface{} `json:"outputs,omitempty"`
Assertions []AssertionResult `json:"assertions,omitempty"`
Evaluations []EvaluationResult `json:"evaluations,omitempty"`
Diagnostics Diagnostics `json:"diagnostics,omitempty"`
Artifacts map[string]InlineArtifact `json:"artifacts,omitempty"`
}
func RunCase ¶
func RunCase(ctx context.Context, opts HarnessOptions, tenantID string, target TargetRecipe, c Case, exec ExecutionOptions) CaseRunResult
type Diagnostics ¶
type Diagnostics struct {
MockHits []MockHit `json:"mock_hits,omitempty"`
MockMisses []MockMiss `json:"mock_misses,omitempty"`
Vars []RenderedVarsDiagnostic `json:"vars,omitempty"`
Transitions []TransitionDiagnostic `json:"transitions,omitempty"`
}
type EvalSource ¶
type EvalSource struct {
Kind string `json:"kind" validate:"required,oneof=artifact artifact_glob output_path trace"`
Path string `json:"path,omitempty"`
Glob string `json:"glob,omitempty"`
OutputPath string `json:"output_path,omitempty"`
TraceName string `json:"trace_name,omitempty"`
AllowSensitive bool `json:"allow_sensitive,omitempty"`
}
type Evaluation ¶
type Evaluation struct {
ID string `json:"id" validate:"required"`
Type string `json:"type" validate:"required,oneof=text_pattern llm_judge"`
Mode string `json:"mode,omitempty" validate:"omitempty,oneof=enforce report_only"`
Source EvalSource `json:"source" validate:"required"`
Config map[string]interface{} `json:"config,omitempty"`
}
type EvaluationResult ¶
type ExecutionOptions ¶
type ExecutionOptions struct {
Mode string `json:"mode,omitempty" validate:"omitempty,oneof=isolated"`
Timeout string `json:"timeout,omitempty"`
ArtifactMode string `json:"artifact_mode,omitempty" validate:"omitempty,oneof=none inline"`
ArtifactMaxBytes int64 `json:"artifact_max_bytes,omitempty" validate:"omitempty,gte=1"`
EvaluationMode string `json:"evaluation_mode,omitempty" validate:"omitempty,oneof=enforce report_only"`
}
type HarnessOptions ¶
type HarnessOptions struct {
Resolver TargetResolver
Deps coreops.ServiceDependencies2
CELOptions template.CELOptionsProvider
WorkRoot string
}
type InlineArtifact ¶
type MockBehavior ¶
type MockBehavior struct {
Mode string `json:"mode" validate:"required,oneof=return fail passthrough record_passthrough replay"`
Outputs map[string]any `json:"outputs,omitempty"`
Artifacts map[string]string `json:"artifacts,omitempty"`
Error *TestError `json:"error,omitempty"`
CassetteKey string `json:"cassette_key,omitempty"`
}
type OpMock ¶
type OpMock struct {
Match OpMockMatch `json:"match" validate:"required"`
Behavior MockBehavior `json:"behavior" validate:"required"`
}
type OpMockMatch ¶
type RenderedVarsDiagnostic ¶ added in v0.0.11
type RuntimeConfig ¶
type RuntimeConfig struct {
Policy TestPolicy
ArtifactMode string
ArtifactMaxBytes int64
EvaluationMode string
}
type TargetRecipe ¶
type TargetResolver ¶
type TargetResolver interface {
ResolveRecipeTarget(ctx context.Context, tenantID string, target TargetRecipe) (*recipecore.Recipe, string, []Issue, []Issue)
}
type TestPolicy ¶
type TransitionDiagnostic ¶ added in v0.0.11
type TransitionDiagnostic struct {
FromState string `json:"from_state,omitempty"`
ToState string `json:"to_state,omitempty"`
Expression string `json:"expression,omitempty"`
Result bool `json:"result"`
Selected bool `json:"selected,omitempty"`
Payload map[string]interface{} `json:"payload,omitempty"`
}
type ValidationResult ¶
type ValidationResult struct {
Valid bool `json:"valid"`
CaseHash string `json:"case_hash"`
Errors []Issue `json:"errors,omitempty"`
Warnings []Issue `json:"warnings,omitempty"`
}
func ValidateCase ¶
func ValidateCase(ctx context.Context, opts HarnessOptions, tenantID string, target TargetRecipe, c Case) ValidationResult
Click to show internal directories.
Click to hide internal directories.