X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fconfig.t;h=d08c3b9c03454bf6251ecab45083a3c4722842df;hb=95bdac7f09c69036efed537a4d03d5bdd2ae4eb6;hp=3b4b12b32c20715ccfa60c6a665b43da9036212a;hpb=356e1db5135802ed468719dfcd1f1c3f9dba9fff;p=public-inbox.git diff --git a/t/config.t b/t/config.t index 3b4b12b3..d08c3b9c 100644 --- a/t/config.t +++ b/t/config.t @@ -1,11 +1,11 @@ -# Copyright (C) 2014-2019 all contributors +# Copyright (C) 2014-2020 all contributors # License: AGPL-3.0+ use strict; use warnings; use Test::More; use PublicInbox::Config; -use File::Temp qw/tempdir/; -my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1); +use PublicInbox::TestCommon; +my ($tmpdir, $for_destroy) = tmpdir(); { is(system(qw(git init -q --bare), $tmpdir), 0, "git init successful"); @@ -24,10 +24,10 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $cfg = PublicInbox::Config->new($f); is_deeply($cfg->lookup('meta@public-inbox.org'), { - 'mainrepo' => '/home/pi/meta-main.git', + 'inboxdir' => '/home/pi/meta-main.git', 'address' => [ 'meta@public-inbox.org' ], 'domain' => 'public-inbox.org', - 'url' => 'http://example.com/meta', + 'url' => [ 'http://example.com/meta' ], -primary_address => 'meta@public-inbox.org', 'name' => 'meta', feedmax => 25, @@ -44,11 +44,11 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1); 'sandbox@public-inbox.org', 'test@public-inbox.org'], -primary_address => 'try@public-inbox.org', - 'mainrepo' => '/home/pi/test-main.git', + 'inboxdir' => '/home/pi/test-main.git', 'domain' => 'public-inbox.org', 'name' => 'test', feedmax => 25, - 'url' => 'http://example.com/test', + 'url' => [ 'http://example.com/test' ], -httpbackend_limiter => undef, nntpserver => undef, }, "lookup matches expected output for test"); @@ -66,13 +66,29 @@ $cfgpfx.altid=serial:enamg:file=b EOF my $ibx = $config->lookup_name('test'); is_deeply($ibx->{altid}, [ @altid ]); + + $config = PublicInbox::Config->new(\<lookup_name('test'); + is($ibx->{inboxdir}, '/path/to/non/existent', 'mainrepo still works'); + + $config = PublicInbox::Config->new(\<lookup_name('test'); + is($ibx->{inboxdir}, '/path/to/non/existent', + 'inboxdir takes precedence'); } { my $pfx = "publicinbox.test"; my $str = <new(\$str); @@ -81,7 +97,7 @@ EOF $str = <new(\$str); @@ -95,9 +111,9 @@ EOF my $pfx2 = "publicinbox.foo"; my $str = <