]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
src/daemon/metric_test.c: Add invalid inputs for `metric_parse_identity`.
authorFlorian Forster <octo@collectd.org>
Thu, 28 Dec 2023 08:51:47 +0000 (09:51 +0100)
committerFlorian Forster <octo@collectd.org>
Thu, 28 Dec 2023 08:54:49 +0000 (09:54 +0100)
src/daemon/metric_test.c

index 5007241df975a5899037639923016cd1f21877ad..ccd9e099ed88465d3f25b7693736db3e193a06ea 100644 (file)
@@ -419,6 +419,21 @@ DEF_TEST(metric_parse_identity) {
                       },
               },
       },
+      {
+          .name = "invalid character in metric name",
+          .input = "example@metric{label=\"value\"}",
+          .want_err = EINVAL,
+      },
+      {
+          .name = "curly not closed",
+          .input = "example_metric{label=\"value\"",
+          .want_err = EINVAL,
+      },
+      {
+          .name = "trailing curly",
+          .input = "example_metric{label=\"value\"}}",
+          .want_err = EINVAL,
+      },
   };
 
   for (size_t i = 0; i < STATIC_ARRAY_SIZE(cases); i++) {