Page MenuHomePhabricator

MobileFrontend: mobileView references gateway qunit test is flaky
Closed, ResolvedPublicPRODUCTION ERROR


A MobileFrontend unit test has apparently been failing randomly for the past two weeks-ish.

The following example on the Echo extension:


17:22:32 SUMMARY:
17:22:32 ✔ 1257 tests completed
17:22:32 ✖ 1 test failed
17:22:32 FAILED TESTS:
17:22:32   MobileFrontend: mobileView references gateway
17:22:32     ✖ checking good reference (subsequent calls)
17:22:32       Chrome 57.0.2987 (Linux 0.0.0)
17:22:32     Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.
17:22:32         at http://localhost:9876/jenkins-mediawiki-extensions-qunit-jessie-44610/load.php?debug=false&lang=en&
17:22:32         at mw.loader.implement.section.hogan (http://localhost:9876/jenkins-mediawiki-extensions-qunit-jessie-44610/load.php?debug=false&lang=en&
17:22:32         at runScript (http://localhost:9876/jenkins-mediawiki-extensions-qunit-jessie-44610/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=fallback&version=05gybsn:163:129)
17:22:32         at checkCssHandles (http://localhost:9876/jenkins-mediawiki-extensions-qunit-jessie-44610/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=fallback&version=05gybsn:163:785)
17:22:32         at execute (http://localhost:9876/jenkins-mediawiki-extensions-qunit-jessie-44610/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=fallback&version=05gybsn:164:496)
17:22:32         at handlePending (http://localhost:9876/jenkins-mediawiki-extensions-qunit-jessie-44610/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=fallback&version=05gybsn:160:80)
17:22:32         at markModuleReady (http://localhost:9876/jenkins-mediawiki-extensions-qunit-jessie-44610/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=fallback&version=05gybsn:162:816)

Developer notes

The issue (to my knowledge) hasn't shown up in the MobileFrontend or Minerva repo. We shouldn't rule out the possibility that the issue is actually not with this test but some other test in another extension. The more examples of failing builds that we have, the better.

Event Timeline

@Niedzielski I don't see how this is related to T162256 - this is about qunit tests being flaky, not browser tests.

Jdlrobson moved this task from Incoming to Needs Prioritization on the Readers-Web-Backlog board.
Jdlrobson added a subscriber: Jdlrobson.

Did you just see this on Echo or were other extensions involved? I've not personally seen this issue, so I'm keen to rule out whether any other extensions are interfering with this test.

The test in question looks like this:

	QUnit.test( 'checking good reference (subsequent calls)', function ( assert ) {
		var page =,
			referencesGateway = this.referencesGateway;

		return referencesGateway.getReference( '#cite_note-1', page ).always( function () {
			return referencesGateway.getReference( '#cite_note-2', page ).done( function ( ref ) {
				assert.strictEqual( ref.text, 'real lazy 2' );
			} );
		} );
	} );

The error I'm seeing is Expected at least one assertion, but none were run - call expect(0) to accept zero assertions. which is odd as it sounds like the call to getReference is failing.

This will only fail if an exception is thrown or the promise is rejected.
I'm a little confused though, as if that was the case I'd expect `Promise rejected during checking good reference" not the message "Expected at least one assertion"

That error message should only happen if the promise resolves but the assertion fails to happen. Given the assertion looks like

assert.strictEqual( ref.text, 'real lazy' );

it seems that could only happen if ref is undefined.

So this makes me wonder why ref is undefined.
getReference's logic is quite simple.

		getReference: function ( id, page ) {
			var self = this;

			return this.getReferencesLists( page ).then( function ( sections ) {
				var $container = $( '<div>' );

				Object.keys( sections ).forEach( function ( sectionId ) {
					$container.append( sections[ sectionId ] );
				} );

				return self.getReferenceFromContainer( id, $container );
			} );

getReferenceFromContainer is only resolved in one place:

result = $.Deferred(),
			if ( $el.length ) {
				result.resolve( { text: $el.html() } );
			} else {
				result.reject( ReferencesGateway.ERROR_NOT_EXIST );

That would only resolve with undefined if something was hijacking $.Deferred to resolve with undefined which seems unlikely as the other tests are passing OR if getReference was being stubbed somewhere - but I see no evidence of that either.

Thus I'm a little stumped with what's going on here.

Are people still running into this problem?

Change 401821 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] Add debugging information to flakey test

Seen this myself but still can't replicate it. I think the above should help us debug this better (getReference should only fail if there's a JS error of some sort) and get to the bottom of this if somebody can merge!

Change 401821 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Add debugging information to flakey test

Jdlrobson changed the task status from Open to Stalled.Jan 19 2018, 1:18 AM

Waiting on a new bug report - once we see this happen again we should get more insight into the problem...

Is this still a problem?

Same question from me, especially with regards to ULS.

Shall we set a countdown clock and close it? :)

Yes, it's still a problem

00:45:41 FAILED TESTS:
00:45:41   MobileFrontend: mobileView references gateway
00:45:41     ✖ checking good reference (subsequent calls)
00:45:41       Chrome 57.0.2987 (Linux 0.0.0)
00:45:41     Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.
00:45:41         at http://localhost:9876/jenkins-mediawiki-extensions-qunit-jessie-56902/load.php?debug=false&lang=en&
00:45:41         at mw.loader.implement.section.hogan (http://localhost:9876/jenkins-mediawiki-extensions-qunit-jessie-56902/load.php?debug=false&lang=en&
00:45:41         at runScript (http://localhost:9876/jenkins-mediawiki-extensions-qunit-jessie-56902/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=fallback&version=1wn9jw1:163:129)
00:45:41         at checkCssHandles (http://localhost:9876/jenkins-mediawiki-extensions-qunit-jessie-56902/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=fallback&version=1wn9jw1:163:785)
00:45:41         at execute (http://localhost:9876/jenkins-mediawiki-extensions-qunit-jessie-56902/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=fallback&version=1wn9jw1:164:496)
00:45:41         at handlePending (http://localhost:9876/jenkins-mediawiki-extensions-qunit-jessie-56902/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=fallback&version=1wn9jw1:160:80)
00:45:41         at markModuleReady (http://localhost:9876/jenkins-mediawiki-extensions-qunit-jessie-56902/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=fallback&version=1wn9jw1:162:816)

Change 420068 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] Return a Deferred that always resolves

Krinkle triaged this task as Unbreak Now! priority.EditedMar 20 2018, 2:21 AM
Krinkle added a subscriber: Krinkle.

Still breaking mediawiki/core commits, e.g.

  MobileFrontend: mobileView references gateway
    ✖ checking good reference (subsequent calls)
      Chrome 57.0.2987 (Linux 0.0.0)
    Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.

Please address soon, or simply disable the test for the time being.

Krinkle changed the task status from Stalled to Open.Mar 20 2018, 2:21 AM
Jdlrobson added a subscriber: ovasileva.

@ovasileva this has been marked unbreak now. We're impacting other teams so should fix this ASAP.

Change 420068 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Return a Deferred that always resolves

Jdlrobson lowered the priority of this task from Unbreak Now! to High.Mar 20 2018, 11:00 PM

Leaving as high until I get confirmation that the problem is resolved... (or not)

I'm gonna assume this is fixed. If not, please let me know if it isn't with more examples!

(Please reopen and bump back to unbreak now if it's not)

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:09 PM