File: dnsplatform.t

package info (click to toggle)
spamassassin 4.0.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,732 kB
  • sloc: perl: 89,143; ansic: 5,193; sh: 3,737; javascript: 339; sql: 295; makefile: 209; python: 49
file content (34 lines) | stat: -rw-r--r-- 922 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl -T

use lib '.'; use lib 't';
use SATest; sa_t_init("dnsplatform");

use Test::More;
plan skip_all => "Net tests disabled" unless conf_bool('run_net_tests');
plan tests => 2;

use Net::DNS;
use Net::DNS::Resolver;

my $explanation = '
Problems found with network and DNS setup on this system, not SpamAssassin bug:
';

my $res = Net::DNS::Resolver->new();
my $reply1 = $res->send("txttcp.spamassassin.org", "TXT", "IN");
if ($reply1 && (scalar($reply1->answer) == 17) && ($reply1->size > 1200)) {
  pass('txttcp');
} else {
  diag($explanation);
  diag(($reply1 && $reply1->string) || 'No reply for txttcp TXT');
  fail('txttcp');
}

my $reply2 = $res->send("multihomed.dnsbltest.spamassassin.org", "A", "IN");
if ($reply2 && (scalar($reply2->answer) == 4)) {
  pass('multihomed');
} else {
  diag($explanation);
  diag(($reply2 && $reply2->string) || 'No reply for multihomed A');
  fail('multihomed');
}