bookmarks: actually trigger the race deleting bookmark in the test stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 19 Jun 2019 17:26:19 +0200
branchstable
changeset 42509 95c2f951e502
parent 42508 c4d1807b165f
child 42510 3472a3f9d785
bookmarks: actually trigger the race deleting bookmark in the test The previous committed version of the test did not triggered the race, but this was hidden by a strange behavior from the test runner. So we are moving the test to a slightly more complex that actually trigger the issue.
tests/test-bookmarks-corner-case.t
--- a/tests/test-bookmarks-corner-case.t	Wed Jun 19 17:26:16 2019 +0200
+++ b/tests/test-bookmarks-corner-case.t	Wed Jun 19 17:26:19 2019 +0200
@@ -135,11 +135,14 @@
   >             raise error.Abort("race scenario timed out")
   >         time.sleep(0.1)
   > 
-  > def wrapinit(orig, self, repo):
-  >     wait(repo)
-  >     return orig(self, repo)
-  > def uisetup(ui):
-  >     extensions.wrapfunction(bookmarks.bmstore, '__init__', wrapinit)
+  > def reposetup(ui, repo):
+  >     class racedrepo(repo.__class__):
+  >         @property
+  >         def _bookmarks(self):
+  >             wait(self)
+  >             return super(racedrepo, self)._bookmarks
+  >     repo.__class__ = racedrepo
+  > 
   > def e():
   >     with open('push-A-done', 'w'):
   >         pass
@@ -216,7 +219,7 @@
   |  summary:     A1
   |
   | o  changeset:   3:f26c3b5167d1
-  | |  bookmark:    book-B
+  | |  bookmark:    book-B (false !)
   | |  user:        test
   | |  date:        Thu Jan 01 00:00:00 1970 +0000
   | |  summary:     B1
@@ -239,4 +242,4 @@
   
   $ hg -R bookrace-server book
      book-A                    4:9ce3b28c16de
-     book-B                    3:f26c3b5167d1
+     book-B                    3:f26c3b5167d1 (false !)