git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Brian Gernhardt <brian@gernhardtsoftware.com>
Cc: Git List <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] t9501: Skip testing load if we can't detect it
Date: Sat, 06 Feb 2010 03:22:44 -0800 (PST)	[thread overview]
Message-ID: <m3eikya9tn.fsf@localhost.localdomain> (raw)
In-Reply-To: <1265432440-52146-1-git-send-email-brian@gernhardtsoftware.com>

Brian Gernhardt <brian@gernhardtsoftware.com> writes:

> Currently gitweb only knows how to check for load using /proc/loadavg,
> which isn't available on all systems.  We shouldn't fail the test just
> because we don't know how to check the system load.
> 
> Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>

NAK.  It is not necessary, and it would be hindrance (one more place
to update) if we are to extend get_loadavg() in gitweb to work without
/proc/loadavg, e.g. via BSD::loadavg module.


Let me explain how it currently works without /proc/loadavg.  

First, load average is by definition non-negative number (>= 0).

Second, the get_loadavg() subroutine is written to be resilent and
robust, and it returns 0 if it can't get load average from system
(which _currently_ means no well-formatted /proc/loadavg file)

Third, the test (as you can see below in context line in quoted diff
below) forces gitweb to go over maximum load by setting $maxload to 0.
This means that regardless of true load, and regardless whether gitweb
can detect system load (remember that if it cant get system load it
returns 0 instead) gitweb would be in "load too high" situation.

> ---
>  t/t9501-gitweb-standalone-http-status.sh |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/t/t9501-gitweb-standalone-http-status.sh b/t/t9501-gitweb-standalone-http-status.sh
> index 7590f10..992d729 100755
> --- a/t/t9501-gitweb-standalone-http-status.sh
> +++ b/t/t9501-gitweb-standalone-http-status.sh
> @@ -115,12 +115,19 @@ test_debug 'cat gitweb.output'
>  # ----------------------------------------------------------------------
>  # load checking
>  
> +if test -e /proc/loadavg
> +then
> +	test_set_prereq PROC_LOADAVG
> +else
> +	say 'skipping load tests (no /proc/loadavg found)'
> +fi
> +
>  # always hit the load limit
>  cat >>gitweb_config.perl <<\EOF
>  our $maxload = 0;
>  EOF
>  
> -test_expect_success 'load checking: load too high (default action)' '
> +test_expect_success PROC_LOADAVG 'load checking: load too high (default action)' '
>  	gitweb_run "p=.git" &&
>  	grep "Status: 503 Service Unavailable" gitweb.headers &&
>  	grep "503 - The load average on the server is too high" gitweb.body
> -- 
> 1.7.0.rc1.141.gd3fd2
> 

-- 
Jakub Narebski
Poland
ShadeHawk on #git

  reply	other threads:[~2010-02-06 11:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-06  5:00 [PATCH] t9501: Skip testing load if we can't detect it Brian Gernhardt
2010-02-06 11:22 ` Jakub Narebski [this message]
2010-02-06 13:46   ` Brian Gernhardt
2010-02-06 14:05     ` Jakub Narebski
2010-02-06 14:50       ` [PATCH] t9501: Correctly force over max load everywhere Brian Gernhardt
2010-02-06 19:45         ` Jakub Narebski
2010-02-06 18:31       ` [PATCH] t9501: Skip testing load if we can't detect it Junio C Hamano
2010-02-06 20:09         ` Brian Gernhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3eikya9tn.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=brian@gernhardtsoftware.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).