Propagate cancellation and preserve resumable state
This commit is contained in:
@@ -196,3 +196,20 @@ func TestSessionAcquisitionPreservesRemoteFailureCause(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConfigurationAcquisitionStopsAfterSynchronousCancellation(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
loadErr := errors.New("native configuration load failed")
|
||||
acquired := newConfigurationAcquisition(configurationSelection{Config: suppliedSelection("synthetic.yaml")}, commandDependencies{loadPipelineConfig: func(string, config.PipelineLoadOptions) (*config.PipelineConfig, error) {
|
||||
cancel()
|
||||
return nil, loadErr
|
||||
}})
|
||||
_, err := acquired.Pipeline(ctx)
|
||||
if !errors.Is(err, context.Canceled) || !errors.Is(err, loadErr) || operationOutcome(err).Status != 1 {
|
||||
t.Fatalf("lost canceled native load causes: %v", err)
|
||||
}
|
||||
if acquired.pipeline != nil {
|
||||
t.Fatal("cached a canceled native load")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user