()
| 23 | this.timeout(30000); |
| 24 | |
| 25 | const startServer = async () => { |
| 26 | const module = await Test.createTestingModule({ |
| 27 | controllers: [ |
| 28 | KafkaConcurrentController, |
| 29 | KafkaConcurrentMessagesController, |
| 30 | ], |
| 31 | }).compile(); |
| 32 | |
| 33 | // use our own logger for a little |
| 34 | // Logger.overrideLogger(new Logger()); |
| 35 | |
| 36 | const app = module.createNestApplication(); |
| 37 | |
| 38 | const server = app.getHttpAdapter().getInstance(); |
| 39 | |
| 40 | app.connectMicroservice<MicroserviceOptions>({ |
| 41 | transport: Transport.KAFKA, |
| 42 | options: { |
| 43 | client: { |
| 44 | brokers: ['localhost:9092'], |
| 45 | }, |
| 46 | run: { |
| 47 | partitionsConsumedConcurrently: numbersOfServers, |
| 48 | }, |
| 49 | }, |
| 50 | }); |
| 51 | |
| 52 | // enable these for clean shutdown |
| 53 | app.enableShutdownHooks(); |
| 54 | |
| 55 | // push to the collection |
| 56 | servers.push(server); |
| 57 | apps.push(app); |
| 58 | |
| 59 | // await the start |
| 60 | await app.startAllMicroservices(); |
| 61 | await app.init(); |
| 62 | }; |
| 63 | |
| 64 | it(`Create kafka topics/partitions`, async () => { |
| 65 | const kafka = new Kafka({ |
no test coverage detected