Bug 10572: Add phone to message_transport_types table for new installs
[koha.git] / misc / load_testing / benchmark_staff.pl
index ba659c9..786b04a 100644 (file)
@@ -18,6 +18,7 @@ use Data::Dumper;
 use HTTP::Cookies;
 use C4::Context;
 use C4::Debug;
+use URI::Escape;
 
 my ($help, $steps, $baseurl, $max_tries, $user, $password,$short_print);
 GetOptions(
@@ -75,13 +76,17 @@ my $cookie_jar = HTTP::Cookies->new();
 my $cookie;
 $ua->cookie_jar($cookie_jar);
 my $resp = $ua->post( "$baseurl"."/svc/authentication" , {userid =>$user, password => $password} );
-if( $resp->is_success ) {
+if( $resp->is_success and $resp->content =~ m|<status>ok</status>| ) {
     $cookie_jar->extract_cookies( $resp );
     $cookie = $cookie_jar->as_string;
     unless ($short_print) {
         print "Authentication successful\n";
         print "Auth:\n $resp->content" if $debug;
     }
+} elsif ( $resp->is_success ) {
+    die "Authentication failure: bad login/password";
+} else {
+    die "Authentication failure: \n\t" . $resp->status_line;
 }
 
 # remove some unnecessary garbage from the cookie
@@ -241,7 +246,7 @@ if ($steps=~ /4/) {
     my $b2 = HTTPD::Bench::ApacheBench->new;
     $b2->concurrency( $concurrency );
     unless ($short_print) {
-        print "Step 5: patron detail page         ";
+        print "Step 4: patron detail page         ";
     }
     my $run2 = HTTPD::Bench::ApacheBench::Run->new
         ({ urls => \@borrowers,
@@ -324,7 +329,7 @@ if ($steps=~ /6/) {
         until ($rand_barcode) {
             my $rand_itemnumber = int(rand($itemnumber_max)+1);
             $sth->execute($rand_itemnumber);
-            ($rand_barcode) = $sth->fetchrow();
+            ($rand_barcode) = uri_escape_utf8($sth->fetchrow());
         }
         push @issues,"$baseurl/circ/circulation.pl?borrowernumber=$rand_borrowernumber&barcode=$rand_barcode&issueconfirmed=1";
         push @returns,"$baseurl/circ/returns.pl?barcode=$rand_barcode";