Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1)

Side by Side Diff: src/BackupMasterRecoveryTest.cc

Issue 248001: Test (Closed)
Patch Set: Created 11 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/BackupMasterRecovery.cc ('k') | src/ClientException.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2012 Stanford University 1 /* Copyright (c) 2012 Stanford University
2 * 2 *
3 * Permission to use, copy, modify, and distribute this software for any 3 * Permission to use, copy, modify, and distribute this software for any
4 * purpose with or without fee is hereby granted, provided that the above 4 * purpose with or without fee is hereby granted, provided that the above
5 * copyright notice and this permission notice appear in all copies. 5 * copyright notice and this permission notice appear in all copies.
6 * 6 *
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES 7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR 9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR
10 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 10 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 240 }
241 241
242 TEST_F(BackupMasterRecoveryTest, getRecoverySegment) { 242 TEST_F(BackupMasterRecoveryTest, getRecoverySegment) {
243 mockMetadata(88); // secondary 243 mockMetadata(88); // secondary
244 mockMetadata(89, true, true); // primary 244 mockMetadata(89, true, true); // primary
245 recovery->testingExtractDigest = &mockExtractDigest; 245 recovery->testingExtractDigest = &mockExtractDigest;
246 recovery->testingSkipBuild = true; 246 recovery->testingSkipBuild = true;
247 recovery->start(frames, NULL, NULL); 247 recovery->start(frames, NULL, NULL);
248 recovery->setPartitionsAndSchedule(partitions); 248 recovery->setPartitionsAndSchedule(partitions);
249 249
250 Status status = recovery->getRecoverySegment(456, 89, 0, NULL, NULL); 250 EXPECT_THROW(recovery->getRecoverySegment(456, 89, 0, NULL, NULL),
251 EXPECT_EQ(STATUS_RETRY, status); 251 RetryException);
252 252
253 taskQueue.performTask(); 253 taskQueue.performTask();
254 254
255 status = recovery->getRecoverySegment(456, 88, 0, NULL, NULL); 255 Status status = recovery->getRecoverySegment(456, 88, 0, NULL, NULL);
256 EXPECT_EQ(STATUS_OK, status); 256 EXPECT_EQ(STATUS_OK, status);
257 Buffer buffer; 257 Buffer buffer;
258 buffer.append("important", 10); 258 buffer.append("important", 10);
259 ASSERT_TRUE(recovery->replicas[1].recoverySegments[0].append( 259 ASSERT_TRUE(recovery->replicas[1].recoverySegments[0].append(
260 LOG_ENTRY_TYPE_OBJ, buffer)); 260 LOG_ENTRY_TYPE_OBJ, buffer));
261 buffer.reset(); 261 buffer.reset();
262 Segment::Certificate certificate; 262 Segment::Certificate certificate;
263 memset(&certificate, 0xff, sizeof(certificate)); 263 memset(&certificate, 0xff, sizeof(certificate));
264 status = recovery->getRecoverySegment(456, 88, 0, &buffer, &certificate); 264 status = recovery->getRecoverySegment(456, 88, 0, &buffer, &certificate);
265 EXPECT_EQ(STATUS_OK, status); 265 EXPECT_EQ(STATUS_OK, status);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 EXPECT_TRUE(StringUtil::startsWith(TestLog::get(), 359 EXPECT_TRUE(StringUtil::startsWith(TestLog::get(),
360 "buildRecoverySegments: Couldn't build recovery segments for " 360 "buildRecoverySegments: Couldn't build recovery segments for "
361 "<99.0,88>: RAMCloud::SegmentIteratorException: cannot iterate: " 361 "<99.0,88>: RAMCloud::SegmentIteratorException: cannot iterate: "
362 "corrupt segment thrown ")); 362 "corrupt segment thrown "));
363 EXPECT_TRUE(recovery->replicas.at(0).recoveryException); 363 EXPECT_TRUE(recovery->replicas.at(0).recoveryException);
364 EXPECT_FALSE(recovery->replicas.at(0).recoverySegments); 364 EXPECT_FALSE(recovery->replicas.at(0).recoverySegments);
365 EXPECT_TRUE(recovery->replicas.at(0).built); 365 EXPECT_TRUE(recovery->replicas.at(0).built);
366 } 366 }
367 367
368 } // namespace RAMCloud 368 } // namespace RAMCloud
OLDNEW
« no previous file with comments | « src/BackupMasterRecovery.cc ('k') | src/ClientException.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld aab5469