File: proxyconfigmulti.t

package info (click to toggle)
memcached 1.6.40-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,192 kB
  • sloc: ansic: 61,138; perl: 12,616; sh: 4,569; makefile: 471; python: 402; xml: 59
file content (34 lines) | stat: -rw-r--r-- 730 bytes parent folder | download | duplicates (2)
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
27
28
29
30
31
32
33
34
#!/usr/bin/env perl

use strict;
use warnings;
use Test::More;
use FindBin qw($Bin);
use lib "$Bin/lib";
use Carp qw(croak);
use MemcachedTest;
use IO::Socket qw(AF_INET SOCK_STREAM);
use IO::Select;

if (!supports_proxy()) {
    plan skip_all => 'proxy not enabled';
    exit 0;
}

# Set up the listeners _before_ starting the proxy.
# the fourth listener is only occasionally used.
my $t = Memcached::ProxyTest->new(servers => [12111]);

my $p_srv = new_memcached('-o proxy_config=./t/proxyconfigmulti1.lua:./t/proxyconfigmulti2.lua -t 1');
my $ps = $p_srv->sock;
$ps->autoflush(1);

$t->set_c($ps);
$t->accept_backends();

$t->c_send("mg foo\r\n");
$t->be_recv_c(0);
$t->be_send(0, "HD\r\n");
$t->c_recv_be();

done_testing();