From 8d86d84ff5b5cba758bd0b848db2bc33bfab9f50 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Wed, 1 Sep 2021 15:58:29 -0700 Subject: [PATCH] ci: fix setCertificateVerifyProc tests (#30799) --- spec-main/api-session-spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec-main/api-session-spec.ts b/spec-main/api-session-spec.ts index 4ade0c89c723..223d826d7eb8 100644 --- a/spec-main/api-session-spec.ts +++ b/spec-main/api-session-spec.ts @@ -559,8 +559,8 @@ describe('session module', () => { const ses = session.fromPartition(`${Math.random()}`); let validate: () => void; ses.setCertificateVerifyProc(({ hostname, verificationResult, errorCode }, callback) => { + if (hostname !== '127.0.0.1') return callback(-3); validate = () => { - expect(hostname).to.equal('127.0.0.1'); expect(verificationResult).to.be.oneOf(['net::ERR_CERT_AUTHORITY_INVALID', 'net::ERR_CERT_COMMON_NAME_INVALID']); expect(errorCode).to.be.oneOf([-202, -200]); }; @@ -578,8 +578,8 @@ describe('session module', () => { const ses = session.fromPartition(`${Math.random()}`); let validate: () => void; ses.setCertificateVerifyProc(({ hostname, certificate, verificationResult, isIssuedByKnownRoot }, callback) => { + if (hostname !== '127.0.0.1') return callback(-3); validate = () => { - expect(hostname).to.equal('127.0.0.1'); expect(certificate.issuerName).to.equal('Intermediate CA'); expect(certificate.subjectName).to.equal('localhost'); expect(certificate.issuer.commonName).to.equal('Intermediate CA'); @@ -607,6 +607,7 @@ describe('session module', () => { const ses = session.fromPartition(`${Math.random()}`); let numVerificationRequests = 0; ses.setCertificateVerifyProc((e, callback) => { + if (e.hostname !== '127.0.0.1') return callback(-3); numVerificationRequests++; callback(-2); });