Fix dynamic configuration unittest (#22506)
* Fix dynamic configuration unittest execution sequence - Ensure proper initialization (sqlite, rrdlabels) and cleanup (sqlite, rrdlabels) around `unittest_prepare_rrd` and `dyncfg_unittest`. * Update src/daemon/main.c Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * Code formatting fix Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Code style Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Stelios Fragkakis committed
May 19, 2026 at 14:13 UTC
7e710150cff0f297120aa991417c635d55d490d9
1 file changed
+11
-2
src/daemon/main.c
+11
-2
@@ -607,9 +607,18 @@ int netdata_main(int argc, char **argv) {
607
}
608
else if(strcmp(optarg, "dyncfgtest") == 0) {
609
unittest_running = true;
610
- if(unittest_prepare_rrd(&user))
610
+ if(sqlite_library_init())
611
return 1;
612
- return dyncfg_unittest();
612
+ rrdlabels_aral_init(false);
613
+
614
+ int rc = unittest_prepare_rrd(&user);
615
+ if (!rc)
616
+ rc = dyncfg_unittest();
617
+
618
+ sqlite_close_databases();
619
+ sqlite_library_shutdown();
620
+ rrdlabels_aral_destroy(false);
621
+ return rc;
622
}
623
else if(strncmp(optarg, createdataset_string, strlen(createdataset_string)) == 0) {
624
optarg += strlen(createdataset_string);