Skip to content

Commit

Permalink
test/TestPGLog: refactor case diagrams
Browse files Browse the repository at this point in the history
Signed-off-by: Deepika <dupadhya@redhat.com>
  • Loading branch information
Deepika committed Jan 19, 2021
1 parent 35bfdaa commit 66bcf56
Showing 1 changed file with 39 additions and 67 deletions.
106 changes: 39 additions & 67 deletions src/test/osd/TestPGLog.cc
Expand Up @@ -358,22 +358,23 @@ struct TestHandler : public PGLog::LogEntryHandler {
};

TEST_F(PGLogTest, rewind_divergent_log) {
/* +----------------+
| log |
+--------+-------+
| |object |
|version | hash |
| | |
tail > (1,1) | x5 |
| | |
| | |
| (1,4) | x9 < newhead
| MODIFY | |
| | |
head > (1,5) | x9 |
| DELETE | |
| | |
+--------+-------+
/* Before After
+----------------+
| log | +----------------+
+----------------+ | log |
| |object | +----------------+
+>version | hash | | |object |
| | | +>version | hash |
tail > (1,1) | x5 | | | |
| | | tail > (1,1) | NULL |
| | | | | |
| (1,4) | x9 < newhead | (1,4) | NULL < newhead
| MODIFY | | | | |
| | | head > (1,5) | x9 |
head > (1,5) | x9 | | | |
| DELETE | | +--------+-------+
| | |
+--------+-------+
*/
{
Expand Down Expand Up @@ -441,21 +442,6 @@ TEST_F(PGLogTest, rewind_divergent_log) {
EXPECT_TRUE(dirty_big_info);
}

/* +----------------+
| log |
+--------+-------+
| |object |
|version | hash |
| | |
tail > (1,1) | NULL |
| | |
| (1,4) | NULL < newhead
| | |
head > (1,5) | x9 |
| | |
+--------+-------+
*/
{
clear();

Expand Down Expand Up @@ -961,42 +947,27 @@ TEST_F(PGLogTest, merge_log) {
EXPECT_FALSE(dirty_big_info);
}

/* Before
+--------------------------+
| log olog |
+--------+-------+---------+
| |object | |
|version | hash | version |
| | | |
| | x5 | (1,1) < tail
| | | |
| | | |
tail > (1,4) | x7 | |
| | | |
| | | |
head > (1,5) | x9 | (1,5) < head
| | | |
| | | |
+--------+-------+---------+
/* Before After
+--------------------------+ +----------------+
| log olog | | log |
+----------------+---------+ +----------------+
| |object | | | |object |
+>version | hash | version | +>version | hash |
| | | | | | |
| | x5 | (1,1) < tail tail > (1,1) | x5 |
| | | | | | |
| | | | | | |
tail > (1,4) | x7 | | | (1,4) | x7 |
| | | | | | |
| | | | | | |
head > (1,5) | x9 | (1,5) < head head > (1,5) | x9 |
| | | | | | |
| | | | | | |
+--------+-------+---------+ +--------+-------+
*/

After
+-----------------
| log |
+--------+-------+
| |object |
|version | hash |
| | |
tail > (1,1) | x5 |
| | |
| | |
| (1,4) | x7 |
| | |
| | |
head > (1,5) | x9 |
| | |
| | |
+--------+-------+
*/
{
//case: 2
clear();
Expand Down Expand Up @@ -1067,7 +1038,8 @@ TEST_F(PGLogTest, merge_log) {
EXPECT_TRUE(dirty_big_info);
}

/* +--------------------------+
/* Before
+--------------------------+
| log olog |
+--------+-------+---------+
| |object | |
Expand Down

0 comments on commit 66bcf56

Please sign in to comment.