Skip to content

Commit 5844f79

Browse files
authored
Simplify and even e2e tests timeouts (#921)
1 parent f092160 commit 5844f79

File tree

7 files changed

+1
-52
lines changed

7 files changed

+1
-52
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ check: node_modules/.dirstamp
6363
@$(NODE) util/test-compile.js
6464

6565
e2e: $(E2E_TESTS)
66-
@./node_modules/.bin/mocha --exit $(TEST_REPORTER) $(E2E_TESTS) $(TEST_OUTPUT)
66+
@./node_modules/.bin/mocha --exit --timeout 120000 $(TEST_REPORTER) $(E2E_TESTS) $(TEST_OUTPUT)
6767

6868
define release
6969
NEXT_VERSION=$(shell node -pe 'require("semver").inc("$(VERSION)", "$(1)")')

e2e/admin.spec.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ describe('Admin', function() {
9090
});
9191

9292
beforeEach(function() {
93-
this.timeout(10000);
9493
client = Kafka.AdminClient.create({
9594
'client.id': 'kafka-test',
9695
'metadata.broker.list': kafkaBrokerList
@@ -100,7 +99,6 @@ describe('Admin', function() {
10099
describe('createTopic', function() {
101100
it('should create topic sucessfully', function(done) {
102101
var topicName = 'admin-test-topic-' + time;
103-
this.timeout(30000);
104102
client.createTopic({
105103
topic: topicName,
106104
num_partitions: 1,
@@ -115,7 +113,6 @@ describe('Admin', function() {
115113

116114
it('should raise an error when replication_factor is larger than number of brokers', function(done) {
117115
var topicName = 'admin-test-topic-bad-' + time;
118-
this.timeout(30000);
119116
client.createTopic({
120117
topic: topicName,
121118
num_partitions: 9999,
@@ -130,7 +127,6 @@ describe('Admin', function() {
130127
describe('deleteTopic', function() {
131128
it('should be able to delete a topic after creation', function(done) {
132129
var topicName = 'admin-test-topic-2bdeleted-' + time;
133-
this.timeout(30000);
134130
client.createTopic({
135131
topic: topicName,
136132
num_partitions: 1,
@@ -151,7 +147,6 @@ describe('Admin', function() {
151147
describe('createPartitions', function() {
152148
it('should be able to add partitions to a topic after creation', function(done) {
153149
var topicName = 'admin-test-topic-newparts-' + time;
154-
this.timeout(30000);
155150
client.createTopic({
156151
topic: topicName,
157152
num_partitions: 1,
@@ -173,7 +168,6 @@ describe('Admin', function() {
173168

174169
it('should NOT be able to reduce partitions to a topic after creation', function(done) {
175170
var topicName = 'admin-test-topic-newparts2-' + time;
176-
this.timeout(30000);
177171
client.createTopic({
178172
topic: topicName,
179173
num_partitions: 4,

e2e/both.spec.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ describe('Consumer/Producer', function() {
8585
});
8686

8787
afterEach(function(done) {
88-
this.timeout(6000);
8988
var finished = 0;
9089
var called = false;
9190

@@ -115,7 +114,6 @@ describe('Consumer/Producer', function() {
115114
});
116115

117116
it('should be able to produce, consume messages, read position: subscribe/consumeOnce', function(done) {
118-
this.timeout(8000);
119117
crypto.randomBytes(4096, function(ex, buffer) {
120118
producer.setPollInterval(10);
121119

@@ -167,7 +165,6 @@ describe('Consumer/Producer', function() {
167165
});
168166

169167
it('should return ready messages on partition EOF', function(done) {
170-
this.timeout(8000);
171168
crypto.randomBytes(4096, function(ex, buffer) {
172169
producer.setPollInterval(10);
173170

@@ -210,7 +207,6 @@ describe('Consumer/Producer', function() {
210207
});
211208

212209
it('should emit partition.eof event when reaching end of partition', function(done) {
213-
this.timeout(8000);
214210
crypto.randomBytes(4096, function(ex, buffer) {
215211
producer.setPollInterval(10);
216212

@@ -244,7 +240,6 @@ describe('Consumer/Producer', function() {
244240
});
245241

246242
it('should emit partition.eof when already at end of partition', function(done) {
247-
this.timeout(8000);
248243
crypto.randomBytes(4096, function(ex, buffer) {
249244
producer.setPollInterval(10);
250245

@@ -280,8 +275,6 @@ describe('Consumer/Producer', function() {
280275
it('should be able to produce and consume messages: consumeLoop', function(done) {
281276
var key = 'key';
282277

283-
this.timeout(5000);
284-
285278
crypto.randomBytes(4096, function(ex, buffer) {
286279

287280
producer.setPollInterval(10);
@@ -313,7 +306,6 @@ describe('Consumer/Producer', function() {
313306
});
314307

315308
it('should emit \'partition.eof\' events in consumeLoop', function(done) {
316-
this.timeout(7000);
317309

318310
crypto.randomBytes(4096, function(ex, buffer) {
319311
producer.setPollInterval(10);
@@ -384,31 +376,27 @@ describe('Consumer/Producer', function() {
384376
var headers = [
385377
{ key: "value" }
386378
];
387-
this.timeout(5000);
388379
run_headers_test(done, headers);
389380
});
390381

391382
it('should be able to produce and consume messages with one header value as buffer: consumeLoop', function(done) {
392383
var headers = [
393384
{ key: Buffer.from('value') }
394385
];
395-
this.timeout(5000);
396386
run_headers_test(done, headers);
397387
});
398388

399389
it('should be able to produce and consume messages with one header value as int: consumeLoop', function(done) {
400390
var headers = [
401391
{ key: 10 }
402392
];
403-
this.timeout(5000);
404393
run_headers_test(done, headers);
405394
});
406395

407396
it('should be able to produce and consume messages with one header value as float: consumeLoop', function(done) {
408397
var headers = [
409398
{ key: 1.11 }
410399
];
411-
this.timeout(5000);
412400
run_headers_test(done, headers);
413401
});
414402

@@ -419,7 +407,6 @@ describe('Consumer/Producer', function() {
419407
{ key3: Buffer.from('value3') },
420408
{ key4: Buffer.from('value4') },
421409
];
422-
this.timeout(5000);
423410
run_headers_test(done, headers);
424411
});
425412

@@ -430,7 +417,6 @@ describe('Consumer/Producer', function() {
430417
{ key3: 'value3' },
431418
{ key4: 'value4' },
432419
];
433-
this.timeout(5000);
434420
run_headers_test(done, headers);
435421
});
436422

@@ -441,12 +427,10 @@ describe('Consumer/Producer', function() {
441427
{ key3: 100 },
442428
{ key4: 10.1 },
443429
];
444-
this.timeout(5000);
445430
run_headers_test(done, headers);
446431
});
447432

448433
it('should be able to produce and consume messages: empty buffer key and empty value', function(done) {
449-
this.timeout(20000);
450434
var emptyString = '';
451435
var key = Buffer.from(emptyString);
452436
var value = Buffer.from('');
@@ -469,7 +453,6 @@ describe('Consumer/Producer', function() {
469453
});
470454

471455
it('should be able to produce and consume messages: empty key and empty value', function(done) {
472-
this.timeout(20000);
473456
var key = '';
474457
var value = Buffer.from('');
475458

@@ -491,7 +474,6 @@ describe('Consumer/Producer', function() {
491474
});
492475

493476
it('should be able to produce and consume messages: null key and null value', function(done) {
494-
this.timeout(20000);
495477
var key = null;
496478
var value = null;
497479

@@ -538,14 +520,12 @@ describe('Consumer/Producer', function() {
538520
});
539521

540522
afterEach(function(done) {
541-
this.timeout(10000);
542523
consumer.disconnect(function() {
543524
done();
544525
});
545526
});
546527

547528
it('should async commit after consuming', function(done) {
548-
this.timeout(25000);
549529
var key = '';
550530
var value = Buffer.from('');
551531

@@ -596,15 +576,12 @@ describe('Consumer/Producer', function() {
596576
var grp = 'kafka-mocha-grp-' + crypto.randomBytes(20).toString('hex');
597577

598578
afterEach(function(done) {
599-
this.timeout(10000);
600579
consumer.disconnect(function() {
601580
done();
602581
});
603582
});
604583

605584
it('should callback offset_commit_cb after commit', function(done) {
606-
this.timeout(20000);
607-
608585
var consumerOpts = {
609586
'metadata.broker.list': kafkaBrokerList,
610587
'group.id': grp,

e2e/consumer.spec.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ describe('Consumer', function() {
110110
});
111111

112112
it('after assign and commit, should get committed offsets', function(done) {
113-
this.timeout(6000);
114113
consumer.assign([{topic:topic, partition:0}]);
115114
consumer.commitSync({topic:topic, partition:0, offset:1000});
116115
consumer.committed(null, 1000, function(err, committed) {
@@ -301,8 +300,6 @@ describe('Consumer', function() {
301300
});
302301

303302
it('should happen without issue after consuming', function(cb) {
304-
this.timeout(11000);
305-
306303
var consumer = new KafkaConsumer(gcfg, tcfg);
307304
consumer.setDefaultConsumeTimeout(10000);
308305

e2e/groups.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ describe('Consumer group/Producer', function() {
6868
});
6969

7070
it('should be able to commit, read committed and restart from the committed offset', function(done) {
71-
this.timeout(30000);
7271
var topic = 'test';
7372
var key = 'key';
7473
var payload = Buffer.from('value');

e2e/producer-transaction.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ var Kafka = require('../');
1212
var kafkaBrokerList = process.env.KAFKA_HOST || 'localhost:9092';
1313

1414
describe('Transactional Producer', function () {
15-
this.timeout(5000);
1615
var TRANSACTIONS_TIMEOUT_MS = 30000;
1716
var r = Date.now() + '_' + Math.round(Math.random() * 1000);
1817
var topicIn = 'transaction_input_' + r;

e2e/producer.spec.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ describe('Producer', function() {
5959
});
6060

6161
it('should produce a message with a null payload and null key', function(done) {
62-
this.timeout(3000);
63-
6462
var tt = setInterval(function() {
6563
producer.poll();
6664
}, 200);
@@ -80,8 +78,6 @@ describe('Producer', function() {
8078
});
8179

8280
it('should produce a message with a payload and key', function(done) {
83-
this.timeout(3000);
84-
8581
var tt = setInterval(function() {
8682
producer.poll();
8783
}, 200);
@@ -102,8 +98,6 @@ describe('Producer', function() {
10298
});
10399

104100
it('should produce a message with a payload and key buffer', function(done) {
105-
this.timeout(3000);
106-
107101
var tt = setInterval(function() {
108102
producer.poll();
109103
}, 200);
@@ -124,8 +118,6 @@ describe('Producer', function() {
124118
});
125119

126120
it('should produce a message with an opaque', function(done) {
127-
this.timeout(3000);
128-
129121
var tt = setInterval(function() {
130122
producer.poll();
131123
}, 200);
@@ -146,8 +138,6 @@ describe('Producer', function() {
146138

147139

148140
it('should get 100% deliverability', function(done) {
149-
this.timeout(3000);
150-
151141
var total = 0;
152142
var max = 10000;
153143
var verified_received = 0;
@@ -202,8 +192,6 @@ describe('Producer', function() {
202192
});
203193

204194
it('should produce a message with a payload and key', function(done) {
205-
this.timeout(3000);
206-
207195
var tt = setInterval(function() {
208196
producer.poll();
209197
}, 200);
@@ -224,8 +212,6 @@ describe('Producer', function() {
224212
});
225213

226214
it('should produce a message with an empty payload and empty key (https://github.com/Blizzard/node-rdkafka/issues/117)', function(done) {
227-
this.timeout(3000);
228-
229215
var tt = setInterval(function() {
230216
producer.poll();
231217
}, 200);
@@ -247,8 +233,6 @@ describe('Producer', function() {
247233
});
248234

249235
it('should produce a message with a null payload and null key (https://github.com/Blizzard/node-rdkafka/issues/117)', function(done) {
250-
this.timeout(3000);
251-
252236
producer.setPollInterval(10);
253237

254238
producer.once('delivery-report', function(err, report) {
@@ -292,7 +276,6 @@ describe('Producer', function() {
292276

293277
producer.produce('test', null, null, Buffer.from(arr.buffer));
294278

295-
this.timeout(3000);
296279
});
297280

298281
});

0 commit comments

Comments
 (0)