Patchwork [5,of,7,STABLE] bookmarks: actually trigger the race deleting bookmark in the test

login
register
mail settings
Submitter Pierre-Yves David
Date June 21, 2019, 2:04 a.m.
Message ID <1646be228b7105c3b014.1561082652@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/40638/
State Accepted
Headers show

Comments

Pierre-Yves David - June 21, 2019, 2:04 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1560957979 -7200
#      Wed Jun 19 17:26:19 2019 +0200
# Branch stable
# Node ID 1646be228b7105c3b0148ae1744802502f872fd9
# Parent  26ed41f211a818da9df24922089054c57e60a7cf
# EXP-Topic book-del-stable
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 1646be228b71
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.

Patch

diff --git a/tests/test-bookmarks-corner-case.t b/tests/test-bookmarks-corner-case.t
--- a/tests/test-bookmarks-corner-case.t
+++ b/tests/test-bookmarks-corner-case.t
@@ -135,11 +135,14 @@  We build a server side extension for thi
   >             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 @@  Check result of the push.
   |  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 @@  Check result of the push.
   
   $ hg -R bookrace-server book
      book-A                    4:9ce3b28c16de
-     book-B                    3:f26c3b5167d1
+     book-B                    3:f26c3b5167d1 (false !)