@@ -364,6 +364,11 @@ void testGetConnectionStatusCounts() throws IOException, JsonValidationException
364
364
.withStatus (StandardSync .Status .ACTIVE );
365
365
connectionServiceJooqImpl .writeStandardSync (notSyncedConnection );
366
366
367
+ // Connection 4: Inactive but last job succeeded
368
+ final StandardSync pausedWithJobSucceededConnection = createStandardSync (source , destination , streams )
369
+ .withStatus (StandardSync .Status .INACTIVE );
370
+ connectionServiceJooqImpl .writeStandardSync (pausedWithJobSucceededConnection );
371
+
367
372
// Insert job records using raw SQL since we need to work with the jobs database
368
373
database .query (ctx -> {
369
374
final var now = OffsetDateTime .now ();
@@ -452,6 +457,18 @@ void testGetConnectionStatusCounts() throws IOException, JsonValidationException
452
457
.set (io .airbyte .db .instance .jobs .jooq .generated .Tables .JOBS .CONFIG , org .jooq .impl .DSL .field ("'{}'::jsonb" , org .jooq .JSONB .class ))
453
458
.execute ();
454
459
460
+ // Job for successful sync but paused connection
461
+ ctx .insertInto (io .airbyte .db .instance .jobs .jooq .generated .Tables .JOBS )
462
+ .set (io .airbyte .db .instance .jobs .jooq .generated .Tables .JOBS .ID , 8L )
463
+ .set (io .airbyte .db .instance .jobs .jooq .generated .Tables .JOBS .CONFIG_TYPE ,
464
+ io .airbyte .db .instance .jobs .jooq .generated .enums .JobConfigType .sync )
465
+ .set (io .airbyte .db .instance .jobs .jooq .generated .Tables .JOBS .SCOPE , pausedWithJobSucceededConnection .getConnectionId ().toString ())
466
+ .set (io .airbyte .db .instance .jobs .jooq .generated .Tables .JOBS .STATUS , io .airbyte .db .instance .jobs .jooq .generated .enums .JobStatus .succeeded )
467
+ .set (io .airbyte .db .instance .jobs .jooq .generated .Tables .JOBS .CREATED_AT , now .minusHours (2 ))
468
+ .set (io .airbyte .db .instance .jobs .jooq .generated .Tables .JOBS .UPDATED_AT , now .minusHours (2 ))
469
+ .set (io .airbyte .db .instance .jobs .jooq .generated .Tables .JOBS .CONFIG , org .jooq .impl .DSL .field ("'{}'::jsonb" , org .jooq .JSONB .class ))
470
+ .execute ();
471
+
455
472
return null ;
456
473
});
457
474
@@ -461,7 +478,7 @@ void testGetConnectionStatusCounts() throws IOException, JsonValidationException
461
478
assertEquals (1 , result .healthy ());
462
479
// failedConnection + cancelledConnection + incompleteConnection
463
480
assertEquals (3 , result .failed ());
464
- assertEquals (1 , result .paused ());
481
+ assertEquals (2 , result .paused ());
465
482
// notSyncedConnection (active connection with no jobs)
466
483
assertEquals (1 , result .notSynced ());
467
484
}
0 commit comments