~ubuntu-branches/ubuntu/raring/eucalyptus/raring

« back to all changes in this revision

Viewing changes to clc/modules/reporting/src/test/sh/runInstanceReportingTest.sh

  • Committer: Package Import Robot
  • Author(s): Brian Thomason
  • Date: 2011-11-29 13:17:52 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 185.
  • Revision ID: package-import@ubuntu.com-20111129131752-rq31al3ntutv2vvl
Tags: upstream-3.0.999beta1
ImportĀ upstreamĀ versionĀ 3.0.999beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
#
 
4
# Tests report generation for instance data. Returns 0 for success, 1 for failure.
 
5
#
 
6
# Author: Tom Werges
 
7
#
 
8
 
 
9
 
 
10
# Gather CLC IP
 
11
CLC_IP=`cat ../input/2b_tested.lst |grep '\[.*CLC.*\]'|awk '{ print $1 }'`
 
12
 
 
13
# Login, and get session id
 
14
wget -O /tmp/sessionId --no-check-certificate "https://$CLC_IP:8443/loginservlet?adminPw=admin"
 
15
if [ "$?" -ne "0" ]; then echo "Login failed"; exit 1; fi
 
16
export SESSIONID=`cat /tmp/sessionId`
 
17
echo "session id:" $SESSIONID
 
18
 
 
19
# Clear and generate false data for instances
 
20
wget --no-check-certificate -O /tmp/nothing "https://$CLC_IP:8443/commandservlet?sessionId=$SESSIONID&className=com.eucalyptus.reporting.instance.FalseDataGenerator&methodName=removeFalseData"
 
21
if [ "$?" -ne "0" ]; then echo "Data removal failed"; exit 1; fi
 
22
wget --no-check-certificate -O /tmp/nothing "https://$CLC_IP:8443/commandservlet?sessionId=$SESSIONID&className=com.eucalyptus.reporting.instance.FalseDataGenerator&methodName=generateFalseData"
 
23
if [ "$?" -ne "0" ]; then echo "Data generation failed"; exit 1; fi
 
24
 
 
25
# Generate instance report, based upon data generated above
 
26
wget -O /tmp/instanceReport.csv --no-check-certificate "https://$CLC_IP:8443/reports?session=$SESSIONID&name=user_vms&type=csv&page=0&flush=false&start=1104566480000&end=1104571200000&criterionId=2&groupById=0"
 
27
if [ "$?" -ne "0" ]; then echo "Report generation failed"; exit 1; fi
 
28
 
 
29
# Verify that the resulting report has the correct number of entries in it
 
30
REPORT_USERS_CNT=`cat /tmp/instanceReport.csv |  grep 'user-[0-9]\+' | wc -l`
 
31
if [ "$REPORT_USERS_CNT" -ne "8" ]; then
 
32
        echo "Report users count is incorrect."
 
33
        exit -1
 
34
fi
 
35
 
 
36
# Verify that the report is correct, using the CsvChecker tool.
 
37
java -jar CsvChecker.jar 0.2 instanceReference.csv /tmp/instanceReport.csv
 
38
if [ "$?" -ne "0" ]; then echo "Report failed values check"; exit 1; fi
 
39