test_utils_vl_lookup_LDADD = liblookup.la daemon/libplugin_mock.la
TESTS = test_utils_mount test_utils_vl_lookup
+
+if BUILD_PLUGIN_CEPH
+test_plugin_ceph_SOURCES = ceph_test.c
+test_plugin_ceph_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBYAJL_CPPFLAGS)
+test_plugin_ceph_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBYAJL_LDFLAGS)
+test_plugin_ceph_LDADD = daemon/libcommon.la daemon/libplugin_mock.la $(BUILD_WITH_LIBYAJL_LIBS)
+check_PROGRAMS += test_plugin_ceph
+TESTS += test_plugin_ceph
+endif
--- /dev/null
+/**
+ * collectd - src/ceph_test.c
+ * Copyright (C) 2015 Florian octo Forster
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; only version 2 of the License is applicable.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors:
+ * Florian octo Forster <octo at collectd.org>
+ **/
+
+#include "ceph.c" /* sic */
+#include "testing.h"
+
+DEF_TEST(parse_keys)
+{
+ struct {
+ char *str;
+ char *want;
+ } cases[] = {
+ {"WBThrottle.bytes_dirtied.description.bytes_wb.description.ios_dirtied.description.ios_wb.type", "WBThrottle.bytesDirtied.description.bytesWb.description.iosDirt"},
+ {"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
+ {"foo:bar", "FooBar"},
+ {"foo:bar+", "FooBarPlus"},
+ {"foo:bar-", "FooBarMinus"},
+ {"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa+", "AaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaPlus"},
+ {"aa.bb.cc.dd.ee.ff", "Aa.bb.cc.dd.ee.ff"},
+ {"aa.bb.cc.dd.ee.ff.type", "Aa.bb.cc.dd.ee.ff"},
+ {"aa.type", "Aa.type"},
+ };
+ size_t i;
+
+ for (i = 0; i < STATIC_ARRAY_SIZE (cases); i++)
+ {
+ char got[DATA_MAX_NAME_LEN];
+
+ memset (got, 0, sizeof (got));
+
+ parse_keys (cases[i].str, got);
+
+ CHECK_ZERO (strcmp (got, cases[i].want));
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ RUN_TEST(parse_keys);
+
+ END_TEST;
+}
+
+/* vim: set sw=2 sts=2 et : */
#include "plugin.h"
+char hostname_g[] = "example.com";
+
+int plugin_register_complex_config (const char *type, int (*callback) (oconfig_item_t *))
+{
+ return ENOTSUP;
+}
+
+int plugin_register_init (const char *name, plugin_init_cb callback)
+{
+ return ENOTSUP;
+}
+
+int plugin_register_read (const char *name, int (*callback) (void))
+{
+ return ENOTSUP;
+}
+
+int plugin_register_shutdown (const char *name, int (*callback) (void))
+{
+ return ENOTSUP;
+}
+
+int plugin_dispatch_values (value_list_t const *vl)
+{
+ return ENOTSUP;
+}
+
void plugin_log (int level, char const *format, ...)
{
char buffer[1024];
printf ("plugin_log (%i, \"%s\");\n", level, buffer);
}
+cdtime_t plugin_get_interval (void)
+{
+ return TIME_T_TO_CDTIME_T (10);
+}
+
/* vim: set sw=2 sts=2 et : */