You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@aurora.apache.org by "John Sirois (JIRA)" <ji...@apache.org> on 2016/01/05 03:52:39 UTC

[jira] [Commented] (AURORA-1570) TaskObserverTest::test_run_loop is flaky

    [ https://issues.apache.org/jira/browse/AURORA-1570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15082265#comment-15082265 ] 

John Sirois commented on AURORA-1570:
-------------------------------------

With this change I can get the failure above on every run:
{noformat}
$ git diff
diff --git a/src/test/python/apache/thermos/observer/test_task_observer.py b/src/test/python/apache/thermos/observer/test_task_observer.py
index ace15c5..fbf5ef0 100644
--- a/src/test/python/apache/thermos/observer/test_task_observer.py
+++ b/src/test/python/apache/thermos/observer/test_task_observer.py
@@ -39,7 +39,7 @@ class TaskObserverTest(unittest.TestCase):
 
         observer.stop()
 
-        assert len(mock_task_detector.mock_calls) >= run_count
+        assert len(mock_detector.mock_calls) >= run_count
         assert len(mock_wait.mock_calls) >= run_count
         args = mock_wait.mock_calls[1][1]
         assert interval == args[0]
{noformat}

Without that change I can get the failure roughly 1 in 10 times.

> TaskObserverTest::test_run_loop is flaky
> ----------------------------------------
>
>                 Key: AURORA-1570
>                 URL: https://issues.apache.org/jira/browse/AURORA-1570
>             Project: Aurora
>          Issue Type: Bug
>          Components: Observer, Testing
>            Reporter: John Sirois
>            Assignee: John Sirois
>
> As seen in https://reviews.apache.org/r/41897/
> {noformat}
> Master (8706a78) is red with this patch.
>   ./build-support/jenkins/build.sh
>                      src/test/python/apache/thermos/observer/test_detector.py::test_observer_task_detector_standard_transitions PASSED
>                      src/test/python/apache/thermos/observer/test_detector.py::test_observer_task_detector_nonstandard_transitions PASSED
>                      src/test/python/apache/thermos/observer/test_task_observer.py::TaskObserverTest::test_run_loop FAILED
>                      
>                      ==================== FAILURES ====================
>                      _________ TaskObserverTest.test_run_loop _________
>                      
>                      self = <test_task_observer.TaskObserverTest testMethod=test_run_loop>
>                      
>                          def test_run_loop(self):
>                            """Test observer run loop."""
>                            mock_task_detector = create_autospec(spec=ObserverTaskDetector)
>                            with patch(
>                                "apache.thermos.observer.task_observer.ObserverTaskDetector",
>                                return_value=mock_task_detector) as mock_detector:
>                              with patch('threading._Event.wait') as mock_wait:
>                          
>                                run_count = 3
>                                interval = 15
>                                observer = TaskObserver(mock_detector, interval=Amount(interval, Time.SECONDS))
>                                observer.start()
>                                while len(mock_wait.mock_calls) < run_count:
>                                  pass
>                          
>                                observer.stop()
>                          
>                      >         assert len(mock_task_detector.mock_calls) >= run_count
>                      E         AssertionError: assert 1 >= 3
>                      E          +  where 1 = len([call.refresh()])
>                      E          +    where [call.refresh()] = <MagicMock spec='ObserverTaskDetector' id='140389955602192'>.mock_calls
>                      
>                      src/test/python/apache/thermos/observer/test_task_observer.py:42: AssertionError
>                       generated xml file: /home/jenkins/jenkins-slave/workspace/AuroraBot/dist/test-results/src.test.python.apache.thermos.observer.observer.xml 
>                      ======= 1 failed, 3 passed in 0.25 seconds =======
>                      
> FAILURE
> 23:20:37 04:05   [complete]
>                FAILURE
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)