@@ -87,7 +87,7 @@ describe('Work item failure retries', function () {
8787 } ) ;
8888 } ) ;
8989
90- describe ( 'And a work-item fails the first time ' , async function ( ) {
90+ describe ( 'And a work-item fails two times ' , async function ( ) {
9191 hookRangesetRequest ( '1.0.0' , collection , 'all' , { query : { ...reprojectQuery , ...{ maxResults : 1 } } } ) ;
9292 hookRedirect ( 'joe' ) ;
9393 before ( async function ( ) {
@@ -147,7 +147,8 @@ describe('Work item failure retries', function () {
147147 } ) ;
148148 } ) ;
149149 } ) ;
150- describe ( 'And a work-item fails the first time' , async function ( ) {
150+
151+ describe ( 'And a work-item fails three times' , async function ( ) {
151152 hookRangesetRequest ( '1.0.0' , collection , 'all' , { query : { ...reprojectQuery , ...{ maxResults : 1 } } } ) ;
152153 hookRedirect ( 'joe' ) ;
153154 before ( async function ( ) {
@@ -209,5 +210,32 @@ describe('Work item failure retries', function () {
209210 } ) ;
210211 } ) ;
211212 } ) ;
213+
214+ describe ( 'And a work-item fails with no retry error' , async function ( ) {
215+ hookRangesetRequest ( '1.0.0' , collection , 'all' , { query : { ...reprojectQuery , ...{ maxResults : 1 } } } ) ;
216+ hookRedirect ( 'joe' ) ;
217+ before ( async function ( ) {
218+ const res = await getWorkForService ( this . backend , 'harmonyservices/query-cmr:stable' ) ;
219+ const { workItem } = JSON . parse ( res . text ) ;
220+
221+ workItem . status = WorkItemStatus . FAILED ;
222+ workItem . message = 'The service returns noretry error' ;
223+ workItem . message_category = 'noretry' ;
224+ workItem . results = [ ] ;
225+
226+ await updateWorkItem ( this . backend , workItem ) ;
227+
228+ this . workItem = await getWorkItemById ( db , workItem . id ) ;
229+ } ) ;
230+
231+ it ( 'Changes the work-item status to failed immediately without retries' , async function ( ) {
232+ expect ( this . workItem . status ) . to . equal ( WorkItemStatus . FAILED ) ;
233+ expect ( this . workItem . retryCount ) . to . equal ( 0 ) ;
234+ } ) ;
235+ it ( 'changes the work-item status to failed' , async function ( ) {
236+ const { job } = await Job . byJobID ( db , this . workItem . jobID ) ;
237+ expect ( job . status ) . to . equal ( JobStatus . FAILED ) ;
238+ } ) ;
239+ } ) ;
212240 } ) ;
213241} ) ;
0 commit comments