X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fhttpd.t;fp=t%2Fhttpd.t;h=0354a733f441f73e8c26effcb620707a13672ac5;hb=8954ae12611d407346a9b67e822309a7e48b943e;hp=af9fbfeb2bd317596c08314083e34a0f79ae4444;hpb=bf0ad6fcc0c14c32d278f4a1564eebdff6cc3bf8;p=public-inbox.git
diff --git a/t/httpd.t b/t/httpd.t
index af9fbfeb..0354a733 100644
--- a/t/httpd.t
+++ b/t/httpd.t
@@ -1,8 +1,8 @@
+#!perl -w
# Copyright (C) 2016-2021 all contributors
# License: AGPL-3.0+
use strict;
-use warnings;
-use Test::More;
+use v5.10.1;
use PublicInbox::TestCommon;
use PublicInbox::Eml;
use Socket qw(IPPROTO_TCP SOL_SOCKET);
@@ -13,22 +13,15 @@ my ($tmpdir, $for_destroy) = tmpdir();
my $home = "$tmpdir/pi-home";
my $err = "$tmpdir/stderr.log";
my $out = "$tmpdir/stdout.log";
-my $maindir = "$tmpdir/main.git";
+my $inboxdir = "$tmpdir/i.git";
my $group = 'test-httpd';
my $addr = $group . '@example.com';
-my $cfgpfx = "publicinbox.$group";
my $sock = tcp_server();
my $td;
-use_ok 'PublicInbox::Git';
-use_ok 'PublicInbox::Import';
{
- local $ENV{HOME} = $home;
- my $cmd = [ '-init', $group, $maindir, 'http://example.com/', $addr ];
- ok(run_script($cmd), 'init ran properly');
-
- # ensure successful message delivery
- {
- my $mime = PublicInbox::Eml->new(< $inboxdir, sub {
+ my ($im, $ibx) = @_;
+ $im->add(PublicInbox::Eml->new(<
To: You
Cc: $addr
@@ -38,12 +31,10 @@ Date: Thu, 01 Jan 1970 06:06:06 +0000
nntp
EOF
-
- my $git = PublicInbox::Git->new($maindir);
- my $im = PublicInbox::Import->new($git, 'test', $addr);
- $im->add($mime);
- $im->done($mime);
- }
+ };
+ local $ENV{HOME} = $home;
+ my $cmd = [ '-init', $group, $inboxdir, 'http://example.com/', $addr ];
+ ok(run_script($cmd), 'init ran properly');
$cmd = [ '-httpd', '-W0', "--stdout=$out", "--stderr=$err" ];
$td = start_script($cmd, undef, { 3 => $sock });
my $http_pfx = 'http://'.tcp_host_port($sock);
@@ -53,7 +44,6 @@ EOF
like(<$bad>, qr!\AHTTP/1\.[01] 405\b!, 'got 405 on bad req');
}
my $conn = tcp_connect($sock);
- ok($conn, 'connected');
ok($conn->write("GET / HTTP/1.0\r\n\r\n"), 'wrote data to socket');
{
my $buf;
@@ -67,7 +57,7 @@ EOF
0, 'smart clone successful');
# ensure dumb cloning works, too:
- is(xsys('git', "--git-dir=$maindir",
+ is(xsys('git', "--git-dir=$inboxdir",
qw(config http.uploadpack false)),
0, 'disable http.uploadpack');
is(xsys(qw(git clone -q --mirror),
@@ -99,6 +89,4 @@ SKIP: {
like($x, qr/\Ahttpready\0+\z/, 'got httpready accf for HTTP');
};
-done_testing();
-
-1;
+done_testing;