Integrate partial processing outcomes and fatal cancellation
This commit is contained in:
@@ -114,15 +114,25 @@ func TestValidatorFailureCancelsActiveAndPendingProviderWork(t *testing.T) {
|
||||
for i := 0; i < 3; i++ {
|
||||
sections = append(sections, chunking.Section{Index: i, Segments: []schema.Segment{{ID: 1, Text: "hello"}}})
|
||||
}
|
||||
done := make(chan error, 1)
|
||||
type pipelineOutcome struct {
|
||||
result modulePipelineResult
|
||||
err error
|
||||
}
|
||||
done := make(chan pipelineOutcome, 1)
|
||||
go func() {
|
||||
_, err := runModulePipeline(ctx, collectSectionProposalsInput{Module: module, Spec: contracts.ModuleRunSpec{ModuleKey: "grammar", InstanceName: "grammar"}, Policy: module.policy, Config: &loaded.Config, Sections: sections})
|
||||
done <- err
|
||||
result, err := runModulePipeline(ctx, collectSectionProposalsInput{Module: module, Spec: contracts.ModuleRunSpec{ModuleKey: "grammar", InstanceName: "grammar"}, Policy: module.policy, Config: &loaded.Config, Sections: sections})
|
||||
done <- pipelineOutcome{result: result, err: err}
|
||||
}()
|
||||
select {
|
||||
case err := <-done:
|
||||
if !errors.Is(err, origin) {
|
||||
t.Fatalf("lost originating failure: %v", err)
|
||||
case outcome := <-done:
|
||||
if !errors.Is(outcome.err, origin) {
|
||||
t.Fatalf("lost originating failure: %v", outcome.err)
|
||||
}
|
||||
if len(outcome.result.WorkUnits) != 3 {
|
||||
t.Fatalf("lost work inventory: %+v", outcome.result.WorkUnits)
|
||||
}
|
||||
if len(outcome.result.Approved) != 0 {
|
||||
t.Fatalf("fatal validation returned unchecked candidates: %+v", outcome.result.Approved)
|
||||
}
|
||||
case <-time.After(2 * time.Second):
|
||||
t.Fatal("validator failure did not cancel and join peers")
|
||||
|
||||
Reference in New Issue
Block a user