aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-20 17:03:51 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-20 17:03:51 +0000
commit3d10a9ead7d1241035160ab3355577051186b0fd (patch)
tree7413ffa6f6ecf18422e95be046f06b9a40e4bc43 /test
parent64e6d18a31fd069a83baafe308a8c5d6ec3591e1 (diff)
downloadrspamd-3d10a9ead7d1241035160ab3355577051186b0fd.tar.gz
rspamd-3d10a9ead7d1241035160ab3355577051186b0fd.zip
Rework upstreams initialization
Diffstat (limited to 'test')
-rw-r--r--test/rspamd_upstream_test.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/test/rspamd_upstream_test.c b/test/rspamd_upstream_test.c
index 0cf163322..6ed14dbf5 100644
--- a/test/rspamd_upstream_test.c
+++ b/test/rspamd_upstream_test.c
@@ -74,9 +74,7 @@ rspamd_upstream_test_func (void)
struct timeval tv;
rspamd_inet_addr_t *addr, *next_addr, *paddr;
- cfg = (struct rspamd_config *)g_malloc (sizeof (struct rspamd_config));
- bzero (cfg, sizeof (struct rspamd_config));
- cfg->cfg_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
+ cfg = rspamd_config_new ();
cfg->dns_retransmits = 2;
cfg->dns_timeout = 0.5;
cfg->upstream_max_errors = 1;
@@ -84,9 +82,7 @@ rspamd_upstream_test_func (void)
cfg->upstream_error_time = 2;
resolver = dns_resolver_init (NULL, ev_base, cfg);
-
- cfg->ups_ctx = rspamd_upstreams_library_init (resolver->r, ev_base);
- rspamd_upstreams_library_config (cfg, cfg->ups_ctx);
+ rspamd_upstreams_library_config (cfg, cfg->ups_ctx, ev_base, resolver->r);
ls = rspamd_upstreams_create (cfg->ups_ctx);
g_assert (rspamd_upstreams_parse_line (ls, test_upstream_list, 443, NULL));
@@ -170,4 +166,5 @@ rspamd_upstream_test_func (void)
g_assert (rspamd_upstreams_alive (ls) == 3);
rspamd_upstreams_destroy (ls);
+ REF_RELEASE (cfg);
}