Skip to content

Commit 64539ed

Browse files
committed
rgw: Make test idempotent.
Give it a new DB name for each test so we don't get failures on rerun. Signed-off-by: Paulo E. Castro <[email protected]>
1 parent 1b5391d commit 64539ed

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/rgw/driver/dbstore/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ The location and prefix for the database files can be configured using the follo
4040
To execute DBStore unit test cases (using Gtest framework), from build directory
4141

4242
ninja unittest_dbstore_tests
43-
./bin/unittest_dbstore_tests [logfile] [loglevel]
44-
(default logfile: rgw_dbstore_tests.log, loglevel: 20)
43+
./bin/unittest_dbstore_tests [logfile] [loglevel] [tenantname]
44+
(default logfile: rgw_dbstore_tests.log, loglevel: 20, default_ns_<timestamp_at_time_of_run>)
4545
ninja unittest_dbstore_mgr_tests
4646
./bin/unittest_dbstore_mgr_tests
4747

src/rgw/driver/dbstore/tests/dbstore_tests.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,19 +1385,22 @@ int main(int argc, char **argv)
13851385
int ret = -1;
13861386
string c_logfile = "rgw_dbstore_tests.log";
13871387
int c_loglevel = 20;
1388+
string c_tenant = "default_ns_" + std::to_string(time(NULL));
13881389

1389-
// format: ./dbstore-tests logfile loglevel
1390-
if (argc == 3) {
1390+
// format: ./dbstore-tests logfile loglevel tenantname
1391+
if (argc == 4) {
13911392
c_logfile = argv[1];
13921393
c_loglevel = (atoi)(argv[2]);
1393-
cout << "logfile:" << c_logfile << ", loglevel set to " << c_loglevel << "\n";
1394+
c_tenant = argv[3];
1395+
cout << "logfile:" << c_logfile << ", loglevel set to " << c_loglevel << ", db is " << c_tenant << "\n";
13941396
}
13951397

13961398
::testing::InitGoogleTest(&argc, argv);
13971399

13981400
gtest::env = new gtest::Environment();
13991401
gtest::env->logfile = c_logfile;
14001402
gtest::env->loglevel = c_loglevel;
1403+
gtest::env->tenant = c_tenant;
14011404
::testing::AddGlobalTestEnvironment(gtest::env);
14021405

14031406
ret = RUN_ALL_TESTS();

0 commit comments

Comments
 (0)