From: Loic Dachary Date: Sat, 4 Jan 2014 10:03:18 +0000 (+0100) Subject: common: multiple variable occurence expansion test X-Git-Tag: v0.77~45^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5bb1545eed52c8318d73d1549b5ed639d33be78e;p=ceph.git common: multiple variable occurence expansion test http://tracker.ceph.com/issues/7103 refs #7103 Signed-off-by: Loic Dachary --- diff --git a/src/test/daemon_config.cc b/src/test/daemon_config.cc index d643a6f49677..54b334edf500 100644 --- a/src/test/daemon_config.cc +++ b/src/test/daemon_config.cc @@ -121,6 +121,23 @@ TEST(DaemonConfig, SubstitutionLoop) { ASSERT_TRUE(strchr(buf, '$') || strchr(buf2, '$')); } +// config: variable substitution happen only once http://tracker.ceph.com/issues/7103 +TEST(DaemonConfig, SubstitutionMultiple) { + int ret; + ret = g_ceph_context->_conf->set_val("mon_host", "localhost", false); + ASSERT_EQ(ret, 0); + ret = g_ceph_context->_conf->set_val("keyring", "$mon_host/$cluster.keyring,$mon_host/$cluster.mon.keyring", false); + ASSERT_EQ(ret, 0); + g_ceph_context->_conf->apply_changes(NULL); + char buf[512]; + memset(buf, 0, sizeof(buf)); + char *tmp = buf; + ret = g_ceph_context->_conf->get_val("keyring", &tmp, sizeof(buf)); + ASSERT_EQ(ret, 0); + ASSERT_EQ(string("localhost/ceph.keyring,localhost/ceph.mon.keyring"), tmp); + ASSERT_TRUE(strchr(buf, '$') == NULL); +} + TEST(DaemonConfig, ArgV) { ASSERT_EQ(0, g_ceph_context->_conf->set_val("internal_safe_to_start_threads", "false")); @@ -332,3 +349,8 @@ TEST(DaemonConfig, ThreadSafety1) { "false")); ASSERT_EQ(ret, 0); } +/* + * Local Variables: + * compile-command: "cd .. ; make unittest_daemon_config && ./unittest_daemon_config" + * End: + */