diff options
Diffstat (limited to 'storage/src/tests/persistence/filestorage/deactivatebucketstest.cpp')
-rw-r--r-- | storage/src/tests/persistence/filestorage/deactivatebucketstest.cpp | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/storage/src/tests/persistence/filestorage/deactivatebucketstest.cpp b/storage/src/tests/persistence/filestorage/deactivatebucketstest.cpp index f9375790ebb..18f8a235453 100644 --- a/storage/src/tests/persistence/filestorage/deactivatebucketstest.cpp +++ b/storage/src/tests/persistence/filestorage/deactivatebucketstest.cpp @@ -1,6 +1,5 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/state.h> #include <vespa/persistence/spi/test.h> @@ -9,35 +8,25 @@ #include <tests/persistence/common/filestortestfixture.h> using storage::spi::test::makeSpiBucket; +using namespace ::testing; namespace storage { -class DeactivateBucketsTest : public FileStorTestFixture -{ +struct DeactivateBucketsTest : FileStorTestFixture { bool isActive(const document::BucketId&) const; -public: - void bucketsInDatabaseDeactivatedWhenNodeDownInClusterState(); - - CPPUNIT_TEST_SUITE(DeactivateBucketsTest); - CPPUNIT_TEST(bucketsInDatabaseDeactivatedWhenNodeDownInClusterState); - CPPUNIT_TEST_SUITE_END(); }; -CPPUNIT_TEST_SUITE_REGISTRATION(DeactivateBucketsTest); - bool DeactivateBucketsTest::isActive(const document::BucketId& bucket) const { StorBucketDatabase::WrappedEntry entry( _node->getStorageBucketDatabase().get(bucket, "foo")); - CPPUNIT_ASSERT(entry.exist()); + assert(entry.exist()); return entry->info.isActive(); } -void -DeactivateBucketsTest::bucketsInDatabaseDeactivatedWhenNodeDownInClusterState() -{ - TestFileStorComponents c(*this, "bucketsInDatabaseDeactivatedWhenNodeDownInClusterState"); +TEST_F(DeactivateBucketsTest, buckets_in_database_deactivated_when_node_down_in_cluster_state) { + TestFileStorComponents c(*this); // Must set state to up first, or down-edge case won't trigger. std::string upState("storage:2 distributor:2"); _node->getStateUpdater().setClusterState( @@ -55,13 +44,13 @@ DeactivateBucketsTest::bucketsInDatabaseDeactivatedWhenNodeDownInClusterState() entry->info = serviceLayerInfo; entry.write(); } - CPPUNIT_ASSERT(isActive(bucket)); + EXPECT_TRUE(isActive(bucket)); std::string downState("storage:2 .1.s:d distributor:2"); _node->getStateUpdater().setClusterState( lib::ClusterState::CSP(new lib::ClusterState(downState))); // Buckets should have been deactivated in content layer - CPPUNIT_ASSERT(!isActive(bucket)); + EXPECT_FALSE(isActive(bucket)); } } // namespace storage |