Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable not used queues/database modules on E2E tests #2082

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/datasources/queues/queues-api.shutdown.hook.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { QueueConsumer } from '@/datasources/queues/queues-api.module';
import { ILoggingService, LoggingService } from '@/logging/logging.interface';
import { asError } from '@/logging/utils';
import { Inject, Injectable, OnModuleDestroy } from '@nestjs/common';

@Injectable()
Expand All @@ -11,7 +12,13 @@ export class QueuesApiShutdownHook implements OnModuleDestroy {

async onModuleDestroy(): Promise<void> {
this.loggingService.info('Closing connection to queues');
await this.queueConsumer.channel.close();
this.loggingService.info('Connection to queues closed');
try {
await this.queueConsumer.channel.close();
this.loggingService.info('Connection to queues closed');
} catch (err) {
this.loggingService.error(
`Failed to close connection to queues: ${asError(err)}`,
);
}
}
}
8 changes: 8 additions & 0 deletions src/routes/about/__tests__/get-about.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import type { Server } from 'net';
import request from 'supertest';
import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.module';
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.postgres-database.module';
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { TestQueuesApiModule } from '@/datasources/queues/__tests__/test.queues-api.module';
import { QueuesApiModule } from '@/datasources/queues/queues-api.module';

describe('Get about e2e test', () => {
let app: INestApplication<Server>;
Expand All @@ -19,8 +23,12 @@ describe('Get about e2e test', () => {
})
.overrideProvider(CacheKeyPrefix)
.useValue(cacheKeyPrefix)
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(PostgresDatabaseModuleV2)
.useModule(TestPostgresDatabaseModuleV2)
.overrideModule(QueuesApiModule)
.useModule(TestQueuesApiModule)
.compile();

app = moduleRef.createNestApplication();
Expand Down
8 changes: 8 additions & 0 deletions src/routes/contracts/__tests__/get-contract.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import { CacheKeyPrefix } from '@/datasources/cache/constants';
import type { Server } from 'net';
import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.module';
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.postgres-database.module';
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { TestQueuesApiModule } from '@/datasources/queues/__tests__/test.queues-api.module';
import { QueuesApiModule } from '@/datasources/queues/queues-api.module';

describe('Get contract e2e test', () => {
let app: INestApplication<Server>;
Expand All @@ -22,8 +26,12 @@ describe('Get contract e2e test', () => {
})
.overrideProvider(CacheKeyPrefix)
.useValue(cacheKeyPrefix)
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(PostgresDatabaseModuleV2)
.useModule(TestPostgresDatabaseModuleV2)
.overrideModule(QueuesApiModule)
.useModule(TestQueuesApiModule)
.compile();

app = await new TestAppProvider().provide(moduleRef);
Expand Down
8 changes: 8 additions & 0 deletions src/routes/data-decode/__tests__/data-decode.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import { CacheKeyPrefix } from '@/datasources/cache/constants';
import type { Server } from 'net';
import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.module';
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.postgres-database.module';
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { TestQueuesApiModule } from '@/datasources/queues/__tests__/test.queues-api.module';
import { QueuesApiModule } from '@/datasources/queues/queues-api.module';

describe('Data decode e2e tests', () => {
let app: INestApplication<Server>;
Expand All @@ -22,8 +26,12 @@ describe('Data decode e2e tests', () => {
})
.overrideProvider(CacheKeyPrefix)
.useValue(cacheKeyPrefix)
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(PostgresDatabaseModuleV2)
.useModule(TestPostgresDatabaseModuleV2)
.overrideModule(QueuesApiModule)
.useModule(TestQueuesApiModule)
.compile();

app = await new TestAppProvider().provide(moduleRef);
Expand Down
8 changes: 8 additions & 0 deletions src/routes/health/__tests__/get-health.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import { CacheKeyPrefix } from '@/datasources/cache/constants';
import type { Server } from 'net';
import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.module';
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.postgres-database.module';
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { TestQueuesApiModule } from '@/datasources/queues/__tests__/test.queues-api.module';
import { QueuesApiModule } from '@/datasources/queues/queues-api.module';

describe('Get health e2e test', () => {
let app: INestApplication<Server>;
Expand All @@ -18,8 +22,12 @@ describe('Get health e2e test', () => {
})
.overrideProvider(CacheKeyPrefix)
.useValue(cacheKeyPrefix)
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(PostgresDatabaseModuleV2)
.useModule(TestPostgresDatabaseModuleV2)
.overrideModule(QueuesApiModule)
.useModule(TestQueuesApiModule)
.compile();
app = await new TestAppProvider().provide(moduleRef);
await app.init();
Expand Down
4 changes: 4 additions & 0 deletions src/routes/hooks/__tests__/event-hooks-queue.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { TEST_SAFE } from '@/routes/common/__tests__/constants';
import { chainBuilder } from '@/domain/chains/entities/__tests__/chain.builder';
import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.module';
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.postgres-database.module';
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';

describe('Events queue processing e2e tests', () => {
let app: INestApplication<Server>;
Expand All @@ -41,6 +43,8 @@ describe('Events queue processing e2e tests', () => {
})
.overrideProvider(CacheKeyPrefix)
.useValue(cacheKeyPrefix)
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(PostgresDatabaseModuleV2)
.useModule(TestPostgresDatabaseModuleV2)
.compile();
Expand Down
8 changes: 8 additions & 0 deletions src/routes/owners/__tests__/get-safes-by-owner.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import type { Server } from 'net';
import { TEST_SAFE } from '@/routes/common/__tests__/constants';
import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.module';
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.postgres-database.module';
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { TestQueuesApiModule } from '@/datasources/queues/__tests__/test.queues-api.module';
import { QueuesApiModule } from '@/datasources/queues/queues-api.module';

describe('Get safes by owner e2e test', () => {
let app: INestApplication<Server>;
Expand All @@ -21,8 +25,12 @@ describe('Get safes by owner e2e test', () => {
})
.overrideProvider(CacheKeyPrefix)
.useValue(cacheKeyPrefix)
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(PostgresDatabaseModuleV2)
.useModule(TestPostgresDatabaseModuleV2)
.overrideModule(QueuesApiModule)
.useModule(TestQueuesApiModule)
.compile();

app = moduleRef.createNestApplication();
Expand Down
8 changes: 8 additions & 0 deletions src/routes/safe-apps/__tests__/get-safe-apps.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import type { SafeApp } from '@/routes/safe-apps/entities/safe-app.entity';
import type { Server } from 'net';
import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.module';
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.postgres-database.module';
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { TestQueuesApiModule } from '@/datasources/queues/__tests__/test.queues-api.module';
import { QueuesApiModule } from '@/datasources/queues/queues-api.module';

describe('Get Safe Apps e2e test', () => {
let app: INestApplication<Server>;
Expand All @@ -23,8 +27,12 @@ describe('Get Safe Apps e2e test', () => {
})
.overrideProvider(CacheKeyPrefix)
.useValue(cacheKeyPrefix)
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(PostgresDatabaseModuleV2)
.useModule(TestPostgresDatabaseModuleV2)
.overrideModule(QueuesApiModule)
.useModule(TestQueuesApiModule)
.compile();

app = await new TestAppProvider().provide(moduleRef);
Expand Down