[publicinbox "test"]
address = test@public-inbox.org
mainrepo = /home/pi/test-main.git
- failrepo = /home/pi/test-fail.git
- description = test box, occasionally reset
+ description = test repo, occasionally reset
+ url = http://example.com/test
[publicinbox "bugs"]
address = bugs@public-inbox.org
mainrepo = /home/pi/bugs-main.git
- failrepo = /home/pi/bugs-fail.git
description = development discussion
+ url = http://example.com/bugs
+ atomUrl = http://example.com/bugs
my %rv = map {
$_ => $self->{"$pfx.$_"}
- } (qw(mainrepo failrepo description address));
+ } (qw(mainrepo description address));
\%rv;
}
my $dst = $config->lookup($recipient);
defined $dst or exit(1);
my $main_repo = $dst->{mainrepo} or exit(1);
-my $fail_repo = $dst->{failrepo} or exit(1);
my $filtered; # string dest
if (PublicInbox->precheck($filter, $recipient) &&
if (do_spamc($simple, \$filtered)) {
$filter->simple(Email::Simple->new($filtered));
$filter->pipe(MDA, $main_repo);
- } else {
- $filter->pipe(MDA, $fail_repo);
}
- } else {
- # PublicInbox::Filter nuked everything, oops :x
- $filter->pipe(MDA, $fail_repo);
}
-} else {
- # if SA thinks it's spam or there's an error:
- # don't bother with our own filtering
- $filter->pipe(MDA, $fail_repo);
}
-die "Email::Filter failed to exit\n";
+exit 0; # goes to failbox
# we depend on "report_safe 0" in /etc/spamassassin/*.cf with --headers
# not using Email::Filter->pipe here since we want the stdout of
my $cfg = PublicInbox::Config->new($f);
is_deeply($cfg->lookup('bugs@public-inbox.org'), {
- 'failrepo' => '/home/pi/bugs-fail.git',
'mainrepo' => '/home/pi/bugs-main.git',
'address' => 'bugs@public-inbox.org',
'description' => 'development discussion'
my $pi_home = "$home/.public-inbox";
my $pi_config = "$pi_home/config";
my $maindir = "$tmpdir/main.git";
-my $faildir = "$tmpdir/fail.git";
my $main_bin = getcwd()."/t/main-bin";
my $main_path = "$main_bin:$ENV{PATH}"; # for spamc ham mock
my $fail_bin = getcwd()."/t/fail-bin";
is(1, mkdir($home, 0755), "setup ~/ for testing");
is(1, mkdir($pi_home, 0755), "setup ~/.public-inbox");
is(0, system(qw(git init -q --bare), $maindir), "git init (main)");
- is(0, system(qw(git init -q --bare), $faildir), "git init (fail)");
my %cfg = (
"$cfgpfx.address" => $addr,
"$cfgpfx.mainrepo" => $maindir,
- "$cfgpfx.failrepo" => $faildir,
);
while (my ($k,$v) = each %cfg) {
is(0, system(qw(git config --file), $pi_config, $k, $v),
# ensure failures work
{
+ ok(!-e $failbox, "nothing in PI_FAILBOX before");
local $ENV{PATH} = $fail_path;
run([$mda], \$in);
- local $ENV{GIT_DIR} = $faildir;
- my $rev = `git rev-list HEAD`;
- like($rev, qr/\A[a-f0-9]{40}/, "bad revision committed");
+ local $ENV{GIT_DIR} = $maindir;
+ my @revs = `git rev-list HEAD`;
+ is(scalar @revs, 1, "bad revision not committed");
+ ok(-s $failbox > 0, "PI_FAILBOX is written to");
}
- ok(!-e $failbox, "nothing in PI_FAILBOX");
}
done_testing();