3 use Test::More tests => 8;
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.
27 my %config = create_debbugs_configuration();
30 my $sendmail_dir = $config{sendmail_dir};
31 my $spool_dir = $config{spool_dir};
32 my $config_dir = $config{config_dir};
36 # We're going to use create mime message to create these messages, and
37 # then just send them to receive.
39 send_message(to=>'submit@bugs.something',
40 headers => [To => 'submit@bugs.something',
41 From => 'foo@bugs.something',
42 Subject => 'Submiting a bug',
44 body => <<EOF) or fail('Unable to send message');
51 my $SD_SIZE = dirsize($sendmail_dir);
52 send_message(to => 'control@bugs.something',
53 headers => [To => 'control@bugs.something',
54 From => 'foo@bugs.something',
55 Subject => "Munging a bug with limit_package_bar",
57 body => <<EOF) or fail 'message to control@bugs.something failed';
65 num_messages_sent($SD_SIZE,1,
67 'control@bugs.something messages appear to have been sent out properly');
69 # make sure this fails
70 ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed (with 1 error): Munging a bug with limit_package_bar")) == 0,
71 'control@bugs.something'. "limit message failed with 1 error");
73 send_message(to => 'control@bugs.something',
74 headers => [To => 'control@bugs.something',
75 From => 'foo@bugs.something',
76 Subject => "Munging a bug with limit_package_foo",
78 body => <<EOF) or fail 'message to control@bugs.something failed';
86 num_messages_sent($SD_SIZE,1,
88 'control@bugs.something messages appear to have been sent out properly');
90 # make sure this fails
91 ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed: Munging a bug with limit_package_foo")) == 0,
92 'control@bugs.something'. "limit message succeeded with no errors");
94 send_message(to=>'submit@bugs.something',
95 headers => [To => 'submit@bugs.something',
96 From => 'foo@bugs.something',
97 Subject => 'Submiting a bug',
99 body => <<EOF) or fail('Unable to send message');
105 $SD_SIZE = dirsize($sendmail_dir);
108 send_message(to => 'control@bugs.something',
109 headers => [To => 'control@bugs.something',
110 From => 'foo@bugs.something',
111 Subject => "Munging a bug with limit_package_bar",
113 body => <<EOF) or fail 'message to control@bugs.something failed';
121 num_messages_sent($SD_SIZE,1,
123 'control@bugs.something messages appear to have been sent out properly');
125 # make sure this fails
126 ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed (with 1 error): Munging a bug with limit_package_bar")) == 0,
127 'control@bugs.something'. "limit message failed with 1 error");
129 send_message(to => 'control@bugs.something',
130 headers => [To => 'control@bugs.something',
131 From => 'foo@bugs.something',
132 Subject => "Munging a bug with limit_package_foo",
134 body => <<EOF) or fail 'message to control@bugs.something failed';
142 num_messages_sent($SD_SIZE,1,
144 'control@bugs.something messages appear to have been sent out properly');
146 # make sure this fails
147 ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed: Munging a bug with limit_package_foo")) == 0,
148 'control@bugs.something'. "limit message succeeded with no errors");