Closed Bug 1312823 Opened 8 years ago Closed 5 years ago

Run mocha tests with TaskCluster

Categories

(DevTools :: Console, defect, P2)

defect

Tracking

(firefox68 fixed)

RESOLVED FIXED
Firefox 68
Tracking Status
firefox68 --- fixed

People

(Reporter: linclark, Assigned: nchevobbe)

References

(Depends on 1 open bug)

Details

Attachments

(3 files)

We have unit tests that require Node so that we can use mocha and Enzyme. We should run these in CI.

How to run them:

- cd devtools/client/webconsole
- npm install
- npm test
Alex, if you can help us get started with TaskCluster, that would be great. The test commands are above.
Flags: needinfo?(poirot.alex)
I imagine there is an additional parameters to specify where firefox binary lives?

Could we get them running via ./mach somehow?
I don't know about node/npm I don't see any existing taskcluster task using that.
I'm not sure that's available in existing docker images.
We can surely come up with our own docker image, but I never did that and don't known what it takes to create and use a new one.

Taskcluster is somewhat easy. All the scripts live here:
http://searchfox.org/mozilla-central/source/taskcluster/ci/

So. To introduce a new test runner, it is as simple as editing:
http://searchfox.org/mozilla-central/source/taskcluster/ci/desktop-test/tests.yml
And copy for example the "mochitest" section into a "devtools-console" one.
Here is a tweaked example, where I replaced the usage of the magic "mozharness" thing, which is a super helper made in python to run stuff around firefox. Instead it uses a "run-task" rule that allows arbitrary command execution.

devtools-console:
    description: "Devtools console unit tests"
    suite: devtools/console
    treeherder-symbol: tc-Dt-c()
    loopback-video: true
    max-run-time: 5400
    run:
        using: run-task
        command: >
            cd /home/worker/checkouts/gecko/devtools/client/webconsole &&
            wget -O build.tar.bz2 {{build_url}} &&
            tar jxvf build.tar.bz2 && # if that {{build_url}} thing still works, you should have firefox here: ./firefox/firefox-bin
            npm install &&
            npm test
    instance-size: legacy
    allow-software-gl-layers: false

(I don't know what some fields are about and just keep them from mochitest rule)

Then you would have to register this new test rule in this file:
http://searchfox.org/mozilla-central/source/taskcluster/ci/desktop-test/test-sets.yml#12

There is some docs over there:
http://searchfox.org/mozilla-central/source/taskcluster/docs

You may find valuable help on #taskcluster if the right people are online when you are asking for help.
Flags: needinfo?(poirot.alex)
Priority: -- → P2
Flags: qe-verify-
Whiteboard: [new-console]
Priority: P2 → P1
Priority: P1 → P2
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Iteration: --- → 55.4 - May 1
Priority: P2 → P1
Whiteboard: [new-console] → [console-html]
Iteration: 55.4 - May 1 → 55.5 - May 15
Iteration: 55.5 - May 15 → 55.6 - May 29
Assignee: nchevobbe → nobody
Status: ASSIGNED → NEW
Iteration: 55.6 - May 29 → ---
Priority: P1 → P3
Whiteboard: [console-html] → [reserve-console-html]
Priority: P3 → P4
Depends on: 1401189
Priority: P4 → P3
Priority: P3 → P2
Whiteboard: [reserve-console-html] → [newconsole-mvp]
Flags: qe-verify-
Priority: P2 → --
Whiteboard: [newconsole-mvp]
Product: Firefox → DevTools
Priority: -- → P2
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

This adds missing preferences to mocha-test-setup.js.

To make the test pass, we need to define URLSearchParams
if it doesn't exist.

Depends on D25044

  • What about trying to run each test suite individually?
    It looks like we could do a better at running only the webconsole tests when only the webconsole folder is changed, only framework when framework is changed and so on.

  • Is there any plan to integrate these node tests into *.ini files and ./mach test?
    Supporting ini file would help being tier 1/2 and be "sheriffable".
    While supporting ./mach test would help running them when you are not used to DevTools specifics.

Flags: needinfo?(jlaster)
Flags: needinfo?(jdescottes)

It looks like we could do a better at running only the webconsole tests when only the webconsole folder is changed, only framework when framework is changed and so on.

It is an option. Felt like an overkill for "framework" and "aboutdebugging" right now, because they both have just one test. My idea was to wait until we had more tests written, but if you feel strongly about this we can change it here.

Is there any plan to integrate these node tests into *.ini files and ./mach test?
Supporting ini file would help being tier 1/2 and be "sheriffable".
While supporting ./mach test would help running them when you are not used to DevTools specifics.

Would be nice, I don't know if this is being worked on. Note that this is why we added READMEs in the jest test folders for framework & aboutdebugging. I think the list of things to improve for those tests is long: error reporting, mach support, sheriffing.

Flags: needinfo?(jdescottes)

(In reply to Julian Descottes [:jdescottes] from comment #10)

It looks like we could do a better at running only the webconsole tests when only the webconsole folder is changed, only framework when framework is changed and so on.

It is an option. Felt like an overkill for "framework" and "aboutdebugging" right now, because they both have just one test. My idea was to wait until we had more tests written, but if you feel strongly about this we can change it here.

TBH I'm fine with the current in-flight patch. I mostly wanted to raise these two points so that they are being addressed at some point. Followups and proper staffing on this would be great!

Here is a meta for improving the node tooling bug 1535113. I'll add two bugs for *.ini and mach integration

Flags: needinfo?(jlaster)
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4fe8d3976d58
Fix console mocha tests. r=jdescottes.
https://hg.mozilla.org/integration/autoland/rev/4338bf79beb2
Run console mocha tests on TRY. r=jdescottes.
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 68
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: