Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I'm writing a Dbix::Class model which I expect will come under a considerable load.

Part of the operations the model will have to perform involves stuff that has to happen in a transaction, and as I am really getting into the write-tests-first way of programming, I want to think up some tests that will verify that the transactions are done right, and that the reverts are handled correctly.

That means that I need to trigger the race conditions "on demand". I've been reading Testing Race Conditions but the responses don't seem to help what I'm trying to test - they would help detect if there are unhandled race conditions, while I want to, first, check that predictable race conditions are properly handled. (And only then go to probabilistic testing if there are any unanticipated race conditions).

Does anybody have ideas on how I could test predictable race conditions (i.e. "what happens if another request comes in just as I come to this point") without having to modify the source I am testing?

Failing that, what would you consider the least intrusive (and the least time consuming in production) modification of the source that would enable such testing?

In reply to Testing transactions by matija

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (2)
    As of 2021-03-03 02:07 GMT
    Find Nodes?
      Voting Booth?
      My favorite kind of desktop background is:

      Results (69 votes). Check out past polls.