upload_symbols: tolerate a dedupe_queue which is None

On a heavily loaded system, the notify process might not exit in time,
so the logic to wait for it tries to use a queue which might not exist.

BUG=chromium:371915
TEST=Unit tests pass repeatedly

Change-Id: I8c724695c8045af2648f200424350abfe311defc
Reviewed-on: https://chromium-review.googlesource.com/199086
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
Reviewed-by: Yu-Ju Hong <yjhong@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/upload_symbols_unittest.py b/scripts/upload_symbols_unittest.py
index 3489479..00593b3 100755
--- a/scripts/upload_symbols_unittest.py
+++ b/scripts/upload_symbols_unittest.py
@@ -12,6 +12,7 @@
 import multiprocessing
 import os
 import sys
+import time
 import urllib2
 
 sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)),
@@ -193,6 +194,15 @@
       self.assertEqual(ret, 0)
       # This test normally passes by not hanging.
 
+  def testSlowDedupeSystem(self):
+    """Verify a slow-to-join process doesn't break things when dedupe is off"""
+    # The sleep value here is inherently a little racy, but seems to be good
+    # enough to trigger the bug on a semi-regular basis on developer systems.
+    self.PatchObject(upload_symbols, 'SymbolDeduplicatorNotify',
+                     side_effect=lambda *args: time.sleep(1))
+    # Test passing means the code didn't throw an exception.
+    upload_symbols.UploadSymbols(sym_paths=[self.tempdir])
+
 
 class SymbolDeduplicatorNotifyTest(cros_test_lib.MockTestCase):
   """Tests for SymbolDeduplicatorNotify()"""