File: 02-multiport.t

package info (click to toggle)
libnet-server-ss-prefork-perl 0.05-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 212 kB
  • sloc: perl: 2,094; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 596 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use strict;
use warnings;

use LWP::Simple;
use Test::TCP;
use Test::More skip_all => 'Network test';

use Server::Starter qw(start_server);

my $another_port = empty_port(20000);

test_tcp(
    server => sub {
        my $port = shift;
        start_server(
            port => [ $port, $another_port ],
            exec => [ $^X, qw(t/01-httpd.pl) ],
        );
    },
    client => sub {
        my $port = shift;
        sleep 1;
        like get("http://127.0.0.1:$port/"), qr/^\d+$/, 'check port 1';
        like get("http://127.0.0.1:$another_port/"), qr/^\d+$/, 'check port 2';
    },
);