You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2022/05/08 12:17:21 UTC

svn commit: r1900688 - in /spamassassin/trunk/t: dnsbl.t uribl.t

Author: hege
Date: Sun May  8 12:17:21 2022
New Revision: 1900688

URL: http://svn.apache.org/viewvc?rev=1900688&view=rev
Log:
Improve tests

Modified:
    spamassassin/trunk/t/dnsbl.t
    spamassassin/trunk/t/uribl.t

Modified: spamassassin/trunk/t/dnsbl.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/dnsbl.t?rev=1900688&r1=1900687&r2=1900688&view=diff
==============================================================================
--- spamassassin/trunk/t/dnsbl.t (original)
+++ spamassassin/trunk/t/dnsbl.t Sun May  8 12:17:21 2022
@@ -6,7 +6,7 @@ use SATest; sa_t_init("dnsbl");
 use Test::More;
 plan skip_all => "Net tests disabled" unless conf_bool('run_net_tests');
 plan skip_all => "Can't use Net::DNS Safely" unless can_use_net_dns_safely();
-plan tests => 18;
+plan tests => 21;
 
 # ---------------------------------------------------------------------------
 # bind configuration currently used to support this test
@@ -47,27 +47,30 @@ EOF
 # hits we expect and some hits we don't expect
 
 %patterns = (
- q{ <dns:98.3.137.144.dnsbltest.spamassassin.org> [127.0.0.2] } => 'P_1',
- q{ <dns:134.88.73.210.dnsbltest.spamassassin.org> [127.0.0.4] } => 'P_2',
- q{ <dns:18.13.119.61.dnsbltest.spamassassin.org> [127.0.0.12] } => 'P_3',
- q{ <dns:14.35.17.212.dnsbltest.spamassassin.org> [127.0.0.1] } => 'P_4',
- q{ <dns:226.149.120.193.dnsbltest.spamassassin.org> [127.0.0.1] } => 'P_5',
- q{ <dns:example.com.dnsbltest.spamassassin.org> [127.0.0.2] } => 'P_6',
- q{,DNSBL_TEST_TOP,} => 'P_8',
- q{,DNSBL_TEST_WHITELIST,} => 'P_9',
- q{,DNSBL_TEST_DYNAMIC,} => 'P_10',
- q{,DNSBL_TEST_SPAM,} => 'P_11',
- q{,DNSBL_TEST_RELAY,} => 'P_12',
- q{,DNSBL_TXT_TOP,} => 'P_13',
- q{,DNSBL_TXT_RE,} => 'P_14',
- q{,DNSBL_RHS,} => 'P_15',
+ q{'<dns:98.3.137.144.dnsbltest.spamassassin.org> [127.0.0.2]'} => '',
+ q{'<dns:134.88.73.210.dnsbltest.spamassassin.org> [127.0.0.4]'} => '',
+ q{'<dns:18.13.119.61.dnsbltest.spamassassin.org> [127.0.0.12]'} => '',
+ q{'<dns:14.35.17.212.dnsbltest.spamassassin.org> [127.0.0.1]'} => '',
+ q{'<dns:226.149.120.193.dnsbltest.spamassassin.org> [127.0.0.1]'} => '',
+ q{'<dns:example.com.dnsbltest.spamassassin.org> [127.0.0.2]'} => '',
+ q{'1.0 DNSBL_TEST_TOP'} => '',
+ q{'1.0 DNSBL_TEST_WHITELIST'} => '',
+ q{'1.0 DNSBL_TEST_DYNAMIC'} => '',
+ q{'1.0 DNSBL_TEST_SPAM'} => '',
+ q{'1.0 DNSBL_TEST_RELAY'} => '',
+ q{'1.0 DNSBL_TXT_TOP'} => '',
+ q{'1.0 DNSBL_TXT_RE'} => '',
+ q{'1.0 DNSBL_RHS'} => '',
+ q{'1.0 META_DNSBL_A'} => '',
+ q{'1.0 META_DNSBL_B'} => '',
+ q{'1.0 META_DNSBL_C'} => '',
 );
 
 %anti_patterns = (
- q{,DNSBL_TEST_MISS,} => 'P_19',
- q{,DNSBL_TXT_MISS,} => 'P_20',
- q{,DNSBL_TEST_WHITELIST_MISS,} => 'P_21',
- q{ launching DNS A query for 14.35.17.212.untrusted.dnsbltest.spamassassin.org. } => 'untrusted',
+ q{'1.0 DNSBL_TEST_MISS'} => '',
+ q{'1.0 DNSBL_TXT_MISS'} => '',
+ q{'1.0 DNSBL_TEST_WHITELIST_MISS'} => '',
+ q{'14.35.17.212.untrusted.dnsbltest.spamassassin.org'} => '',
 );
 
 tstprefs("
@@ -85,9 +88,6 @@ clear_trusted_networks
 trusted_networks 10.
 trusted_networks 150.51.53.1
 
-# make ,DNSBL, pattern matches work (never allow it first in the tests= list)
-meta AAA 1
-
 header DNSBL_TEST_TOP	eval:check_rbl('test', 'dnsbltest.spamassassin.org.')
 describe DNSBL_TEST_TOP	DNSBL A record match
 tflags DNSBL_TEST_TOP	net
@@ -136,9 +136,18 @@ header DNSBL_RHS	eval:check_rbl_from_hos
 describe DNSBL_RHS	DNSBL RHS match
 tflags DNSBL_RHS	net
 
+# Bug 7897 - test that meta rules depending on net rules hit
+meta META_DNSBL_A DNSBL_TEST_DYNAMIC
+# It also needs to hit even if priority is lower than dnsbl (-100)
+meta META_DNSBL_B DNSBL_TEST_SPAM
+priority META_DNSBL_B -500
+# Or super high
+meta META_DNSBL_C DNSBL_TEST_RELAY
+priority META_DNSBL_C 2000
+priority DNSBL_TEST_RELAY 2000
+
 ");
 
-# The -D clobbers test performance but some patterns & antipatterns depend on debug output
-sarun ("-D -t < data/spam/dnsbl.eml 2>&1", \&patterns_run_cb);
+sarun ("-t < data/spam/dnsbl.eml", \&patterns_run_cb);
 ok_all_patterns();
 

Modified: spamassassin/trunk/t/uribl.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/uribl.t?rev=1900688&r1=1900687&r2=1900688&view=diff
==============================================================================
--- spamassassin/trunk/t/uribl.t (original)
+++ spamassassin/trunk/t/uribl.t Sun May  8 12:17:21 2022
@@ -6,21 +6,23 @@ use SATest; sa_t_init("uribl");
 use Test::More;
 plan skip_all => "Net tests disabled"          unless conf_bool('run_net_tests');
 plan skip_all => "Can't use Net::DNS Safely"   unless can_use_net_dns_safely();
-plan tests => 8;
+plan tests => 10;
 
 # ---------------------------------------------------------------------------
 
 %patterns = (
- q{ X_URIBL_A } => 'A',
- q{ X_URIBL_B } => 'B',
- q{ X_URIBL_NS } => 'NS',
- q{ X_URIBL_DOMSONLY } => 'X_URIBL_DOMSONLY',
- q{ META_URIBL_A } => 'META_URIBL_A',
- q{ X_URIBL_NOTRIM } => 'X_URIBL_NOTRIM',
+ q{ 1.0 X_URIBL_A } => '',
+ q{ 1.0 X_URIBL_B } => '',
+ q{ 1.0 X_URIBL_NS } => '',
+ q{ 1.0 X_URIBL_DOMSONLY } => '',
+ q{ 1.0 META_URIBL_A } => '',
+ q{ 1.0 META_URIBL_B } => '',
+ q{ 1.0 META_URIBL_NS } => '',
+ q{ 1.0 X_URIBL_NOTRIM } => '',
 );
 
 %anti_patterns = (
- q{ X_URIBL_FULL_NS } => 'FULL_NS',
+ q{ 1.0 X_URIBL_FULL_NS } => '',
 );
 
 tstlocalrules(q{
@@ -51,6 +53,13 @@ tstlocalrules(q{
 
   # Bug 7897 - test that meta rules depending on net rules hit
   meta META_URIBL_A X_URIBL_A
+  # It also needs to hit even if priority is lower than dnsbl (-100)
+  meta META_URIBL_B X_URIBL_B
+  priority META_URIBL_B -500
+  # Or super high
+  meta META_URIBL_NS X_URIBL_NS
+  priority META_URIBL_NS 2000
+  priority X_URIBL_NS 2000
 
   # Bug 7835 - tflags notrim
   urirhssub  X_URIBL_NOTRIM  dnsbltest.spamassassin.org.    A 16
@@ -59,7 +68,6 @@ tstlocalrules(q{
 
 });
 
-# note: don't leave -D here, it causes spurious passes
-ok sarun ("-t < data/spam/dnsbl.eml 2>&1", \&patterns_run_cb);
+ok sarun ("-t < data/spam/dnsbl.eml", \&patterns_run_cb);
 ok_all_patterns();