Open Bug 2090099 Opened 19 days ago Updated 6 days ago

Await testTask() calls in test_CacheEntryWriteHandle_ParentProcess in test_cache-entry-write-handle.js

Categories

(Core :: Networking, task, P2)

task

Tracking

()

ASSIGNED

People

(Reporter: jesup, Assigned: asquaret)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [lang=js][necko-triaged])

Attachments

(1 external file)

Filing as a good first bug to learn workflows.

In netwerk/test/unit/test_cache-entry-write-handle.js, the task test_CacheEntryWriteHandle_ParentProcess calls the async function testTask() twice without awaiting it:

testTask(port, "/content1", responseContent, true);
testTask(port, "/content2", responseContent, false);

Because the promises are not awaited, the task returns immediately and the parent-process loads finish while the next task (test_CacheEntryWriteHandle_ContentProcess) is running. Their assertions are then logged under the wrong task name (visible with --verbose), and a failure could be attributed to the wrong task or missed entirely if the test finishes first.

The fix is to add await in front of both testTask() calls, so the parent-process checks complete inside their own task.

Link to the code:
https://searchfox.org/firefox-main/rev/fa1e90ea670c4234c61b65a05dc02032b9bcde03/netwerk/test/unit/test_cache-entry-write-handle.js#169

To verify the fix:

./mach test netwerk/test/unit/test_cache-entry-write-handle.js --headless --verbose

With the fix, the PASS lines for the "altData" / "text/binary" checks from the parent-process loads should be reported under test_CacheEntryWriteHandle_ParentProcess rather than test_CacheEntryWriteHandle_ContentProcess, and the test should still pass.

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

Blocks: necko-cache
Severity: -- → N/A
Priority: -- → P2
Whiteboard: [lang=js] → [lang=js][necko-triaged]
Assignee: nobody → asquaret
Status: NEW → ASSIGNED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: