File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -621,6 +621,10 @@ func (e *ChasmEngine) getExecutionLease(
621621 executionLease .GetReleaseFn ()(nil )
622622 err = staleReferenceErr
623623 }
624+ var notFound * serviceerror.NotFound
625+ if errors .As (err , & notFound ) {
626+ err = serviceerror .NewNotFoundf ("execution not found" )
627+ }
624628
625629 return shardContext , executionLease , err
626630}
Original file line number Diff line number Diff line change @@ -625,6 +625,32 @@ func (s *chasmEngineSuite) TestReadComponent_Success() {
625625 s .NoError (err )
626626}
627627
628+ // TestReadComponent_NotFound tests that ReadComponent does not leak the NotFound message returned
629+ // by the underlying mutable state read path.
630+ func (s * chasmEngineSuite ) TestReadComponent_NotFound () {
631+ s .mockExecutionManager .EXPECT ().GetWorkflowExecution (gomock .Any (), gomock .Any ()).
632+ Return (nil , serviceerror .NewNotFound ("this error message will not be returned by ReadComponent" )).Times (1 )
633+
634+ err := s .engine .ReadComponent (
635+ context .Background (),
636+ chasm.NewComponentRef [* testComponent ](
637+ chasm.ExecutionKey {
638+ NamespaceID : string (tests .NamespaceID ),
639+ BusinessID : "non-existent-execution" ,
640+ RunID : "11111111-2222-3333-4444-555555555555" ,
641+ },
642+ ),
643+ func (ctx chasm.Context , component chasm.Component ) error {
644+ s .Fail ("readFn should not be called" )
645+ return nil
646+ },
647+ )
648+ s .Error (err )
649+ var notFound * serviceerror.NotFound
650+ s .ErrorAs (err , & notFound )
651+ s .Equal ("execution not found" , notFound .Message )
652+ }
653+
628654func (s * chasmEngineSuite ) buildPersistenceMutableState (
629655 key chasm.ExecutionKey ,
630656 componentState proto.Message ,
You can’t perform that action at this time.
0 commit comments