aritra24 commented on PR #51329:
URL: https://github.com/apache/airflow/pull/51329#issuecomment-2936172862
I did a quick sample test and verified it works
```
// TestStartContextErrorTaskDoesntStart checks that if the /run endpoint
returns an error that task doesn't
// start, but that it is logged
func (s *WorkerSuite) TestStartContextErrorTaskDoesntStart() {
s.T().Parallel()
client := &mocks.ClientInterface{}
ti := &mocks.TaskInstancesClient{}
ti.On("UpdateState", mock.AnythingOfType("backgroundCtx"),
mock.AnythingOfType("uuid.UUID"),
mock.AnythingOfType("*api.TIUpdateStatePayload")).Return(nil)
ti.On("Run", mock.AnythingOfType("backgroundCtx"),
mock.AnythingOfType("uuid.UUID"),
mock.AnythingOfType("*api.TIEnterRunningPayload")).Return(nil,
api.GeneralHTTPError{})
client.On("TaskInstances").Return(ti)
s.worker.RegisterTaskWithName("tutorial_dag", "extract", func() error {
time.Sleep(time.Second)
return nil
})
s.worker.(*worker).client = client
err := s.worker.ExecuteTaskWorkload(context.Background(), TestWorkload)
s.Error(err, "No error")
}
```
I didn't commit it since after #51314 it'll have to be redone, so I'll maybe
do it as a follow-up when both these PRs get merged, will need to update the
other tests to also use mocks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]