My team at Mozilla maintains an integration test suite for Firefox Client Telemetry named telemetry-tests-client, which verifies that the collection of technical and interaction data in Firefox is working as expected. π¦π
This article describes my workflow for submitting patches to that integration test suite.
mozilla-central
The test suite for Firefox Client Telemetry is checked in to version control at mozilla-central, the Mercurial repository for Mozilla code, under toolkit/components/telemetry/tests/marionette/.
There’s a super useful Command equivalence table for hg and git, which I recommend bookmarking, if you (like me) need to look up hg commands for git operations every once in a while. π
Before I make any changes, I pull changes from the remote repository.
hg pull --update
Next I create a new bookmark with the Bugzilla bug ID for its name based on the central bookmark. Let’s use bug 1502849 for this example:
hg bookmark -r central bug1502849
Then I switch to the new bookmark, before making any code changes.
hg up bug1502849
Build Firefox
The integration test suite for Firefox Client Telemetry requires a Firefox build to run tests against. But before I build Firefox, I update required system packages with mach. It’s a good idea to also run the Mercurial wizard to make sure the environment is configured correctly. π§β
Note that working on telemetry-tests-client typically does not involve modiying C++ components, which means we can select mozilla-central’s fast build mode for Firefox called artifact mode from the configuration wizard.
./mach bootstrap
Now that my environment is up-to-date, I build Firefox. π₯π¦
./mach build
Commit changes
The CLI tool, that I use for submitting patches to mozilla-central, parses Bugzilla Bug IDs and reviewers from hg commit messages if you follow a specific format:
hg commit -m "Bug <Bugzilla bug ID> - <Commit message>; r?<reviewers>"
For example:
hg commit -m "Bug 1502849 - Create reusable ping filters; r?dexter,davehunt"
Run tests
While working on the integration test suite, I will run the tests multiple times on my machine using mach:
./mach telemetry-tests-client
Before submitting a patch for review, I will also I also run the tests across all platforms on our try server:
./mach try fuzzy -q "'telemetry-tests-client"
The '
at the start of the query instructs mach to search for exact matches.
If you want to learn more about this search syntax, check out the
documentation for fzf which mach uses under the hood to filter CI
jobs. π
Submit patch
Finally I will submit my commits for review to phabricator:
moz-phab submit
Feedback
If you’re an experienced contributor to mozilla-central or a newcomer to the project, I’d appreciate your feedback on this short blog post via email or twitter. Thank you! π¨π»βπ»