[infinispan-dev] AsyncStore.testMultiplePutsOnSameKey - endless loop

Mircea Markus mircea.markus at jboss.com
Wed Oct 28 05:59:08 EDT 2009


I think the tests can be improved to fail rather than entering an  
endless loop this way:

Original:

       do {
          TestingUtil.sleepRandom(1000);
          entry = store.load(key);
       } while (!entry.getValue().equals(value + (number-1)));


New version, allows a timeout of aprox 60 seconds:

       boolean success = false;
       for (int i = 0; i < 120; i++) {
          TestingUtil.sleepRandom(1000);
          entry = store.load(key);
          success = entry.getValue().equals(value + (number-1));
          if (success) break;
       }
       assert success;

I know TestNG supports timeouts at test method level, never used it  
though...

On Oct 28, 2009, at 11:53 AM, Mircea Markus wrote:

> Hi,
>
> There is an endless loop in this method.
> the test puts multiple values on the same key in a cache store and  
> expects (forever) until the store contains the very last value added.
> I'm being able to reproduce this on my Mac quite easily (< 10 runs).
> If anyone feels like taking a look, otherwise I can approach it once  
> I'm done with ISPN-236 cache.putIfAbsent() is not atomic
>
> Cheers,
> Mircea


>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/infinispan-dev/attachments/20091028/e616d392/attachment-0002.html 


More information about the infinispan-dev mailing list