From 63789db62cc5a7d92e17feb423d2f2b261af8878 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 23 Jan 2019 06:47:12 -0800 Subject: [PATCH] test: fix renegotiation tests in pummel With a recent OpenSSL update to core, a change in the behavior of `s_client` result in pummel test failures because they spam with renegotiation requests before the renegotiation is complete. Modify tests to reduce initial spamming. This fixes the TLS renegotiation test. While it fixes the bug in the HTTPS test too, that is still failing with the OpenSSL update for other (too-be-determined) reasons. Refs: https://github.com/nodejs/node/pull/25381#issuecomment-456822479 --- test/pummel/test-https-ci-reneg-attack.js | 6 +++++- test/pummel/test-tls-ci-reneg-attack.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/pummel/test-https-ci-reneg-attack.js b/test/pummel/test-https-ci-reneg-attack.js index 50e16192e1b1ca..6faafe5a5ee287 100644 --- a/test/pummel/test-https-ci-reneg-attack.js +++ b/test/pummel/test-https-ci-reneg-attack.js @@ -73,10 +73,14 @@ function test(next) { // Count handshakes, start the attack after the initial handshake is done let handshakes = 0; let renegs = 0; + let waitingToSpam = true; child.stderr.on('data', function(data) { handshakes += ((String(data)).match(/verify return:1/g) || []).length; - if (handshakes === 2) spam(); + if (handshakes === 2 && waitingToSpam) { + waitingToSpam = false; + spam(); + } renegs += ((String(data)).match(/RENEGOTIATING/g) || []).length; }); diff --git a/test/pummel/test-tls-ci-reneg-attack.js b/test/pummel/test-tls-ci-reneg-attack.js index 3509dcfd43f853..00d5dfed482b52 100644 --- a/test/pummel/test-tls-ci-reneg-attack.js +++ b/test/pummel/test-tls-ci-reneg-attack.js @@ -73,11 +73,15 @@ function test(next) { // Count handshakes, start the attack after the initial handshake is done let handshakes = 0; let renegs = 0; + let waitingToSpam = true; child.stderr.on('data', function(data) { if (seenError) return; handshakes += ((String(data)).match(/verify return:1/g) || []).length; - if (handshakes === 2) spam(); + if (handshakes === 2 && waitingToSpam) { + waitingToSpam = false; + spam(); + } renegs += ((String(data)).match(/RENEGOTIATING/g) || []).length; });