Skip to content

Commit

Permalink
Allow to read pipeline trace value as string or slice of strings
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodm committed Aug 12, 2024
1 parent ab88d3d commit 1003403
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions internal/testrunner/runners/system/tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -842,14 +842,35 @@ type scenarioTest struct {
startTestTime time.Time
}

type pipelineTrace []string

func (p *pipelineTrace) UnmarshalJSON(d []byte) error {
var alias interface{}
if err := json.Unmarshal(d, &alias); err != nil {
return err
}
switch v := alias.(type) {
case string:
*p = append(*p, v)
case []any:
// asume it is going to be an array of strings
for _, value := range v {
*p = append(*p, fmt.Sprint(value))
}
default:
return fmt.Errorf("unexpected type found for pipeline_trace: %T", v)
}
return nil
}

type failureStoreDocument struct {
Error struct {
Type string `json:"type"`
Message string `json:"message"`
StackTrace string `json:"stack_trace"`
PipelineTrace []string `json:"pipeline_trace"`
Pipeline string `json:"pipeline"`
ProcessorType string `json:"processor_type"`
Type string `json:"type"`
Message string `json:"message"`
StackTrace string `json:"stack_trace"`
PipelineTrace pipelineTrace `json:"pipeline_trace"`
Pipeline string `json:"pipeline"`
ProcessorType string `json:"processor_type"`
} `json:"error"`
}

Expand Down

0 comments on commit 1003403

Please sign in to comment.