test: server-info e2e tests (#3948)

This commit is contained in:
Jason Rasmussen
2023-09-01 22:01:54 -04:00
committed by GitHub
parent b7fd5dcb4a
commit 4e5bf7ae2e
7 changed files with 176 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
import { DomainModule } from '@app/domain';
import { InfraModule } from '@app/infra';
import { AssetEntity, ExifEntity } from '@app/infra/entities';
import { Module } from '@nestjs/common';
import { Module, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
import { APP_GUARD } from '@nestjs/core';
import { ScheduleModule } from '@nestjs/schedule';
import { TypeOrmModule } from '@nestjs/typeorm';
@@ -66,4 +66,14 @@ import {
FileUploadInterceptor,
],
})
export class AppModule {}
export class AppModule implements OnModuleInit, OnModuleDestroy {
constructor(private appService: AppService) {}
async onModuleInit() {
await this.appService.init();
}
onModuleDestroy() {
this.appService.destroy();
}
}

View File

@@ -23,4 +23,8 @@ export class AppService {
await this.searchService.init();
this.logger.log(`Feature Flags: ${JSON.stringify(await this.serverService.getFeatures(), null, 2)}`);
}
async destroy() {
this.searchService.teardown();
}
}

View File

@@ -6,7 +6,6 @@ import { NestExpressApplication } from '@nestjs/platform-express';
import { json } from 'body-parser';
import cookieParser from 'cookie-parser';
import { AppModule } from './app.module';
import { AppService } from './app.service';
import { useSwagger } from './app.utils';
const logger = new Logger('ImmichServer');
@@ -27,7 +26,6 @@ export async function bootstrap() {
app.useWebSocketAdapter(new RedisIoAdapter(app));
useSwagger(app, isDev);
await app.get(AppService).init();
const server = await app.listen(port);
server.requestTimeout = 30 * 60 * 1000;