From 128b2787a603995215417113fe64d8fd507e9c09 Mon Sep 17 00:00:00 2001 From: Harold Thetiot Date: Mon, 10 Dec 2018 11:46:07 -0800 Subject: [PATCH 1/2] implement basic SETTINGS_MAX_CONCURRENT_STREAMS spec with TODO --- test/http.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/test/http.js b/test/http.js index ec73c79..9b58809 100644 --- a/test/http.js +++ b/test/http.js @@ -799,6 +799,47 @@ describe('http.js', function() { }); }); }); + describe('2 simple request in parallel shoudl fail if SETTINGS_MAX_CONCURRENT_STREAMS=1', function() { + it('should work as expected', function(originalDone) { + var path = '/x'; + var message = 'Hello world'; + var done = util.callNTimes(2, function() { + server.close(); + originalDone(); + }); + + var server = http2.createServer(serverOptions, function(request, response) { + expect(request.url).to.equal(path); + response.end(message); + }); + + http2.globalAgent = new http2.Agent(Object.assign({ + log: util.clientLog, + settings: { + SETTINGS_MAX_CONCURRENT_STREAMS: 1 + } + }, agentOptions)); + + var start = Date.now(); + + server.listen(1234, function() { + http2.get('https://localhost:1234' + path, function(response) { + response.on('data', function(data) { + expect(data.toString()).to.equal(message); + done(); + }); + }); + http2.get('https://localhost:1234' + path, function(response) { + // TODO assert and expect queueing on globalAgent->Endpoint->Connection + response.on('data', function(data) { + console.log(Date.now() - start); + expect(data.toString()).to.equal(message); + done(); + }); + }); + }); + }); + }); describe('100 simple request in a series', function() { it('should work as expected', function(done) { var path = '/x'; From a7c72b26c1562cbd4be715af8f7ba159cd0988d9 Mon Sep 17 00:00:00 2001 From: Harold Thetiot Date: Mon, 10 Dec 2018 11:50:03 -0800 Subject: [PATCH 2/2] fix spec name typo --- test/http.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/http.js b/test/http.js index 9b58809..a676725 100644 --- a/test/http.js +++ b/test/http.js @@ -799,7 +799,7 @@ describe('http.js', function() { }); }); }); - describe('2 simple request in parallel shoudl fail if SETTINGS_MAX_CONCURRENT_STREAMS=1', function() { + describe('2 simple request in parallel should fail if SETTINGS_MAX_CONCURRENT_STREAMS=1', function() { it('should work as expected', function(originalDone) { var path = '/x'; var message = 'Hello world';