Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-767

Fix BlacklistQueueTest on macOS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.6
    • Component/s: Tests

      Description

      18:50:50 [OSXSLAVE] [INFO]      [exec] self = <tests.test_blacklist_queue.BlacklistQueueTest testMethod=testDelay>
      18:50:50 [OSXSLAVE] [INFO]      [exec]     def testDelay(self):
      18:50:50 [OSXSLAVE] [INFO]      [exec]         sleep_time = 3
      18:50:50 [OSXSLAVE] [INFO]      [exec]         # Push two items with a delay of 1s
      18:50:50 [OSXSLAVE] [INFO]      [exec]         queue = BlacklistQueue(delay=1)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         queue.push(1, "Item1")
      18:50:50 [OSXSLAVE] [INFO]      [exec]         queue.push(2, "Item2")
      18:50:50 [OSXSLAVE] [INFO]      [exec]         # Verify no item is returned back before 1s
      18:50:50 [OSXSLAVE] [INFO]      [exec]         item = queue.get()
      18:50:50 [OSXSLAVE] [INFO]      [exec]         self.assertIsNone(item)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         sleep(sleep_time)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         # Verfiy we get the two items now
      18:50:50 [OSXSLAVE] [INFO]      [exec]         item = queue.get()
      18:50:50 [OSXSLAVE] [INFO]      [exec]         self.assertIsNotNone(item)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         self.assertEqual(item.get(), "Item1")
      18:50:50 [OSXSLAVE] [INFO]      [exec]         self.assertEqual(item.get_id(), 1)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         item = queue.get()
      18:50:50 [OSXSLAVE] [INFO]      [exec]         self.assertIsNotNone(item)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         self.assertEqual(item.get(), "Item2")
      18:50:50 [OSXSLAVE] [INFO]      [exec]         self.assertEqual(item.get_id(), 2)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         self.assertEqual(item._count, 1)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         # Repush item without increasing delay
      18:50:50 [OSXSLAVE] [INFO]      [exec]         queue.repush(item, increase_wait=False)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         item = queue.get()
      18:50:50 [OSXSLAVE] [INFO]      [exec]         self.assertIsNone(item)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         sleep(sleep_time)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         # We should get the repushed item after 1s wait
      18:50:50 [OSXSLAVE] [INFO]      [exec]         item = queue.get()
      18:50:50 [OSXSLAVE] [INFO]      [exec]         self.assertIsNotNone(item)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         self.assertEqual(item.get(), "Item2")
      18:50:50 [OSXSLAVE] [INFO]      [exec]         self.assertEqual(item.get_id(), 2)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         self.assertEqual(item._count, 2)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         # Repush item with increase
      18:50:50 [OSXSLAVE] [INFO]      [exec]         queue.repush(item, increase_wait=True)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         sleep(sleep_time)
      18:50:50 [OSXSLAVE] [INFO]      [exec]         item = queue.get()
      18:50:50 [OSXSLAVE] [INFO]      [exec] >       self.assertIsNone(item)
      18:50:50 [OSXSLAVE] [INFO]      [exec] item       = <nxdrive.engine.blacklist_queue.BlacklistItem object at 0x113b8acd0>
      18:50:50 [OSXSLAVE] [INFO]      [exec] queue      = <nxdrive.engine.blacklist_queue.BlacklistQueue object at 0x113b8a810>
      18:50:50 [OSXSLAVE] [INFO]      [exec] self       = <tests.test_blacklist_queue.BlacklistQueueTest testMethod=testDelay>
      18:50:50 [OSXSLAVE] [INFO]      [exec] sleep_time = 3
      18:50:50 [OSXSLAVE] [INFO]      [exec] nuxeo-drive-client/tests/test_blacklist_queue.py:48: 
      

      Porbably linked to the randomy waiting sleep.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 10 minutes
                10m