3 use Test::More tests => 4;
8 # Here, we're going to shoot messages through a set of things that can
11 # First, we're going to send mesages to receive.
12 # To do so, we'll first send a message to submit,
13 # then send messages to the newly created bugnumber.
16 use File::Temp qw(tempdir);
18 use Debbugs::MIME qw(create_mime_message);
19 use File::Basename qw(dirname basename);
20 # The test functions are placed here to make things easier
22 use DebbugsTest qw(:all);
25 # HTTP::Server:::Simple defines a SIG{CHLD} handler that breaks system; undef it here.
29 %config = create_debbugs_configuration(debug => exists $ENV{DEBUG}?$ENV{DEBUG}:0);
35 my $sendmail_dir = $config{sendmail_dir};
36 my $spool_dir = $config{spool_dir};
37 my $config_dir = $config{config_dir};
41 diag("spool_dir: $spool_dir\n");
42 diag("config_dir: $config_dir\n");
43 diag("sendmail_dir: $sendmail_dir\n");
47 # We're going to use create mime message to create these messages, and
48 # then just send them to receive.
50 send_message(to=>'submit@bugs.something',
51 headers => [To => 'submit@bugs.something',
52 From => 'foo@bugs.something',
53 Subject => 'Submiting a bug',
55 body => <<EOF) or fail('Unable to send message');
62 my $SD_SIZE = dirsize($sendmail_dir);
63 send_message(to => 'control@bugs.something',
64 headers => [To => 'control@bugs.something',
65 From => 'foo@bugs.something',
66 Subject => "Munging a bug with limit_package_bar",
68 body => <<EOF) or fail 'message to control@bugs.something failed';
76 num_messages_sent($SD_SIZE,1,
78 'control@bugs.something messages appear to have been sent out properly');
80 # make sure this fails
81 ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed (with 1 errors): Munging a bug with limit_package_bar")) == 0,
82 'control@bugs.something'. "limit message failed with 1 error");
84 send_message(to => 'control@bugs.something',
85 headers => [To => 'control@bugs.something',
86 From => 'foo@bugs.something',
87 Subject => "Munging a bug with limit_package_foo",
89 body => <<EOF) or fail 'message to control@bugs.something failed';
97 num_messages_sent($SD_SIZE,1,
99 'control@bugs.something messages appear to have been sent out properly');
101 # make sure this fails
102 ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed: Munging a bug with limit_package_foo")) == 0,
103 'control@bugs.something'. "limit message succeeded with no errors");