index a36037452ddbfd3fdfdffc7a2468c83e4c878664..73f3042ee9516a8605346393ab4ca456cdb2dd5c 100644 (file)
#include "frontend/connection.h"
#include "frontend/parser.h"
#include "frontend/connection-private.h"
-#include "libsysdb_test.h"
+#include "testutils.h"
#include <check.h>
"\"last_update\": \"1970-01-01 00:00:00 +0000\", " \
"\"update_interval\": \"0s\", \"backends\": [], " \
"\"attributes\": [" \
+ "{\"name\": \"hostname\", \"value\": \"h1\", " \
+ "\"last_update\": \"1970-01-01 00:00:00 +0000\", " \
+ "\"update_interval\": \"0s\", \"backends\": []}," \
"{\"name\": \"k3\", \"value\": 42, " \
"\"last_update\": \"1970-01-01 00:00:00 +0000\", " \
"\"update_interval\": \"0s\", \"backends\": []}]}," \
"{\"name\": \"m2\", \"timeseries\": false, " \
"\"last_update\": \"1970-01-01 00:00:00 +0000\", " \
- "\"update_interval\": \"0s\", \"backends\": []}]}"
+ "\"update_interval\": \"0s\", \"backends\": [], " \
+ "\"attributes\": [" \
+ "{\"name\": \"hostname\", \"value\": \"h1\", " \
+ "\"last_update\": \"1970-01-01 00:00:00 +0000\", " \
+ "\"update_interval\": \"0s\", \"backends\": []}]}]}"
#define SERVICE_H2_S1 \
"{\"name\": \"h2\", \"last_update\": \"1970-01-01 00:00:00 +0000\", " \
"\"update_interval\": \"0s\", \"backends\": [], " \
"\"services\": [" \
"{\"name\": \"s1\", \"last_update\": \"1970-01-01 00:00:00 +0000\", " \
- "\"update_interval\": \"0s\", \"backends\": []}]}"
+ "\"update_interval\": \"0s\", \"backends\": [], " \
+ "\"attributes\": [" \
+ "{\"name\": \"hostname\", \"value\": \"h2\", " \
+ "\"last_update\": \"1970-01-01 00:00:00 +0000\", " \
+ "\"update_interval\": \"0s\", \"backends\": []}]}]}"
#define METRIC_H1_M1 \
"{\"name\": \"h1\", \"last_update\": \"1970-01-01 00:00:00 +0000\", " \
"\"last_update\": \"1970-01-01 00:00:00 +0000\", " \
"\"update_interval\": \"0s\", \"backends\": [], " \
"\"attributes\": [" \
+ "{\"name\": \"hostname\", \"value\": \"h1\", " \
+ "\"last_update\": \"1970-01-01 00:00:00 +0000\", " \
+ "\"update_interval\": \"0s\", \"backends\": []}," \
"{\"name\": \"k3\", \"value\": 42, " \
"\"last_update\": \"1970-01-01 00:00:00 +0000\", " \
"\"update_interval\": \"0s\", \"backends\": []}]}]}"
/* hosts */
{
SDB_HOST, "h1", NULL, NULL,
- 0, SDB_CONNECTION_DATA, 851, HOST_H1,
+ 0, SDB_CONNECTION_DATA, 1110, HOST_H1,
},
{
SDB_HOST, "h1", NULL, "age >= 0s", /* always matches */
- 0, SDB_CONNECTION_DATA, 851, HOST_H1,
+ 0, SDB_CONNECTION_DATA, 1110, HOST_H1,
},
{
SDB_HOST, "h1", NULL, "age < 0s", /* never matches */
/* services */
{
SDB_SERVICE, "h2", "s1", NULL,
- 0, SDB_CONNECTION_DATA, 218, SERVICE_H2_S1,
+ 0, SDB_CONNECTION_DATA, 356, SERVICE_H2_S1,
},
{
SDB_SERVICE, "h2", "s1", "age >= 0s", /* always matches */
- 0, SDB_CONNECTION_DATA, 218, SERVICE_H2_S1,
+ 0, SDB_CONNECTION_DATA, 356, SERVICE_H2_S1,
},
{
SDB_SERVICE, "h2", "s1", "age < 0s", /* never matches */
/* metrics */
{
SDB_METRIC, "h1", "m1", NULL,
- 0, SDB_CONNECTION_DATA, 368, METRIC_H1_M1,
+ 0, SDB_CONNECTION_DATA, 489, METRIC_H1_M1,
},
{
SDB_METRIC, "h1", "m1", "age >= 0s", /* always matches */
- 0, SDB_CONNECTION_DATA, 368, METRIC_H1_M1,
+ 0, SDB_CONNECTION_DATA, 489, METRIC_H1_M1,
},
{
SDB_METRIC, "h1", "m1", "age < 0s", /* never matches */
}
END_TEST
-Suite *
-fe_query_suite(void)
+TEST_MAIN("frontend::query")
{
- Suite *s = suite_create("frontend::query");
- TCase *tc;
-
- tc = tcase_create("core");
+ TCase *tc = tcase_create("core");
tcase_add_checked_fixture(tc, populate, sdb_store_clear);
tcase_add_loop_test(tc, test_exec_fetch, 0, SDB_STATIC_ARRAY_LEN(exec_fetch_data));
- suite_add_tcase(s, tc);
-
- return s;
-} /* fe_query_suite */
+ ADD_TCASE(tc);
+}
+TEST_MAIN_END
/* vim: set tw=78 sw=4 ts=4 noexpandtab : */