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

Fix conflict tests failing due to NXP-21854

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4.1
    • Component/s: Synchronizer

      Description

      Since NXP-21854, the server will never overwrite an existing file when asking for a create.
      In TestConflicts::test_resolve_local, Drive is calling resolve_with_local which forces the locally_created state but is expecting NuxeoDrive.CreateFile to perform an update of the existing document as the old behavior was passing overwrite=true to FileManager#createDocumentFromBlob.
      Now it performs a create, leading to:

      10:29:54 [OSXSLAVE] [INFO]      [exec] =========================== short test summary info ============================
      10:29:54 [OSXSLAVE] [INFO]      [exec] FAIL nuxeo-drive-client/tests/test_conflicts.py::TestConflicts::test_resolve_local
      10:29:54 [OSXSLAVE] [INFO]      [exec] =================================== FAILURES ===================================
      10:29:54 [OSXSLAVE] [INFO]      [exec] _______________________ TestConflicts.test_resolve_local _______________________
      10:29:54 [OSXSLAVE] [INFO]      [exec] self = <tests.test_conflicts.TestConflicts testMethod=test_resolve_local>
      10:29:54 [OSXSLAVE] [INFO]      [exec] result = <TestCaseFunction 'test_resolve_local'>
      10:29:54 [OSXSLAVE] [INFO]      [exec]     def run(self, result=None):
      10:29:54 [OSXSLAVE] [INFO]      [exec]         orig_result = result
      10:29:54 [OSXSLAVE] [INFO]      [exec]         if result is None:
      10:29:54 [OSXSLAVE] [INFO]      [exec]             result = self.defaultTestResult()
      10:29:54 [OSXSLAVE] [INFO]      [exec]             startTestRun = getattr(result, 'startTestRun', None)
      10:29:54 [OSXSLAVE] [INFO]      [exec]             if startTestRun is not None:
      10:29:54 [OSXSLAVE] [INFO]      [exec]                 startTestRun()
      10:29:54 [OSXSLAVE] [INFO]      [exec]         self._resultForDoCleanups = result
      10:29:54 [OSXSLAVE] [INFO]      [exec]         result.startTest(self)
      10:29:54 [OSXSLAVE] [INFO]      [exec]         testMethod = getattr(self, self._testMethodName)
      10:29:54 [OSXSLAVE] [INFO]      [exec]         if (getattr(self.__class__, "__unittest_skip__", False) or
      10:29:54 [OSXSLAVE] [INFO]      [exec]             getattr(testMethod, "__unittest_skip__", False)):
      10:29:54 [OSXSLAVE] [INFO]      [exec]             # If the class or method was skipped.
      10:29:54 [OSXSLAVE] [INFO]      [exec]             try:
      10:29:54 [OSXSLAVE] [INFO]      [exec]                 skip_why = (getattr(self.__class__, '__unittest_skip_why__', '')
      10:29:54 [OSXSLAVE] [INFO]      [exec]                             or getattr(testMethod, '__unittest_skip_why__', ''))
      10:29:54 [OSXSLAVE] [INFO]      [exec]                 self._addSkip(result, skip_why)
      10:29:54 [OSXSLAVE] [INFO]      [exec]             finally:
      10:29:54 [OSXSLAVE] [INFO]      [exec]                 result.stopTest(self)
      10:29:54 [OSXSLAVE] [INFO]      [exec]             return
      10:29:54 [OSXSLAVE] [INFO]      [exec]         try:
      10:29:54 [OSXSLAVE] [INFO]      [exec]             success = False
      10:29:54 [OSXSLAVE] [INFO]      [exec]             try:
      10:29:54 [OSXSLAVE] [INFO]      [exec]                 self.setUp()
      10:29:54 [OSXSLAVE] [INFO]      [exec]             except SkipTest as e:
      10:29:54 [OSXSLAVE] [INFO]      [exec]                 self._addSkip(result, str(e))
      10:29:54 [OSXSLAVE] [INFO]      [exec]             except KeyboardInterrupt:
      10:29:54 [OSXSLAVE] [INFO]      [exec]                 raise
      10:29:54 [OSXSLAVE] [INFO]      [exec]             except:
      10:29:54 [OSXSLAVE] [INFO]      [exec]                 result.addError(self, sys.exc_info())
      10:29:54 [OSXSLAVE] [INFO]      [exec]             else:
      10:29:54 [OSXSLAVE] [INFO]      [exec]                 try:
      10:29:54 [OSXSLAVE] [INFO]      [exec] >                   testMethod()
      10:29:54 [OSXSLAVE] [INFO]      [exec] cleanUpSuccess = True
      10:29:54 [OSXSLAVE] [INFO]      [exec] orig_result = <TestCaseFunction 'test_resolve_local'>
      10:29:54 [OSXSLAVE] [INFO]      [exec] result     = <TestCaseFunction 'test_resolve_local'>
      10:29:54 [OSXSLAVE] [INFO]      [exec] self       = <tests.test_conflicts.TestConflicts testMethod=test_resolve_local>
      10:29:54 [OSXSLAVE] [INFO]      [exec] success    = False
      10:29:54 [OSXSLAVE] [INFO]      [exec] testMethod = <bound method TestConflicts.test_resolve_local of <tests.test_conflicts.TestConflicts testMethod=test_resolve_local>>
      10:29:54 [OSXSLAVE] [INFO]      [exec] ../deploy-dir/.pyenv/versions/2.7.13/lib/python2.7/unittest/case.py:329: 
      10:29:54 [OSXSLAVE] [INFO]      [exec] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      10:29:54 [OSXSLAVE] [INFO]      [exec] self = <tests.test_conflicts.TestConflicts testMethod=test_resolve_local>
      10:29:54 [OSXSLAVE] [INFO]      [exec]     def test_resolve_local(self):
      10:29:54 [OSXSLAVE] [INFO]      [exec]         self.test_real_conflict()
      10:29:54 [OSXSLAVE] [INFO]      [exec]         # Resolve to local file
      10:29:54 [OSXSLAVE] [INFO]      [exec]         pair = self.engine_1.get_dao().get_normal_state_from_remote(self.file_id)
      10:29:54 [OSXSLAVE] [INFO]      [exec]         self.assertIsNotNone(pair)
      10:29:54 [OSXSLAVE] [INFO]      [exec]         self.engine_1.resolve_with_local(pair.id)
      10:29:54 [OSXSLAVE] [INFO]      [exec]         self.wait_sync(wait_for_async=True)
      10:29:54 [OSXSLAVE] [INFO]      [exec] >       self.assertEqual(self.remote_file_system_client_2.get_content(self.file_id), 'Local update 2')
      10:29:54 [OSXSLAVE] [INFO]      [exec] pair       = StateRow[3](Local: u'/Nuxeo Drive Test Workspace/test.txt', Remote: defaultFil...1656ce9b94a5, Local state: modified, Remote state: modified, State: conflicted)
      10:29:54 [OSXSLAVE] [INFO]      [exec] self       = <tests.test_conflicts.TestConflicts testMethod=test_resolve_local>
      10:29:54 [OSXSLAVE] [INFO]      [exec] nuxeo-drive-client/tests/test_conflicts.py:88: 
      10:29:54 [OSXSLAVE] [INFO]      [exec] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      10:29:54 [OSXSLAVE] [INFO]      [exec] self = <tests.test_conflicts.TestConflicts testMethod=test_resolve_local>
      10:29:54 [OSXSLAVE] [INFO]      [exec] first = 'Remote update 2', second = 'Local update 2', msg = None
      10:29:54 [OSXSLAVE] [INFO]      [exec]     def assertEqual(self, first, second, msg=None):
      10:29:54 [OSXSLAVE] [INFO]      [exec]         """Fail if the two objects are unequal as determined by the '=='
      10:29:54 [OSXSLAVE] [INFO]      [exec]                operator.
      10:29:54 [OSXSLAVE] [INFO]      [exec]             """
      10:29:54 [OSXSLAVE] [INFO]      [exec]         assertion_func = self._getAssertEqualityFunc(first, second)
      10:29:54 [OSXSLAVE] [INFO]      [exec] >       assertion_func(first, second, msg=msg)
      10:29:54 [OSXSLAVE] [INFO]      [exec] assertion_func = <bound method TestConflicts._baseAssertEqual of <tests.test_conflicts.TestConflicts testMethod=test_resolve_local>>
      10:29:54 [OSXSLAVE] [INFO]      [exec] first      = 'Remote update 2'
      10:29:54 [OSXSLAVE] [INFO]      [exec] msg        = None
      10:29:54 [OSXSLAVE] [INFO]      [exec] second     = 'Local update 2'
      10:29:54 [OSXSLAVE] [INFO]      [exec] self       = <tests.test_conflicts.TestConflicts testMethod=test_resolve_local>
      10:29:54 [OSXSLAVE] [INFO]      [exec] ../deploy-dir/.pyenv/versions/2.7.13/lib/python2.7/unittest/case.py:513: 
      10:29:54 [OSXSLAVE] [INFO]      [exec] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      10:29:54 [OSXSLAVE] [INFO]      [exec] self = <tests.test_conflicts.TestConflicts testMethod=test_resolve_local>
      10:29:54 [OSXSLAVE] [INFO]      [exec] first = 'Remote update 2', second = 'Local update 2'
      10:29:54 [OSXSLAVE] [INFO]      [exec] msg = "'Remote update 2' != 'Local update 2'"
      10:29:54 [OSXSLAVE] [INFO]      [exec]     def _baseAssertEqual(self, first, second, msg=None):
      10:29:54 [OSXSLAVE] [INFO]      [exec]         """The default assertEqual implementation, not type specific."""
      10:29:54 [OSXSLAVE] [INFO]      [exec]         if not first == second:
      10:29:54 [OSXSLAVE] [INFO]      [exec]             standardMsg = '%s != %s' % (safe_repr(first), safe_repr(second))
      10:29:54 [OSXSLAVE] [INFO]      [exec]             msg = self._formatMessage(msg, standardMsg)
      10:29:54 [OSXSLAVE] [INFO]      [exec] >           raise self.failureException(msg)
      10:29:54 [OSXSLAVE] [INFO]      [exec] E           AssertionError: 'Remote update 2' != 'Local update 2'
      10:29:54 [OSXSLAVE] [INFO]      [exec] first      = 'Remote update 2'
      10:29:54 [OSXSLAVE] [INFO]      [exec] msg        = "'Remote update 2' != 'Local update 2'"
      10:29:54 [OSXSLAVE] [INFO]      [exec] second     = 'Local update 2'
      10:29:54 [OSXSLAVE] [INFO]      [exec] self       = <tests.test_conflicts.TestConflicts testMethod=test_resolve_local>
      10:29:54 [OSXSLAVE] [INFO]      [exec] standardMsg = "'Remote update 2' != 'Local update 2'"
      10:29:54 [OSXSLAVE] [INFO]      [exec] ../deploy-dir/.pyenv/versions/2.7.13/lib/python2.7/unittest/case.py:506: AssertionError
      10:29:54 [OSXSLAVE] [INFO]      [exec] ----------------------------- Captured stderr call -----------------------------
      

      We probably need to allow to pass the overwrite parameter to RemoteFileSystemClient#stream_file and NuxeoDriveCreateFile.
      ------------------------------------------------------
      Added a locally_resolved state for this purpose.

        Attachments

          Issue Links

            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 - 1 day, 2 hours
                  1d 2h