From: JINMEI Tatuya Date: Thu, 10 Jan 2013 17:05:20 +0000 (-0800) Subject: [2575] clarified/corrected some comments for tests. X-Git-Tag: bind10-1.0.0-rc-release~95^2~12^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c9d46273b40b9be9902deaa081be0f1216d287c6;p=thirdparty%2Fkea.git [2575] clarified/corrected some comments for tests. also enabled DatabaseClientTest::createZoneRollbackOnExists with the mock accessor, too (it should have been done but was overlooked). --- diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc index a81d4d8c2c..06b3874008 100644 --- a/src/lib/datasrc/tests/database_unittest.cc +++ b/src/lib/datasrc/tests/database_unittest.cc @@ -4164,15 +4164,14 @@ TYPED_TEST(DatabaseClientTest, createZoneRollbackOnLocked) { } TYPED_TEST(DatabaseClientTest, createZoneRollbackOnExists) { - // skip test for mock (it requires multiple transactions) - if (this->is_mock_) { - return; - } - const Name new_name("example.com"); ASSERT_FALSE(this->client_->createZone(this->zname_)); - // createZone started a transaction, but since it failed, - // it should have been rolled back, and the next attempt should succeed + + // deleteZone started a transaction, but since the zone didn't even exist + // the transaction was not committed but should have been rolled back. + // The first transaction shouldn't leave any state, lock, etc, that + // would hinder the second attempt. + this->allowMoreTransaction(true); ASSERT_TRUE(this->client_->createZone(new_name)); } @@ -4180,14 +4179,14 @@ TYPED_TEST(DatabaseClientTest, deleteZone) { // Check the zone currently exists. EXPECT_EQ(result::SUCCESS, this->client_->findZone(this->zname_).code); - // Deleting an existing zone; it should work and return false (not - // previously existent) + // Deleting an existing zone; it should work and return true (previously + // existed and is now deleted) EXPECT_TRUE(this->client_->deleteZone(this->zname_)); // Now it's not found by findZone EXPECT_EQ(result::NOTFOUND, this->client_->findZone(this->zname_).code); - // And the second call should return false since it now exists + // And the second call should return false since it doesn't exist any more this->allowMoreTransaction(true); EXPECT_FALSE(this->client_->deleteZone(this->zname_)); } @@ -4213,8 +4212,10 @@ TYPED_TEST(DatabaseClientTest, deleteZoneRollbackOnNotFind) { const Name new_name("example.com"); EXPECT_FALSE(this->client_->deleteZone(new_name)); - // deleteZone started a transaction, but since it failed, - // it should have been rolled back, and the next attempt should succeed + // deleteZone started a transaction, but since the zone didn't even exist + // the transaction was not committed but should have been rolled back. + // The first transaction shouldn't leave any state, lock, etc, that + // would hinder the second attempt. this->allowMoreTransaction(true); EXPECT_TRUE(this->client_->deleteZone(this->zname_)); }