\section{Introduction}
-This document explains how to test the \LB service. Tests are described at six
-different layers, from elementary tests if the service is up and running,
-through tests of the fully supported functionality, performance and stress
-tests to interoperability tests.
+This document explains how to test the Logging and Bookkeeping (\LB) service.
\TODO{add some more introduction}
\subsection{Tests in \texttt{org.glite.testsuites.ctb/LB}}
-\TODO{implementation}
+\TODO{implementation}
+
+EGEE Certification team collects tests for \LB in a gLite module
+\verb'org.glite.testsuites.ctb' in the \verb'LB' directory. All \LB tests are
+described at
+\url{https://twiki.cern.ch/twiki/bin/view/LCG/SAMTests#Logging_and_Bookkeeping_LB}
+as well as next to each test case in Sections \ref{s:tests} and \ref{s:perftests}.
+
+The tests can be used as sensors in different monitoring frameworks
+(see also below).
+
+
\subsection{Integration into other frameworks}
-\TODO{SAM, Nagios, ETICS, ...}
+
+\subsubsection{Service Availability Monitoring}
+
+Service Availability Monitoring
+(SAM)\footnote{\url{http://sam-docs.web.cern.ch/sam-docs}} is a framework for
+the monitoring of production and pre-production grid sites. It provides a set
+of probes which are submitted at regular intervals, and a database that stores
+test results. In effect, SAM provides monitoring of grid services from a user
+perspective.
+
+\TODO{More about SAM. How LB is integrated - LB sensors for SAM}
+
+
+\subsubsection{Nagios}
+
+Nagios\footnote{\url{http://www.nagios.org}} is a host and service monitor
+designed to inform you of network problems before your clients, end-users or
+managers do.
+
+\TODO{More about Nagios. How LB is integrated - LB sensors for Nagios?}
+
+
+\subsubsection{ETICS}
+
+ETICS\footnote{\url{http://etics.web.cern.ch/etics/}} stands for
+"eInfrastructure for Testing, Integration and Configuration of Software". It
+provides a service to help software developers, managers and users to better
+manage complexity and improve the quality of their software. Using cutting
+edge Grid software and best practices, ETICS allows to fully automate
+the way your software is built and tested.
+
+Please see the ETICS User Manual \cite{etics_manual} for the description
+of the ETICS service and basic ETICS commands. The command to be issued to
+test the whole \LB subsystem is:
+
+\begin{verbatim}
+ etics-test org.glite.lb
+\end{verbatim}
+
+It can be issued locally or using the remote build and test system.
+\TODO{More about ETICS testing}
+
+General ideas of \LB tests using ETICS are the following
+
+\begin{itemize}
+\item tests are in CVS together with the code
+
+\item tests run the service themselves on some nondefault ports and perform a set of
+elementary actions similar to those from org.glite.testsuites.ctb/LB
+to test the basic functionality of the service which is stopped again at the
+end of the test
+
+\end{itemize}
+\TODO{More about LB tests for individual modules?}
\section{Test Cases}
+\label{s:tests}
In this section we describe tests from layers 1 (service ping tests),
2 (service functionality tests) and 3 (system tests).
\subsection{Tests if services are up and running}
\TODO{how?}
+\begin{verbatim}
+org.glite.testsuites.ctb/LB/lb-l1.sh now does the following:
+- ping_host
+- check_binaries
+- check_service: runs testSocket (non GSI) on default ports for LL, IL and server
+
+What needs to be done:
+- how test scripts should be told to test such a service on such a (nondefualt) port?
+- test GSI credentials
+- do a GSI testSocket? hand-shake?
+- maybe call a logevent with INTERNAL msg type?
+- move all common parts to functions.sh and write individual test scripts for each daemon:
+\end{verbatim}
+
\subsubsection{Local-logger}
+\TODO{ping, check binaries, check if enough disk capacity is free for dglog* files,
+check GSI credentials, gsi-connect?, log an internal msg?, ...}
+
\subsubsection{Inter-logger}
+\TODO{ping, check binaries, check if enough disk capacity is free for dglog* files, socket-connect?,
+check GSI credentials, fake an internal msg to the dglog* direcotry?, ...}
+
\subsubsection{Server}
+\TODO{ping, check binaries, check MySQL (running, accessible, enough disk capacity, ...),
+check GSI credentials, gsi-connect?, socket-connect?, log an internal msg?,
+WS getVersion?, HTTP-connect?, check if enough disk capacity is free for dumps?, ...}
+
\subsubsection{Notification inter-logger}
+\TODO{ping, check binaries, check GSI credentials, gsi-connect?, send some fake notification?, ...}
\subsection{Event delivery}
+\begin{verbatim}
+org.glite.testsuites.ctb/LB/lb-l2.sh now does the following:
+- array_job_reg: registeres $JOBS_ARRAY_SIZE jobs
+- logEvents: logs events by glite-lb-$state.sh example scripts
+- logTags: logs user tags
+- testLB: calls glite-lb-job_log for all jobs
+- testLB2: calls glite-lb-job_status for all jobs
+
+What needs to be done:
+- tidy
+- create some meaningful sequence of events for logEvents
+\end{verbatim}
+
+
+
% locallogger
% bez dalsich demonu, registrovat job, vrati EAGAIN, objevi se fajly
\subsubsection{Standalone locallogger -- job registration}
\subsubsection{Interlogger recovery}
\label{recover}
+\TODO{See also org.glite.testsuites.ctb/LB/lb-l2ILR.sh.}
% recover interloggeru
% il & server (remote)
% spustit, protlaci soubory na server, soubory zmizi, lze se dotazat na stav
\end{hints}
+
+
\subsection{Job state computation}
+\TODO{See also org.glite.testsuites.ctb/LB/lb-l2.sh above.}
% normal event delivery & job state machine
% .sh, dotaz na stav
\TODO{}
% specialni stav DAGu, histogram potomku
+
+
\subsection{LB proxy}
\req\ running \path{glite-lb-proxy}, \path{glite-lb-interlogd} and
\path{glite-lb-bkserverd}
\path{test.sh}) to test all this.
\end{hints}
+
+
\subsection{WS interface}
\req\ \path{glite-lb-bkserverd} running, events from \ref{normal} logged
the same form as e.g. \path{glite-lb-jobstat}.
\end{hints}
+
+
\subsection{Notifications}
% notifikace
\result\ Delayed notifications should be received by the client almost
immediately.
+
+
\subsection{Server purge}
\textbf{WARNING: This test is destructive, it destroys ALL data in an