]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
unittest_osdmap: feed options as defaults
authorSage Weil <sage@redhat.com>
Wed, 2 Jan 2019 17:40:22 +0000 (11:40 -0600)
committerSage Weil <sage@redhat.com>
Wed, 2 Jan 2019 17:40:45 +0000 (11:40 -0600)
We can't change some of these at runtime due to FLAG_CREATE.

Signed-off-by: Sage Weil <sage@redhat.com>
src/test/osd/TestOSDMap.cc

index e76f4731494989f1f2dfd54931699d09ebf2fbe2..986278a5a0daf76837314d67e4276c3a2a7fc0b5 100644 (file)
 using namespace std;
 
 int main(int argc, char **argv) {
+  map<string,string> defaults = {
+    // make sure we have 3 copies, or some tests won't work
+    { "osd_pool_default_size", "3" },
+    // our map is flat, so just try and split across OSDs, not hosts or whatever
+    { "osd_crush_chooseleaf_type", "0" },
+  };
   std::vector<const char*> args(argv, argv+argc);
-  auto cct = global_init(nullptr, args, CEPH_ENTITY_TYPE_CLIENT,
+  auto cct = global_init(&defaults, args, CEPH_ENTITY_TYPE_CLIENT,
                         CODE_ENVIRONMENT_UTILITY,
                         CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
   common_init_finish(g_ceph_context);
-  // make sure we have 3 copies, or some tests won't work
-  g_ceph_context->_conf.set_val("osd_pool_default_size", "3");
-  // our map is flat, so just try and split across OSDs, not hosts or whatever
-  g_ceph_context->_conf.set_val("osd_crush_chooseleaf_type", "0");
   ::testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
 }