@@ -65,7 +65,7 @@ class VolumeTest : public ::testing::Test {
6565#endif
6666};
6767
68- TEST_F (VolumeTest, CreateVolumeThenRecover ) {
68+ TEST_F (VolumeTest, CreateDestroyVolume ) {
6969 std::vector< volume_id_t > vol_ids;
7070 {
7171 auto hb = g_helper->inst ();
@@ -86,29 +86,25 @@ TEST_F(VolumeTest, CreateVolumeThenRecover) {
8686 }
8787
8888 auto const s = hb->get_stats ();
89- LOGINFO (" Stats: {}" , s.to_string ());
90- }
91-
92- g_helper->restart (5 );
89+ auto const dtype = hb->data_drive_type ();
90+ LOGINFO (" Stats: {}, drive_type: {}" , s.to_string (), dtype);
9391
94- // verify the volumes are still there
95- {
96- auto hb = g_helper-> inst ();
97- auto vol_mgr = hb-> volume_manager ( );
98-
99- for ( const auto & id : vol_ids) {
92+ for ( uint32_t i = 0 ; i < num_vols; ++i) {
93+ auto id = vol_ids[i];
94+ auto ret = vol_mgr-> remove_volume (id). get ();
95+ ASSERT_TRUE (ret );
96+ // sleep for a while
97+ std::this_thread::sleep_for ( std::chrono::milliseconds ( 2000 ));
10098 auto vinfo_ptr = vol_mgr->lookup_volume (id);
101- // verify the volume is there
102- ASSERT_TRUE (vinfo_ptr ! = nullptr );
99+ // verify the volume is not there
100+ ASSERT_TRUE (vinfo_ptr = = nullptr );
103101 }
104102 }
105- }
106103
107- TEST_F (VolumeTest, DestroyVolumeCrashRecovery) {
104+ g_helper->restart (5 );
105+ }
108106
109- #ifdef _PRERELEASE
110- set_flip_point (" vol_destroy_crash_simulation" );
111- #endif
107+ TEST_F (VolumeTest, CreateVolumeThenRecover) {
112108 std::vector< volume_id_t > vol_ids;
113109 {
114110 auto hb = g_helper->inst ();
@@ -127,18 +123,28 @@ TEST_F(VolumeTest, DestroyVolumeCrashRecovery) {
127123 // verify the volume is there
128124 ASSERT_TRUE (vinfo_ptr != nullptr );
129125 }
130-
131- for (uint32_t i = 0 ; i < num_vols; ++i) {
132- auto id = vol_ids[i];
133- auto ret = vol_mgr->remove_volume (id).get ();
134- ASSERT_TRUE (ret);
135- }
136126 }
137127
138128 g_helper->restart (5 );
129+
130+ // verify the volumes are still there
131+ {
132+ auto hb = g_helper->inst ();
133+ auto vol_mgr = hb->volume_manager ();
134+
135+ for (const auto & id : vol_ids) {
136+ auto vinfo_ptr = vol_mgr->lookup_volume (id);
137+ // verify the volume is there
138+ ASSERT_TRUE (vinfo_ptr != nullptr );
139+ }
140+ }
139141}
140142
141- TEST_F (VolumeTest, CreateDestroyVolume) {
143+ TEST_F (VolumeTest, DestroyVolumeCrashRecovery) {
144+
145+ #ifdef _PRERELEASE
146+ set_flip_point (" vol_destroy_crash_simulation" );
147+ #endif
142148 std::vector< volume_id_t > vol_ids;
143149 {
144150 auto hb = g_helper->inst ();
@@ -162,13 +168,10 @@ TEST_F(VolumeTest, CreateDestroyVolume) {
162168 auto id = vol_ids[i];
163169 auto ret = vol_mgr->remove_volume (id).get ();
164170 ASSERT_TRUE (ret);
165- // sleep for a while
166- std::this_thread::sleep_for (std::chrono::milliseconds (2000 ));
167- auto vinfo_ptr = vol_mgr->lookup_volume (id);
168- // verify the volume is not there
169- ASSERT_TRUE (vinfo_ptr == nullptr );
170171 }
171172 }
173+
174+ g_helper->restart (5 );
172175}
173176
174177int main (int argc, char * argv[]) {
0 commit comments