summaryrefslogtreecommitdiffstats
path: root/test/rspamd_upstream_test.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-20 16:33:34 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-20 16:33:34 +0000
commitc3896936f524bd19d732b5034c87058260bd04e6 (patch)
tree1518d2aef66c4ffe6e171b596d15e9c94d2194d0 /test/rspamd_upstream_test.c
parent13cb93001a2cb7dbf7db85b25ac22558da4f610b (diff)
downloadrspamd-c3896936f524bd19d732b5034c87058260bd04e6.tar.gz
rspamd-c3896936f524bd19d732b5034c87058260bd04e6.zip
Fix tests
Diffstat (limited to 'test/rspamd_upstream_test.c')
-rw-r--r--test/rspamd_upstream_test.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/test/rspamd_upstream_test.c b/test/rspamd_upstream_test.c
index 528b0a9dc..0cf163322 100644
--- a/test/rspamd_upstream_test.c
+++ b/test/rspamd_upstream_test.c
@@ -85,10 +85,10 @@ rspamd_upstream_test_func (void)
resolver = dns_resolver_init (NULL, ev_base, cfg);
- rspamd_upstreams_library_init (resolver->r, ev_base);
- rspamd_upstreams_library_config (cfg);
+ cfg->ups_ctx = rspamd_upstreams_library_init (resolver->r, ev_base);
+ rspamd_upstreams_library_config (cfg, cfg->ups_ctx);
- ls = rspamd_upstreams_create ();
+ ls = rspamd_upstreams_create (cfg->ups_ctx);
g_assert (rspamd_upstreams_parse_line (ls, test_upstream_list, 443, NULL));
g_assert (rspamd_upstreams_count (ls) == 3);
@@ -105,7 +105,7 @@ rspamd_upstream_test_func (void)
rspamd_upstream_test_method (ls, RSPAMD_UPSTREAM_ROUND_ROBIN, "microsoft.com");
/* Test stable hashing */
- nls = rspamd_upstreams_create ();
+ nls = rspamd_upstreams_create (cfg->ups_ctx);
g_assert (rspamd_upstreams_parse_line (nls, test_upstream_list, 443, NULL));
g_assert (rspamd_upstreams_parse_line (nls, new_upstream_list, 443, NULL));
for (i = 0; i < assumptions; i ++) {
@@ -135,7 +135,7 @@ rspamd_upstream_test_func (void)
/*
* Test v4/v6 priorities
*/
- nls = rspamd_upstreams_create ();
+ nls = rspamd_upstreams_create (cfg->ups_ctx);
g_assert (rspamd_upstreams_add_upstream (nls, "127.0.0.1", 0, NULL));
up = rspamd_upstream_get (nls, RSPAMD_UPSTREAM_RANDOM);
rspamd_parse_inet_address (&paddr, "127.0.0.2", 0);
@@ -169,6 +169,5 @@ rspamd_upstream_test_func (void)
event_base_loop (ev_base, 0);
g_assert (rspamd_upstreams_alive (ls) == 3);
- g_free (cfg);
rspamd_upstreams_destroy (ls);
}