Changes between Initial Version and Version 1 of Ticket #33161, comment 14


Ignore:
Timestamp:
Oct 4, 2021, 3:28:45 AM (3 years ago)
Author:
David Seddon

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33161, comment 14

    initial v1  
    1 Thanks for looking into this!
     1Thanks for looking into this! I think it's a great idea.
    22
    3 We've been using a hand-rolled equivalent of `durable=True` extensively for a couple of years on a large code base. Our implementation consults a setting which we typically override along the lines of `@override_settings(DISABLE_DURABILITY_CHECKS=True)`. Two years in, I don't think there's been much value in requiring the override for each relevant test, and I imagine we'll switch to using a global setting (at least for the transaction-wrapped test cases which, conveniently, use a different configuration to the unwrapped ones).
     3It reminds me of the difficulties of testing code that uses `select_for_update`. I have seen many occasions where wrapped test cases are the only coverage of such code, and we don't see the issue until it hits production.
    44
    5 So on balance I think it makes more sense to disable the behaviour than require developers to turn it off on a test-by-test basis, though it ''might'' be worthwhile providing a setting so that people can choose the default behaviour.
     5The approach proposed here should make it less likely that unrunnable code will make its way onto production.
    66
    7 Having said that, there is a downside which reminds me of the difficulties of testing code that uses `select_for_update`. I have seen many occasions where wrapped test cases are the only coverage of such code, and we don't see the issue until it hits production. If we just turn off the checking wholesale, it's more likely that unrunnable code will make its way onto production.
    8 
    9 An even better solution would be for wrapped TestCases to be able to tell the difference between the transaction begun by the TestCase itself and any subsequent atomic blocks entered. They would then allow durable blocks to be entered providing the only block we're in is that initial block (possibly this is what has been implemented, I wasn't able to tell at first glance).
    10 
    11 
     7[Edited from my original post now I better understand the behaviour.]
Back to Top