Transport structured diagnostics through the pipeline
This commit is contained in:
@@ -128,6 +128,24 @@ func TestDiagnosticGroupRejectsRepeatedSampleWithEqualChunkIndex(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCloneDiagnosticCollectionOwnsGroupsAndChunkIndex(t *testing.T) {
|
||||
chunkIndex := 0
|
||||
collection := DiagnosticCollection{Groups: []DiagnosticGroup{{
|
||||
Disposition: DiagnosticDispositionAdvisory,
|
||||
Category: DiagnosticCategoryDataQuality,
|
||||
ReasonCode: "unresolved",
|
||||
Origin: DiagnosticOrigin{Stage: DiagnosticOriginStageExtract, StepID: "extract", LaneID: "spells", ModuleKey: "dnd/spells"},
|
||||
OccurrenceCount: 1,
|
||||
Samples: []DiagnosticSample{{Scope: "spells[0]", Message: "Spell was not found", ChunkIndex: &chunkIndex}},
|
||||
}}}
|
||||
cloned := CloneDiagnosticCollection(collection)
|
||||
collection.Groups[0].Samples[0].Message = "changed"
|
||||
*collection.Groups[0].Samples[0].ChunkIndex = 1
|
||||
if got := cloned.Groups[0].Samples[0]; got.Message != "Spell was not found" || got.ChunkIndex == nil || *got.ChunkIndex != 0 {
|
||||
t.Fatalf("cloned sample = %#v, want independently owned original", got)
|
||||
}
|
||||
}
|
||||
|
||||
func validProducerDiagnostic() ProducerDiagnostic {
|
||||
return ProducerDiagnostic{
|
||||
Disposition: DiagnosticDispositionWarning,
|
||||
|
||||
Reference in New Issue
Block a user