From b16a83769daaa8ebabbe7c0c0de5b72e7d734112 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 25 Jan 2010 16:17:44 -0500 Subject: [PATCH] another idempotence test --- dbtests/repltests.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/dbtests/repltests.cpp b/dbtests/repltests.cpp index d4d97c115be..244c3079e79 100644 --- a/dbtests/repltests.cpp +++ b/dbtests/repltests.cpp @@ -460,6 +460,29 @@ namespace ReplTests { BSONObj o_, q_, u_, ou_; }; + class UpdateInc2 : public Base { + public: + UpdateInc2() : + o_( fromjson( "{'_id':1,a:5}" ) ), + q_( fromjson( "{a:5}" ) ), + u_( fromjson( "{$inc:{a:3},$set:{x:5}}" ) ), + ou_( fromjson( "{'_id':1,a:8,x:5}" ) ) {} + void doIt() const { + client()->update( ns(), q_, u_ ); + } + void check() const { + ASSERT_EQUALS( 1, count() ); + checkOne( ou_ ); + } + void reset() const { + deleteAll( ns() ); + insert( o_ ); + } + protected: + BSONObj o_, q_, u_, ou_; + }; + + class UpsertInsertIdMod : public Base { public: UpsertInsertIdMod() : @@ -1016,6 +1039,7 @@ namespace ReplTests { add< Idempotence::UpsertInsertNoMods >(); add< Idempotence::UpdateSet >(); add< Idempotence::UpdateInc >(); + add< Idempotence::UpdateInc2 >(); add< Idempotence::UpsertInsertIdMod >(); add< Idempotence::UpsertInsertSet >(); add< Idempotence::UpsertInsertInc >();