Skip to content

Commit ffd602f

Browse files
committed
Merge remote-tracking branch 'Nest/master' into 2984-kafka-reply-partitions
2 parents badae7b + be4e50f commit ffd602f

113 files changed

Lines changed: 169312 additions & 419 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

integration/docker-compose.yml

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
version: "3"
22

33
services:
4-
redis:
5-
container_name: test-redis
6-
image: redis
7-
ports:
8-
- "6379:6379"
9-
restart: always
10-
nats:
11-
container_name: test-nats
12-
image: nats
13-
ports:
14-
- "8222:8222"
15-
- "4222:4222"
16-
- "6222:6222"
17-
restart: always
18-
mqtt:
19-
container_name: test-mqtt
20-
image: toke/mosquitto
21-
ports:
22-
- "1883:1883"
23-
- "9001:9001"
24-
restart: always
25-
mysql:
26-
image: mysql:5.7.31
27-
environment:
28-
MYSQL_ROOT_PASSWORD: root
29-
MYSQL_DATABASE: test
30-
ports:
31-
- "3306:3306"
32-
restart: always
33-
mongodb:
34-
container_name: test-mongodb
35-
image: mongo:latest
36-
environment:
37-
- MONGODB_DATABASE="test"
38-
ports:
39-
- 27017:27017
40-
rabbit:
41-
container_name: test-rabbit
42-
hostname: rabbit
43-
image: "rabbitmq:management"
44-
ports:
45-
- "15672:15672"
46-
- "5672:5672"
47-
tty: true
4+
# redis:
5+
# container_name: test-redis
6+
# image: redis
7+
# ports:
8+
# - "6379:6379"
9+
# restart: always
10+
# nats:
11+
# container_name: test-nats
12+
# image: nats
13+
# ports:
14+
# - "8222:8222"
15+
# - "4222:4222"
16+
# - "6222:6222"
17+
# restart: always
18+
# mqtt:
19+
# container_name: test-mqtt
20+
# image: toke/mosquitto
21+
# ports:
22+
# - "1883:1883"
23+
# - "9001:9001"
24+
# restart: always
25+
# mysql:
26+
# image: mysql:5.7.31
27+
# environment:
28+
# MYSQL_ROOT_PASSWORD: root
29+
# MYSQL_DATABASE: test
30+
# ports:
31+
# - "3306:3306"
32+
# restart: always
33+
# mongodb:
34+
# container_name: test-mongodb
35+
# image: mongo:latest
36+
# environment:
37+
# - MONGODB_DATABASE="test"
38+
# ports:
39+
# - 27017:27017
40+
# rabbit:
41+
# container_name: test-rabbit
42+
# hostname: rabbit
43+
# image: "rabbitmq:management"
44+
# ports:
45+
# - "15672:15672"
46+
# - "5672:5672"
47+
# tty: true
4848
zookeeper:
4949
container_name: test-zookeeper
5050
hostname: zookeeper
@@ -70,3 +70,4 @@ services:
7070
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
7171
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
7272
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
73+
KAFKA_DELETE_TOPIC_ENABLE: 'true'

integration/hello-world/e2e/fastify-adapter.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ describe('Hello world (fastify adapter)', () => {
6363
});
6464
});
6565

66+
it(`/GET inject with LightMyRequest chaining API`, () => {
67+
return app
68+
.inject()
69+
.get('/hello')
70+
.end()
71+
.then(({ payload }) => expect(payload).to.be.eql('Hello world!'));
72+
});
73+
6674
afterEach(async () => {
6775
await app.close();
6876
});

integration/microservices/e2e/orders-grpc.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ describe('Advanced GRPC transport', () => {
113113
it('GRPC Sending and receiving Stream from RX handler', async () => {
114114
const callHandler = client.sync();
115115

116+
// Get Set-Cookie from Metadata
117+
callHandler.on('metadata', (metadata: GRPC.Metadata) => {
118+
expect(metadata.get('Set-Cookie')[0]).to.eq('test_cookie=abcd');
119+
});
120+
116121
callHandler.on('data', (msg: number) => {
117122
// Do deep comparison (to.eql)
118123
expect(msg).to.eql({

integration/microservices/src/grpc-advanced/advanced.grpc.controller.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
} from '@nestjs/microservices';
1010
import { join } from 'path';
1111
import { Observable, of, ReplaySubject, Subject } from 'rxjs';
12+
import { Metadata } from 'grpc';
1213

1314
@Controller()
1415
export class AdvancedGrpcController {
@@ -84,7 +85,16 @@ export class AdvancedGrpcController {
8485
* @param messages
8586
*/
8687
@GrpcStreamMethod('orders.OrderService')
87-
async sync(messages: Observable<any>): Promise<any> {
88+
async sync(
89+
messages: Observable<any>,
90+
metadata: Metadata,
91+
call: any,
92+
): Promise<any> {
93+
// Set Set-Cookie from Metadata
94+
const srvMetadata = new Metadata();
95+
srvMetadata.add('Set-Cookie', 'test_cookie=abcd');
96+
call.sendMetadata(srvMetadata);
97+
8898
const s = new Subject();
8999
const o = s.asObservable();
90100
messages.subscribe(msg => {

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"packages": [
44
"packages/*"
55
],
6-
"version": "7.4.4"
6+
"version": "7.5.0"
77
}

notes.tmp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
nyc --require ts-node/register mocha packages/microservices/test/helpers/kafka-round-robin-by-time-partition-assigner.spec.ts --reporter spec --retries 3 --require 'node_modules/reflect-metadata/Reflect.js' --exit
2+
3+
4+
./node_modules/.bin/nyc --require ts-node/register ./node_modules/.bin/mocha packages/microservices/test/helpers/kafka-round-robin-by-time-partition-assigner.spec.ts --reporter spec --retries 3 --require './node_modules/reflect-metadata/Reflect.js' --exit
5+
6+
7+
./node_modules/.bin/mocha \"integration/microservices/e2e/sum-kafka.spec.ts\" --reporter spec --require ts-node/register --require './node_modules/reflect-metadata/Reflect.js' --exit

0 commit comments

Comments
 (0)