]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Make test idempotent.
authorPaulo E. Castro <pecastro@wormholenet.com>
Sat, 16 Nov 2024 11:32:20 +0000 (11:32 +0000)
committerPaulo E. Castro <pecastro@wormholenet.com>
Wed, 4 Dec 2024 23:22:14 +0000 (23:22 +0000)
Give it a new DB name for each test so we don't get failures on rerun.

Signed-off-by: Paulo E. Castro <pecastro@wormholenet.com>
src/rgw/driver/dbstore/README.md
src/rgw/driver/dbstore/tests/dbstore_tests.cc

index e8fdab7e5bd10f8b350afd2bfac30b25c5307ca6..bcde79a2891d5a45b6f440b4ddec3c7671b5ba31 100644 (file)
@@ -40,8 +40,8 @@ The location and prefix for the database files can be configured using the follo
 To execute DBStore unit test cases (using Gtest framework), from build directory
 
     ninja unittest_dbstore_tests
-    ./bin/unittest_dbstore_tests [logfile] [loglevel]
-    (default logfile: rgw_dbstore_tests.log, loglevel: 20)
+    ./bin/unittest_dbstore_tests [logfile] [loglevel] [tenantname]
+    (default logfile: rgw_dbstore_tests.log, loglevel: 20, default_ns_<timestamp_at_time_of_run>)
     ninja unittest_dbstore_mgr_tests
     ./bin/unittest_dbstore_mgr_tests
 
index d63a5728c50ac4ab9e71a20a25fb88db09a852e0..554c4d29382a5138e4652bd579d452bcd43448d3 100644 (file)
@@ -1385,12 +1385,14 @@ 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);
@@ -1398,6 +1400,7 @@ int main(int argc, char **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();