]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
Adjusted existing unit test to work with changed metric_reset function.
authorelene-margalit <elene.margalit@gmail.com>
Tue, 18 Aug 2020 15:30:08 +0000 (17:30 +0200)
committerelene-margalit <elene.margalit@gmail.com>
Tue, 18 Aug 2020 15:30:08 +0000 (17:30 +0200)
src/daemon/metric_test.c

index 174f51c3c7bec22ea6fcb36c81b8eda5d0ca9f3f..543feed4ff79967803af05eae9b2f17f0c377972 100644 (file)
@@ -80,15 +80,24 @@ DEF_TEST(metric_label_set) {
            cases[i].key ? cases[i].key : "(null)",
            cases[i].value ? cases[i].value : "(null)");
 
-    metric_t m = {0};
+    metric_family_t m_fam = {
+      .type = METRIC_TYPE_DISTRIBUTION,
+    };
+    metric_family_t *metric_fam = &m_fam;
+
+    metric_t m = {
+        .family = metric_fam,
+        .value.distribution = NULL,
+    };
+    //metric_t m = {0};
 
     EXPECT_EQ_INT(cases[i].want_err,
                   metric_label_set(&m, cases[i].key, cases[i].value));
     EXPECT_EQ_STR(cases[i].want_get, metric_label_get(&m, cases[i].key));
 
     metric_reset(&m);
-    EXPECT_EQ_PTR(NULL, m.label.ptr);
-    EXPECT_EQ_INT(0, m.label.num);
+    //EXPECT_EQ_PTR(NULL, m.label.ptr);
+    //EXPECT_EQ_INT(0, m.label.num);
   }
 
   return 0;