forked from Silverfish/proton-bridge
test: Improve TestMetadata_JobCorrectlyFinishesAfterCancel
This commit is contained in:
@ -102,9 +102,6 @@ func TestMetadataStage_JobCorrectlyFinishesAfterCancel(t *testing.T) {
|
|||||||
// read one output then cancel
|
// read one output then cancel
|
||||||
request, err := output.Consume(ctx)
|
request, err := output.Consume(ctx)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
request.onFinished(ctx)
|
|
||||||
// cancel job context
|
|
||||||
jobCancel()
|
|
||||||
|
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
@ -117,10 +114,13 @@ func TestMetadataStage_JobCorrectlyFinishesAfterCancel(t *testing.T) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cancel job context
|
||||||
|
jobCancel()
|
||||||
req.checkCancelled()
|
req.checkCancelled()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
request.onFinished(ctx)
|
||||||
err = tj.job.waitAndClose(ctx)
|
err = tj.job.waitAndClose(ctx)
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
require.ErrorIs(t, err, context.Canceled)
|
require.ErrorIs(t, err, context.Canceled)
|
||||||
|
|||||||
Reference in New Issue
Block a user