Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-3702

New framework for concurrency testing

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.3.0
    • tests
    • None

    Description

      From the mailing list discussion:

      I'd like to propose two things:

      1) We introduce a framework for writing unit tests of code that is
      supposed to be thread safe. This framework should let a developer
      easily write a test with multiple things going on in parallel. The
      framework can then take that code and try to run it with different
      thread interleavings.

      Here's an example of what this could look like:

      @RunWith(ConcurrentTestRunner.class)
      public class AtomicIntegerTest {

      @Test
      public void parallelIncrementReturns2(ParallelExecutor executor)
      throws ExecutionException, InterruptedException

      { AtomicInteger atomicInteger = new AtomicInteger(); executor.inParallel(() -> atomicInteger.incrementAndGet()); executor.inParallel(() -> atomicInteger.incrementAndGet()); executor.execute(); assertEquals(2, atomicInteger.get()); }

      2) We implement this framework initially using Java Pathfinder, but
      allow for other methods of testing the code to be plugged in for
      example just running the test in the loop. Java pathfinder is cool
      because it can run the code with different interleavings but it does
      have some serious limitations.

      Attachments

        Activity

          People

            upthewaterspout Dan Smith
            upthewaterspout Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: