Still intermittent test failures in test_wait_script_waits_for_lldpd

Bug #1293942 reported by Jeroen T. Vermeulen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Gavin Panella

Bug Description

This is the Son of Bug 1283918. Sometimes TestLLDPScripts.test_wait_script_waits_for_lldpd (in src/metadataserver/models/tests/test_commissioningscript.py) fails with:

_StringException: Traceback (most recent call last):
  File "src/metadataserver/models/tests/test_commissioningscript.py", line 273, in test_wait_script_waits_for_lldpd
    time.time.return_value))
….
MismatchError: Expected to be called once. Called 250 times.

The actual number varies. We already reduced the window for accidental calls, but still this problem occurs.

Download link to full test output: https://code.launchpad.net/~blake-rouse/maas/sm15k-restapi-v2/+merge/211136/comments/498531

Related branches

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

This happens for me once every few hundred times the test runs. Besides the one expected call to time.sleep, the injected Mock reports hundreds of additional calls, with a timeout of 0.1 seconds. It doesn't seem to be anything in our codebase as such.

The extra calls seem to be coming from Crochet. When I inject an error into the additional time.sleep calls (but not the ones the call expects), I find this:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "build/bdist.linux-x86_64/egg/crochet/_shutdown.py", line 28, in run
    time.sleep(0.1)

Patching is of course not thread-safe. It's a wonder this isn't affecting more tests. We can probably work around the failure for now by importing the sleep function from time, instead of importing the time module and using its sleep function.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Whoops. Not as easy as it sounds. The function that's being tested is special: it can't use any imports from the rest of its module. So the tests need to inject into imports that happen inside the function.

Gavin Panella (allenap)
Changed in maas:
status: Triaged → In Progress
assignee: nobody → Gavin Panella (allenap)
Gavin Panella (allenap)
Changed in maas:
status: In Progress → Fix Committed
milestone: none → 14.04
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.