Implement a remote settings server for tests and use it to test the Suggest Rust component and desktop remote settings client
Categories
(Firefox :: Address Bar, task, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox121 | --- | fixed |
People
(Reporter: adw, Assigned: adw)
References
Details
Attachments
(2 files)
Desktop currently mocks RustSuggest
during tests, so we're not testing the real Rust component at all. That also means we have to reimplement essentially all functionality in our mock implementation so that it behaves like the real thing, which is getting more annoying to do the more the Rust component is fleshed out.
We also mock RemoteSettings
for the JS backend, which has similar but less extreme drawbacks.
Instead, I'd like to use a local remote settings server during tests so we can transparently test both Rust and the desktop remote settings client.
Assignee | ||
Comment 1•1 year ago
|
||
This implements a remote settings server for tests. Unfortunately there doesn't
seem to be a general-purpose implementation already in the tree.
In part 2, I'll update tests so they use it.
Assignee | ||
Comment 2•1 year ago
|
||
This modifies tests to use the server. There are a few important points to call
out:
This means tests are now using the real Rust component, and we need to make sure
the test RS data is valid and matches what Rust expects. For example, I had to
add icon
properties to suggestions and set the advertiser
to "Wikipedia" for
non-sponsored suggestions. Otherwise Rust hits an error on ingest. I also
removed some test cases because they tested behaviors that are impossible with
Rust, for example Pocket keywords that are duplicated in the high- and
low-confidence arrays.
We need to be careful to wait until Suggest is done syncing from remote settings
regardless of whether it's using the JS or Rust backend. I added a way to force
the backends to sync. That way, tests can force a sync, wait for it to finish,
and be sure that all sync activity is done.
A common pattern in tests is to call ensureQuickSuggestInit()
and then set
Suggest-related prefs (or vice versa). This is a little problematic because both
ensureQuickSuggestInit()
and setting prefs can cause Suggest to start a sync.
It's more problematic now that we're not mocking remote settings or Rust. So I
combined the two by adding a prefs
param to ensureQuickSuggestInit()
. That
way, tests can be sure that all syncing is done once that function returns.
Depends on D192037
Comment 4•1 year ago
|
||
Backed out for causing xpcshell failures in test_quicksuggest_addons.js
- Backout link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_addons.js | remoteSettings_rustEnabled - [remoteSettings_rustEnabled : 1] Found the expected number of results. - 1 == 0
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Comment 6•1 year ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/e61e99ad721f
https://hg.mozilla.org/mozilla-central/rev/a14048d57f78
Description
•