X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Finit.t;h=6f4c9dceeb33e60afcffe2f7ea242abc306add65;hb=4eee5af6011cc8cdefb66c9729952c7eff5c0b0b;hp=7382e05bc99e2987656f5bd5c831f3e938f938ab;hpb=7e1c18af5468c7708e28de759911ec5542d23c4b;p=public-inbox.git diff --git a/t/init.t b/t/init.t index 7382e05b..6f4c9dce 100644 --- a/t/init.t +++ b/t/init.t @@ -6,7 +6,6 @@ use Test::More; use PublicInbox::Config; use PublicInbox::TestCommon; use PublicInbox::Admin; -use File::Basename; my ($tmpdir, $for_destroy) = tmpdir(); sub quiet_fail { my ($cmd, $msg) = @_; @@ -98,8 +97,17 @@ sub quiet_fail { $cmd = [ '-init', 'deep-non-existent', "$tmpdir/a/b/c/d", qw(http://example.com/abcd abcd@example.com) ]; $err = ''; + my $umask = umask(022) // xbail "umask: $!"; ok(run_script($cmd, $env, $rdr), 'initializes non-existent hierarchy'); + umask($umask) // xbail "umask: $!"; ok(-d "$tmpdir/a/b/c/d", 'directory created'); + my $desc = "$tmpdir/a/b/c/d/description"; + is(PublicInbox::Inbox::try_cat($desc), + "public inbox for abcd\@example.com\n", 'description set'); + my $mode = (stat($desc))[2]; + is(sprintf('0%03o', $mode & 0777), '0644', + 'description respects umask'); + open my $fh, '>', "$tmpdir/d" or BAIL_OUT "open: $!"; close $fh; $cmd = [ '-init', 'd-f-conflict', "$tmpdir/d/f/conflict", @@ -197,7 +205,8 @@ SKIP: { $err = ''; ok(run_script([qw(-mda --no-precheck)], $env, $rdr), 'deliver V1'); diag "err=$err" if $err; - $mm = PublicInbox::Msgmap->new("$tmpdir/skip4"); + $mm = PublicInbox::Msgmap->new_file( + "$tmpdir/skip4/public-inbox/msgmap.sqlite3"); $n = $mm->num_for($mid); is($n, 13, 'V1 NNTP article numbers skipped via --skip-artnum'); }