Stop test_simple_pref_policies.js from connecting to example.com through DNS over HTTPS
Categories
(Firefox :: Enterprise Policies, task)
Tracking
()
People
(Reporter: mkaply, Unassigned, Mentored)
Details
(Keywords: good-first-bug, Whiteboard: [lang=js])
Filing as a good first bug to learn workflows.
The DNSOverHTTPS cases in browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js turn on DNS over HTTPS (network.trr.mode 2 and 3) with network.trr.uri set to https://example.com/provider. DNS over HTTPS then tries to connect to example.com for real while the test runs. The test still passes, but whenever its log is printed (for example when another case in the file fails) it is full of lines like:
FATAL ERROR: Non-local network connections are disabled and a connection attempt to example.com (104.20.23.154) was made.
Tests shouldn't reach the network. The test only checks the prefs the policy sets, so it doesn't need DNS over HTTPS to actually start.
The likely fix is to set the pref network.trr.confirmationNS to skip for this test, so DNS over HTTPS doesn't send its startup confirmation request. Add it to the prefs of this test's entry in browser/components/enterprisepolicies/tests/xpcshell/xpcshell.toml, or set it at the start of the test with Services.prefs.setStringPref and clear it in registerCleanupFunction. It hasn't been confirmed that the confirmation request is the only source of these connections, so check the log before and after your change (see below). If the errors don't all go away, say so in the bug before going further.
To verify the fix:
./mach xpcshell-test --verbose browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js
Before the change, the output contains Non-local network connections are disabled lines for example.com right after the Checking policy: DNSOverHTTPS lines. After the change, there should be none, 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.
Description
•