-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ceph#60812 from pecastro/improve-a-few-tests
tests: Improve unittest_dbstore_tests and unittest_deferred to be suitable for reruns. Reviewed-by: Soumya Koduri <[email protected]>
- Loading branch information
Showing
3 changed files
with
24 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ namespace gtest { | |
Environment(): tenant("default_ns"), db(nullptr), | ||
db_type("SQLite"), ret(-1) {} | ||
|
||
Environment(string tenantname, string db_typename): | ||
Environment(string tenantname, string db_typename): | ||
tenant(tenantname), db(nullptr), | ||
db_type(db_typename), ret(-1) {} | ||
|
||
|
@@ -153,8 +153,8 @@ TEST_F(DBStoreTest, InsertUser) { | |
RGWAccessKey k2("id2", "key2"); | ||
params.op.user.uinfo.access_keys["id1"] = k1; | ||
params.op.user.uinfo.access_keys["id2"] = k2; | ||
params.op.user.user_version.ver = 1; | ||
params.op.user.user_version.tag = "UserTAG"; | ||
params.op.user.user_version.ver = 1; | ||
params.op.user.user_version.tag = "UserTAG"; | ||
|
||
ret = db->ProcessOp(dpp, "InsertUser", ¶ms); | ||
ASSERT_EQ(ret, 0); | ||
|
@@ -841,7 +841,7 @@ TEST_F(DBStoreTest, IterateObject) { | |
TEST_F(DBStoreTest, ListBucketObjects) { | ||
struct DBOpParams params = GlobalParams; | ||
int ret = -1; | ||
|
||
int max = 2; | ||
bool is_truncated = false; | ||
rgw_obj_key marker1; | ||
|
@@ -1032,7 +1032,7 @@ TEST_F(DBStoreTest, DeleteVersionedObject) { | |
true, &s); | ||
ASSERT_EQ(ret, -ENOENT); | ||
|
||
/* Delete delete marker..should be able to read object now */ | ||
/* Delete delete marker..should be able to read object now */ | ||
params.op.obj.state.obj.key.instance = dm_instance; | ||
DB::Object op_target3(db, params.op.bucket.info, params.op.obj.state.obj); | ||
DB::Object::Delete delete_op2(&op_target3); | ||
|
@@ -1307,13 +1307,13 @@ TEST_F(DBStoreTest, LCEntry) { | |
ASSERT_EQ(ret, 0); | ||
|
||
// get entry index1, entry1 | ||
ret = db->get_entry(index1, ents[0], entry); | ||
ret = db->get_entry(index1, ents[0], entry); | ||
ASSERT_EQ(ret, 0); | ||
ASSERT_EQ(entry.status, lc_uninitial); | ||
ASSERT_EQ(entry.start_time, lc_time); | ||
|
||
// get next entry index1, entry2 | ||
ret = db->get_next_entry(index1, ents[1], entry); | ||
ret = db->get_next_entry(index1, ents[1], entry); | ||
ASSERT_EQ(ret, 0); | ||
ASSERT_EQ(entry.bucket, ents[2]); | ||
ASSERT_EQ(entry.status, lc_uninitial); | ||
|
@@ -1323,7 +1323,7 @@ TEST_F(DBStoreTest, LCEntry) { | |
entry4.status = lc_complete; | ||
ret = db->set_entry(index2, entry4); | ||
ASSERT_EQ(ret, 0); | ||
ret = db->get_entry(index2, ents[3], entry); | ||
ret = db->get_entry(index2, ents[3], entry); | ||
ASSERT_EQ(ret, 0); | ||
ASSERT_EQ(entry.status, lc_complete); | ||
|
||
|
@@ -1337,7 +1337,7 @@ TEST_F(DBStoreTest, LCEntry) { | |
} | ||
|
||
// remove index1, entry3 | ||
ret = db->rm_entry(index1, entry3); | ||
ret = db->rm_entry(index1, entry3); | ||
ASSERT_EQ(ret, 0); | ||
|
||
// get next entry index1, entry2.. should be empty | ||
|
@@ -1373,8 +1373,8 @@ TEST_F(DBStoreTest, InsertTestIDUser) { | |
params.op.user.uinfo.user_email = "[email protected]"; | ||
RGWAccessKey k1("0555b35654ad1656d804", "h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q=="); | ||
params.op.user.uinfo.access_keys["0555b35654ad1656d804"] = k1; | ||
params.op.user.user_version.ver = 1; | ||
params.op.user.user_version.tag = "UserTAG"; | ||
params.op.user.user_version.ver = 1; | ||
params.op.user.user_version.tag = "UserTAG"; | ||
|
||
ret = db->ProcessOp(dpp, "InsertUser", ¶ms); | ||
ASSERT_EQ(ret, 0); | ||
|
@@ -1385,19 +1385,22 @@ int main(int argc, char **argv) | |
int ret = -1; | ||
string c_logfile = "rgw_dbstore_tests.log"; | ||
int c_loglevel = 20; | ||
string c_tenant = "default_ns_" + std::to_string(time(NULL)); | ||
|
||
// format: ./dbstore-tests logfile loglevel | ||
if (argc == 3) { | ||
// format: ./dbstore-tests logfile loglevel tenantname | ||
if (argc == 4) { | ||
c_logfile = argv[1]; | ||
c_loglevel = (atoi)(argv[2]); | ||
cout << "logfile:" << c_logfile << ", loglevel set to " << c_loglevel << "\n"; | ||
c_tenant = argv[3]; | ||
cout << "logfile:" << c_logfile << ", loglevel set to " << c_loglevel << ", db is " << c_tenant << "\n"; | ||
} | ||
|
||
::testing::InitGoogleTest(&argc, argv); | ||
|
||
gtest::env = new gtest::Environment(); | ||
gtest::env->logfile = c_logfile; | ||
gtest::env->loglevel = c_loglevel; | ||
gtest::env->tenant = c_tenant; | ||
::testing::AddGlobalTestEnvironment(gtest::env); | ||
|
||
ret = RUN_ALL_TESTS(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters