You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Philip Jackson <ph...@shellarchive.co.uk> on 2010/04/07 17:26:15 UTC

Inconsistency when unit testing

Hi,

To summarise my app;

 * try to get item from UserUrl cf
   * if not found then check in the Url cf to see if we have fetched
     url before and add to UserUrl.
   * else, fetch the url and its details put in Url and UserUrl

The unit tests covering this shouldn't hit the else as they put what
they need in Url (as part of their setup) first. Trouble is, seemingly
randomly, they do hit the else meaning a read on Url "gets there
before" the write (it's all sequential in my code).

Is there anything I can tweak to stop this happening (considering my
test conf. will be different to production).

Cheers,
Phil

Re: Inconsistency when unit testing

Posted by Jonathan Ellis <jb...@gmail.com>.
Your first step should be upgrading to 0.6.

On Wed, Apr 7, 2010 at 10:38 AM, Philip Jackson <ph...@shellarchive.co.uk> wrote:
> At Wed, 7 Apr 2010 17:29:49 +0200,
> Sylvain Lebresne wrote:
>>
>> Use ConsistencyLevel.QUORUM when you write *and* when you read.
>
> I already do (plus, I only test with one node).
>
> BTW, I'm on 0.5.0, if that makes any difference.
>
> Cheers,
> Phil
>

Re: Inconsistency when unit testing

Posted by Philip Jackson <ph...@shellarchive.co.uk>.
At Wed, 7 Apr 2010 17:29:49 +0200,
Sylvain Lebresne wrote:
> 
> Use ConsistencyLevel.QUORUM when you write *and* when you read.

I already do (plus, I only test with one node).

BTW, I'm on 0.5.0, if that makes any difference.

Cheers,
Phil

Re: Inconsistency when unit testing

Posted by Sylvain Lebresne <sy...@yakaz.com>.
Use ConsistencyLevel.QUORUM when you write *and* when you read.

On Wed, Apr 7, 2010 at 5:26 PM, Philip Jackson <ph...@shellarchive.co.uk> wrote:
> Hi,
>
> To summarise my app;
>
>  * try to get item from UserUrl cf
>   * if not found then check in the Url cf to see if we have fetched
>     url before and add to UserUrl.
>   * else, fetch the url and its details put in Url and UserUrl
>
> The unit tests covering this shouldn't hit the else as they put what
> they need in Url (as part of their setup) first. Trouble is, seemingly
> randomly, they do hit the else meaning a read on Url "gets there
> before" the write (it's all sequential in my code).
>
> Is there anything I can tweak to stop this happening (considering my
> test conf. will be different to production).
>
> Cheers,
> Phil
>