From 41cba57f255600b74a27ec6d56e7d25ae7606abf Mon Sep 17 00:00:00 2001 From: "Anders S. Mortensen" Date: Tue, 2 Jan 2007 14:11:02 +0000 Subject: [PATCH] Making test more realistic. --- test/stress-test | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/stress-test b/test/stress-test index 59ffd38..04b2bc9 100755 --- a/test/stress-test +++ b/test/stress-test @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -# $Id: stress-test,v 1.1 2007-01-02 13:30:52 sondberg Exp $ +# $Id: stress-test,v 1.2 2007-01-02 14:11:02 sondberg Exp $ # ------------------------------------------------- # Simulate a search/retrieve session @@ -12,7 +12,7 @@ my $url = 'http://test.indexdata.dk:8001/~sondberg/pazpar2/www/search.pz2'; my $parser = new XML::LibXML; my $ua = new LWP::UserAgent; my $session_id = get_session($ua); -my $debug = 1; +my $debug = 0; my @terms = qw(water mineral computer java texas energy xml pirsig clinton management environment dinosaur houston washington); @@ -25,11 +25,13 @@ while (1) { if (start_search($session_id, $ua, $term)) { print STDERR "Success...\n"; - foreach (1..10) { - sleep(1); - - if (fetch_records($session_id, $ua)) { - print STDERR "Fetched...\n"; + foreach my $p (0..4) { + foreach (1..10) { + sleep(1); + + if (fetch_records($session_id, $ua, $p * 20)) { + print STDERR "Fetched...\n"; + } } } } @@ -53,8 +55,8 @@ sub check_status { sub fetch_records { - my ($sid, $ua) = @_; - my $uri = $url . '?session=' . $sid . '&command=show'; + my ($sid, $ua, $offset) = @_; + my $uri = $url . '?session=' . $sid . '&command=show&start=' . $offset; my $response = $ua->get($uri); if ($response->is_success) { -- 1.7.10.4