X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_format_graphite_test.c;h=42efa681654deb06774d1048d39892621d8d44d9;hb=a708a0ccb7c547725e3067a3b67a95c11747c25b;hp=a395683a193f12c7a2670eef2af513569d2d7251;hpb=797ed5e5bee9ee89361f12e447ffc6ceb6ef79d2;p=collectd.git diff --git a/src/utils_format_graphite_test.c b/src/utils_format_graphite_test.c index a395683a..42efa681 100644 --- a/src/utils_format_graphite_test.c +++ b/src/utils_format_graphite_test.c @@ -49,12 +49,12 @@ static data_set_t ds_double = { DEF_TEST(metric_name) { struct { - char *plugin_instance; - char *type_instance; - char *prefix; - char *suffix; + const char *plugin_instance; + const char *type_instance; + const char *prefix; + const char *suffix; unsigned int flags; - char *want_name; + const char *want_name; } cases[] = { { .want_name = "example@com.test.single", @@ -124,6 +124,22 @@ DEF_TEST(metric_name) { .suffix = NULL, .want_name = "foo.example@com.test.single", }, + /* flag GRAPHITE_USE_TAGS */ + {.flags = GRAPHITE_USE_TAGS, + .want_name = "test.single;host=example.com;plugin=test;type=single"}, + {.plugin_instance = "f.o.o", + .type_instance = "b.a.r", + .flags = GRAPHITE_USE_TAGS, + .want_name = "test.single;host=example.com;plugin=test;plugin_instance=" + "f.o.o;type=single;type_instance=b.a.r"}, + {.flags = GRAPHITE_USE_TAGS ^ GRAPHITE_ALWAYS_APPEND_DS, + .want_name = "test.single.value;host=example.com;plugin=test;type=" + "single;ds_name=value"}, + {.plugin_instance = "foo", + .type_instance = "foo", + .flags = GRAPHITE_USE_TAGS ^ GRAPHITE_DROP_DUPE_FIELDS, + .want_name = "test.single;host=example.com;plugin=test;plugin_instance=" + "foo;type=single"}, }; for (size_t i = 0; i < STATIC_ARRAY_SIZE(cases); i++) {