diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-11-03 10:23:32 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-11-03 10:23:32 +0000 |
commit | 15dc327ac96fe547b8bcd7676e76a26fe8c9fd33 (patch) | |
tree | 9b7cbff6d46315f18661f830e72bdc9e0ef52376 /test/rspamd_upstream_test.c | |
parent | 7fb60612e19e72a876edc9501a36c8ca3f088e68 (diff) | |
download | rspamd-15dc327ac96fe547b8bcd7676e76a26fe8c9fd33.tar.gz rspamd-15dc327ac96fe547b8bcd7676e76a26fe8c9fd33.zip |
Configure upstreams in workers.
Diffstat (limited to 'test/rspamd_upstream_test.c')
-rw-r--r-- | test/rspamd_upstream_test.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/rspamd_upstream_test.c b/test/rspamd_upstream_test.c index fa81aecd9..16ce27160 100644 --- a/test/rspamd_upstream_test.c +++ b/test/rspamd_upstream_test.c @@ -61,6 +61,7 @@ rspamd_upstream_test_func (void) struct rspamd_config *cfg; gint i, success = 0; const gint assumptions = 100500; + gdouble p; cfg = (struct rspamd_config *)g_malloc (sizeof (struct rspamd_config)); bzero (cfg, sizeof (struct rspamd_config)); @@ -103,12 +104,13 @@ rspamd_upstream_test_func (void) } } + p = 1.0 - fabs (3.0 / 4.0 - (gdouble)success / (gdouble)assumptions); /* * P value is calculated as following: * when we add/remove M upstreams from the list, the probability of hash * miss should be close to the relation N / (N + M), where N is the size of * the previous upstreams list. */ - msg_info ("p value for hash consistency: %.6f", 1.0 - fabs ((3.0 / 4.0 - - (gdouble)success / (gdouble)assumptions))); + msg_info ("p value for hash consistency: %.6f", p); + g_assert (p > 0.9); } |