Jonathan Jogenfors 1 年間 前
コミット
56b6ecb8a4

+ 11 - 26
server/test/e2e/library2.e2e-spec.ts

@@ -8,50 +8,36 @@ import { db } from '@test/db';
 import { sleep } from '@test/test-utils';
 import { AppService as MicroAppService } from 'src/microservices/app.service';
 
-import { MicroservicesModule } from 'src/microservices/microservices.module';
+import { MetadataExtractionProcessor } from 'src/microservices/processors/metadata-extraction.processor';
 
 describe('libe2e', () => {
   let app: INestApplication;
 
-  let microServices: INestApplication;
-
   let jobService: JobService;
 
   let server: any;
 
   let moduleFixture: TestingModule;
-  let microFixture: TestingModule;
 
   let admin: LoginResponseDto;
 
   beforeAll(async () => {
-    process.env.TYPESENSE_ENABLED = 'false';
-    process.env.IMMICH_MACHINE_LEARNING_ENABLED = 'false';
-
     jest.useRealTimers();
 
     moduleFixture = await Test.createTestingModule({
       imports: [AppModule],
-    }).compile();
-
-    microFixture = await Test.createTestingModule({
-      imports: [MicroservicesModule],
+      providers: [MetadataExtractionProcessor, MicroAppService],
     }).compile();
 
     app = moduleFixture.createNestApplication();
-    server = app.getHttpServer();
 
     await app.init();
     app.enableShutdownHooks();
+    server = app.getHttpServer();
 
     jobService = moduleFixture.get(JobService);
 
-    microServices = microFixture.createNestApplication();
-
-    await microServices.init();
-    microServices.enableShutdownHooks();
-
-    await microFixture.get(MicroAppService).init();
+    await moduleFixture.get(MicroAppService).init();
   });
 
   describe('can import library', () => {
@@ -71,6 +57,8 @@ describe('libe2e', () => {
         exclusionPatterns: [],
       });
 
+      console.log(await api.libraryApi.getAll(server, admin.accessToken));
+
       // We expect https://github.com/etnoy/immich-test-assets to be cloned into the e2e/assets folder
 
       await api.libraryApi.scanLibrary(server, admin.accessToken, library.id, {});
@@ -78,24 +66,23 @@ describe('libe2e', () => {
       let isFinished = false;
       // TODO: this shouldn't be a while loop
       while (!isFinished) {
-        await sleep(100);
-
         const jobStatus = await api.jobApi.getAllJobsStatus(server, admin.accessToken);
-        console.log(jobStatus.library);
 
         let jobsActive = false;
         Object.values(jobStatus).forEach((job) => {
           if (job.queueStatus.isActive) {
             jobsActive = true;
           }
+          if (job.queueStatus.active > 0 || job.queueStatus.waiting > 0) {
+            jobsActive = true;
+          }
         });
 
-        if (!jobsActive && jobStatus[QueueName.LIBRARY].jobCounts.completed > 0) {
+        if (!jobsActive) {
           isFinished = true;
         }
-        isFinished = true;
 
-        await sleep(5000);
+        await sleep(200);
       }
     });
 
@@ -112,8 +99,6 @@ describe('libe2e', () => {
   afterAll(async () => {
     await db.disconnect();
     await app.close();
-    await microServices.close();
     await moduleFixture.close();
-    await microFixture.close();
   });
 });

+ 3 - 3
server/test/e2e/server-info.e2e-spec.ts

@@ -81,16 +81,16 @@ describe(`${ServerInfoController.name} (e2e)`, () => {
       const { status, body } = await request(server).get('/server-info/features');
       expect(status).toBe(200);
       expect(body).toEqual({
-        clipEncode: true,
+        clipEncode: false,
         configFile: false,
-        facialRecognition: true,
+        facialRecognition: false,
         map: true,
         oauth: false,
         oauthAutoLaunch: false,
         passwordLogin: true,
         search: false,
         sidecar: true,
-        tagImage: true,
+        tagImage: false,
       });
     });
   });

+ 1 - 0
server/test/e2e/setup.ts

@@ -3,6 +3,7 @@ import { GenericContainer } from 'testcontainers';
 export default async () => {
   process.env.NODE_ENV = 'development';
   process.env.TYPESENSE_ENABLED = 'false';
+  process.env.IMMICH_MACHINE_LEARNING_ENABLED = 'false';
 
   const pg = await new PostgreSqlContainer('postgres')
     .withExposedPorts(5432)