shlist

share and manage lists between multiple people
Log | Files | Refs

commit 055ddb4a3be5a4f903abdbfb99ece1205f4c8127
parent b8fd456ba81d16333fff6c8b23e38584c9edeeae
Author: Kyle Milz <kyle@0x30.net>
Date:   Sat, 27 Feb 2016 13:46:05 -0700

server: recommission respose_too_large test

Diffstat:
Mserver/t/large_response.t | 14++++----------
Aserver/t/response_too_large.t | 15+++++++++++++++
Dserver/t/response_too_large.t_ | 13-------------
3 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/server/t/large_response.t b/server/t/large_response.t @@ -1,27 +1,21 @@ use strict; use Test; -BEGIN { plan tests => 14 } +BEGIN { plan tests => 44 } use SL; -# XXX: Test is broken -# - for some reason sending more than 5 list_add's in a row screws something up -# - lists_get() also seems to choke sometimes -# - causes unknown - # Test that large responses > 16384 bytes work as the underlying ssl layer can # only handle that much data at a time my $s = SL::Server->new(); - my $A = SL::Client->new(); -$A->list_add({ name => "$_" x 1000, date => 0}) for (1..5); -# The response to this lists_get request clocks in at ~24 KB +$A->list_add({ name => "$_" x 1000, date => 0}) for (1..20); + my $count = 0; for my $list (@{ $A->lists_get() }) { $count += 1; ok("$count" x 1000, $list->{name}); } -ok($count, 5); +ok($count, 20); diff --git a/server/t/response_too_large.t b/server/t/response_too_large.t @@ -0,0 +1,15 @@ +use strict; +use SL; +use Test; + +BEGIN { plan tests => 24 } + +# Test that a message greater than 65KB doesn't get sent +my $s = SL::Server->new(); +my $A = SL::Client->new(); + +$A->list_add({ name => 'a' x 4000, date => 0 }) for (1..20); + +# This request should be 20 * 4000 Bytes = ~80KB +my $err = $A->lists_get('err'); +ok($err, 'response too large'); diff --git a/server/t/response_too_large.t_ b/server/t/response_too_large.t_ @@ -1,13 +0,0 @@ -#!/usr/bin/perl -I../ -use strict; -use warnings; -use client; -use test; - -# Test that a message greater than 65KB doesn't get sent - -my $A = client->new(); -$A->list_add({ name => $_, date => 0 }) for (1..600); - -my $err = $A->lists_get('err'); -fail_msg_ne 'response too large', $err;