From 51db0fdc6c16de82980e9afb83a9ab5d43772953 Mon Sep 17 00:00:00 2001 From: Valentin Gosu Date: Fri, 21 Jan 2022 13:45:08 +0000 Subject: [PATCH] Bug 1703634 - Disable test_trr_cancel.js::cancel_immediately for socket process r=necko-reviewers,kershaw The test is racy in that it expects the request to be immediately cancelled, but with the socket process that takes an IPC round-trip. Differential Revision: https://phabricator.services.mozilla.com/D136610 --- netwerk/test/unit/test_trr_cancel.js | 69 +++++++++++++++------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/netwerk/test/unit/test_trr_cancel.js b/netwerk/test/unit/test_trr_cancel.js index 7d1c949c3238..35364c8b7ac4 100644 --- a/netwerk/test/unit/test_trr_cancel.js +++ b/netwerk/test/unit/test_trr_cancel.js @@ -45,39 +45,44 @@ add_task(async function sanity_check() { await new TRRDNSListener("example.com", { expectedAnswer: "1.2.3.4" }); }); -add_task(async function cancel_immediately() { - await trrServer.registerDoHAnswers("example.org", "A", { - answers: [ - { - name: "example.org", - ttl: 55, - type: "A", - flush: false, - data: "2.3.4.5", - }, - ], - }); - let r1 = new TRRDNSListener("example.org", { expectedSuccess: false }); - let r2 = new TRRDNSListener("example.org", { expectedAnswer: "2.3.4.5" }); - r1.cancel(); - let { inStatus } = await r1; - equal(inStatus, Cr.NS_ERROR_ABORT); - await r2; - equal(await trrServer.requestCount("example.org", "A"), 1); +// Cancelling the request is not sync when using the socket process, so +// we skip this test when it's enabled. +add_task( + { skip_if: () => mozinfo.socketprocess_networking }, + async function cancel_immediately() { + await trrServer.registerDoHAnswers("example.org", "A", { + answers: [ + { + name: "example.org", + ttl: 55, + type: "A", + flush: false, + data: "2.3.4.5", + }, + ], + }); + let r1 = new TRRDNSListener("example.org", { expectedSuccess: false }); + let r2 = new TRRDNSListener("example.org", { expectedAnswer: "2.3.4.5" }); + r1.cancel(); + let { inStatus } = await r1; + equal(inStatus, Cr.NS_ERROR_ABORT); + await r2; + equal(await trrServer.requestCount("example.org", "A"), 1); - // Now we cancel both of them - dns.clearCache(true); - r1 = new TRRDNSListener("example.org", { expectedSuccess: false }); - r2 = new TRRDNSListener("example.org", { expectedSuccess: false }); - r1.cancel(); - r2.cancel(); - ({ inStatus } = await r1); - equal(inStatus, Cr.NS_ERROR_ABORT); - ({ inStatus } = await r2); - equal(inStatus, Cr.NS_ERROR_ABORT); - await new Promise(resolve => do_timeout(50, resolve)); - equal(await trrServer.requestCount("example.org", "A"), 2); -}); + // Now we cancel both of them + dns.clearCache(true); + r1 = new TRRDNSListener("example.org", { expectedSuccess: false }); + r2 = new TRRDNSListener("example.org", { expectedSuccess: false }); + r1.cancel(); + r2.cancel(); + ({ inStatus } = await r1); + equal(inStatus, Cr.NS_ERROR_ABORT); + ({ inStatus } = await r2); + equal(inStatus, Cr.NS_ERROR_ABORT); + await new Promise(resolve => do_timeout(50, resolve)); + equal(await trrServer.requestCount("example.org", "A"), 2); + } +); add_task(async function cancel_delayed() { dns.clearCache(true);