From: JINMEI Tatuya Date: Tue, 9 Oct 2012 00:27:23 +0000 (-0700) Subject: [2204] updated test comments without using "rollback". X-Git-Tag: trac2351_base~1^2~8^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3a68ea2e8de8d6df97d95c077ff9e2874ca0d9c3;p=thirdparty%2Fkea.git [2204] updated test comments without using "rollback". as the new code actually doesn't do rollback operation internally, even though the observable effect is the same. --- diff --git a/src/bin/auth/tests/datasrc_config_unittest.cc b/src/bin/auth/tests/datasrc_config_unittest.cc index 97d89bf2bb..877f92166f 100644 --- a/src/bin/auth/tests/datasrc_config_unittest.cc +++ b/src/bin/auth/tests/datasrc_config_unittest.cc @@ -244,10 +244,11 @@ TEST_F(DatasrcConfigTest, updateDelete) { EXPECT_TRUE(lists_.empty()); } -// Check that we can rollback an addition if something else fails -TEST_F(DatasrcConfigTest, rollbackAddition) { +// Check that broken new configuration doesn't break the running configuration. +TEST_F(DatasrcConfigTest, brokenConfigForAdd) { initializeINList(); - // The configuration is wrong. However, the CH one will get done first. + // The configuration is wrong. However, the CH one will be handled + // without an error first. const ElementPtr config(buildConfig("{\"IN\": [{\"type\": 13}], " "\"CH\": [{\"type\": \"xxx\"}]}")); @@ -263,8 +264,9 @@ TEST_F(DatasrcConfigTest, rollbackAddition) { EXPECT_FALSE(lists_[RRClass::CH()]); } -// Check that we can rollback a deletion if something else fails -TEST_F(DatasrcConfigTest, rollbackDeletion) { +// Similar to the previous one, but the broken config would delete part of +// the running config. +TEST_F(DatasrcConfigTest, brokenConfigForDelete) { initializeINList(); // Put the CH there const ElementPtr @@ -273,27 +275,25 @@ TEST_F(DatasrcConfigTest, rollbackDeletion) { testConfigureDataSource(*this, config1); const ElementPtr config2(Element::fromJSON("{\"IN\": [{\"type\": 13}]}")); - // This would delete CH. However, the IN one fails. - // As the deletions happen after the additions/settings - // and there's no known way to cause an exception during the - // deletions, it is not a true rollback, but the result should - // be the same. + // This would delete CH. However, the new config is broken, so it won't + // actually apply. EXPECT_THROW(testConfigureDataSource(*this, config2), TypeError); EXPECT_EQ("yyy", lists_[RRClass::IN()]->getConf()); EXPECT_EQ("xxx", lists_[RRClass::CH()]->getConf()); } -// Check that we can roll back configuration change if something -// fails later on. -TEST_F(DatasrcConfigTest, rollbackConfiguration) { +// Similar to the previous cases, but the broken config would modify the +// running config of one of the classes. +TEST_F(DatasrcConfigTest, brokenConfigForModify) { initializeINList(); // Put the CH there const ElementPtr config1(Element::fromJSON("{\"IN\": [{\"type\": \"yyy\"}], " "\"CH\": [{\"type\": \"xxx\"}]}")); testConfigureDataSource(*this, config1); - // Now, the CH happens first. But nevertheless, it should be - // restored to the previoeus version. + // Now, the CH change will be handled first without an error, then + // the change to the IN class will fail, and the none of the changes + // will apply. const ElementPtr config2(Element::fromJSON("{\"IN\": [{\"type\": 13}], " "\"CH\": [{\"type\": \"yyy\"}]}"));