Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes bug 824061 - socorro integration test

  • Loading branch information...
commit b4d03766c0d31f91608a7dc524b1f2048e98d881 1 parent 3748bd2
@rhelmer rhelmer authored
View
4 config/monitor.ini-dist
@@ -43,12 +43,12 @@
# name: priority_loop_frequency
# doc: the frequency to check for new priority jobs (hh:mm:ss)
# converter: timedelta_to_seconds_coverter
- priority_loop_frequency='30'
+ priority_loop_frequency='10'
# name: standard_loop_frequency
# doc: the frequency to check for new jobs (hh:mm:ss)
# converter: timedelta_to_seconds_coverter
- standard_loop_frequency='120'
+ standard_loop_frequency='10'
# name: transaction_executor_class
# doc: a class that will manage the job_manager's transactions
View
2  config/processor.ini-dist
@@ -400,7 +400,7 @@
# name: check_in_frequency
# doc: how often the processor is required to reregister (hh:mm:ss)
# converter: configman.converters.timedelta_converter
- check_in_frequency='00:00:05:00'
+ check_in_frequency='00:00:01:00'
# name: database
# doc: the class of the registrar's database
View
4 scripts/build.sh
@@ -51,6 +51,10 @@ wget 'https://ci.mozilla.org/job/breakpad/lastSuccessfulBuild/artifact/breakpad.
tar -zxf breakpad.tar.gz
mv breakpad stackwalk
+# run socorro integration test
+echo "Running integration test..."
+./scripts/integration-test.sh --destroy
+
# package socorro.tar.gz for distribution
mkdir builds/
make install PREFIX=builds/socorro
View
136 scripts/integration-test.sh
@@ -0,0 +1,136 @@
+#!/bin/bash
+
+# integration test for Socorro
+#
+# bring up components, submit test crash, ensure that it shows up in
+# reports tables.
+#
+# This uses the same setup as http://socorro.readthedocs.org/en/latest/installation.html
+
+if [ "$#" != "1" ] || [ "$1" != "--destroy" ]
+then
+ echo "WARNING - this script will destroy the local socorro install."
+ echo "The default database and config files will be overwritten."
+ echo "You must pass the --destroy flag to continue."
+ exit 1
+fi
+
+function cleanup() {
+ echo "INFO: Terminating background jobs"
+
+ for p in collector processor monitor
+ do
+ # destroy any running processes started by this shell
+ kill `jobs -p`
+ # destroy anything trying to write to the log files too
+ fuser -k ${p}.log > /dev/null 2>&1
+ done
+}
+
+trap 'cleanup' INT
+
+function fatal() {
+ exit_code=$1
+ message=$2
+
+ echo "ERROR: $message"
+
+ cleanup
+
+ exit $exit_code
+}
+
+echo -n "INFO: setting up environment..."
+make virtualenv > setup.log 2>&1
+. socorro-virtualenv/bin/activate >> setup.log 2>&1
+export PYTHONPATH=.
+echo " Done."
+
+echo -n "INFO: setting up database..."
+python socorro/external/postgresql/setupdb_app.py --database_name=breakpad --dropdb --force > setupdb.log 2>&1
+pushd tools/dataload >> setupdb.log 2>&1
+bash import.sh >> setupdb.log 2>&1
+popd >> setupdb.log 2>&1
+python socorro/cron/crontabber.py --job=weekly-reports-partitions --force >> setupdb.log 2>&1
+echo " Done."
+
+echo -n "INFO: copying default config..."
+cp config/collector.ini-dist config/collector.ini
+cp config/processor.ini-dist config/processor.ini
+cp config/monitor.ini-dist config/monitor.ini
+cp config/middleware.ini-dist config/middleware.ini
+echo " Done."
+
+echo -n "INFO: starting up collector, processor, monitor and middleware..."
+for p in collector processor monitor middleware
+do
+ # ensure no running processes
+ fuser -k ${p}.log > /dev/null 2>&1
+ python socorro/${p}/${p}_app.py --admin.conf=./config/${p}.ini > ${p}.log 2>&1 &
+ sleep 1
+done
+echo " Done."
+
+function retry() {
+ name=$1
+ search=$2
+
+ count=0
+ while true
+ do
+ grep "$search" ${name}.log > /dev/null
+ if [ $? != 0 ]
+ then
+ echo "INFO: waiting for $name..."
+ if [ $count == 10 ]
+ then
+ fatal 1 "$name timeout"
+ fi
+ else
+ grep 'ERROR' ${name}.log
+ if [ $? != 1 ]
+ then
+ fatal 1 "errors found in $name.log"
+ fi
+ echo "INFO: $name test passed"
+ break
+ fi
+ sleep 1
+ count=$((count+1))
+ done
+ }
+
+# wait for collector to startup
+retry 'collector' 'running standalone at 127.0.0.1:8882'
+
+echo -n 'INFO: submitting test crash...'
+# submit test crash
+python socorro/collector/submitter_app.py -u http://localhost:8882/submit -s testcrash/ > submitter.log 2>&1
+echo " Done."
+
+CRASHID=`grep 'CrashID' submitter.log | awk -FCrashID=bp- '{print $2}'`
+if [ -z "$CRASHID" ]
+then
+ fatal 1 "no crash ID found in submitter log"
+fi
+
+echo "INFO: collector received crash ID: $CRASHID"
+
+# make sure crashes are picked up, and no errors are logged
+retry 'collector' "$CRASHID"
+retry 'monitor' "$CRASHID"
+retry 'processor' "$CRASHID"
+
+# check that mware has raw crash
+curl -s "http://localhost:8883/crash/uuid/${CRASHID}" | grep '"total": 1"' > /dev/null
+if [ $? != 0 ]
+then
+ fatal 1 "middleware test failed, crash ID $CRASHID not found"
+else
+ echo "INFO: middleware passed"
+fi
+
+# check that mware logs the request for the crash, and logs no errors
+retry 'processor' "$CRASHID"
+
+cleanup
View
18 socorro/external/postgresql/setupdb_app.py
@@ -109,6 +109,20 @@ class SocorroDB(App):
exclude_from_print_conf=True,
exclude_from_dump_conf=True
)
+ required_config.add_option(
+ name='no_schema',
+ default=False,
+ doc='Whether or not to load schema',
+ exclude_from_print_conf=True,
+ exclude_from_dump_conf=True
+ )
+ required_config.add_option(
+ name='force',
+ default=False,
+ doc='Whether or not to override safety checks',
+ exclude_from_print_conf=True,
+ exclude_from_dump_conf=True
+ )
def main(self):
@@ -119,6 +133,8 @@ def main(self):
self.no_schema = self.config.get('no_schema')
+ self.force = self.config.get('force')
+
dsn_template = 'dbname=%s'
self.database_username = self.config.get('database_username')
@@ -150,7 +166,7 @@ def main(self):
print >>sys.stderr, 'updating your PostgreSQL settings.'
return 3
if self.config.get('dropdb'):
- if 'test' not in self.database_name:
+ if 'test' not in self.database_name and not self.force:
confirm = raw_input(
'drop database %s [y/N]: ' % self.database_name)
if not confirm == "y":
View
BIN  testcrash/7d381dc5-51e2-4887-956b-1ae9c2130109.dump
Binary file not shown
View
1  testcrash/7d381dc5-51e2-4887-956b-1ae9c2130109.json
@@ -0,0 +1 @@
+{"InstallTime": "1357622062", "Theme": "classic/1.0", "Version": "20.0a1", "id": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", "Vendor": "Mozilla", "EMCheckCompatibility": "true", "Throttleable": "0", "URL": "http://code.google.com/p/crashme/", "version": "20.0a1", "CrashTime": "1357770042", "ReleaseChannel": "nightly", "submitted_timestamp": "2013-01-09T22:21:18.646733+00:00", "buildid": "20130107030932", "timestamp": 1357770078.6467891, "Notes": "OpenGL: NVIDIA Corporation -- GeForce 8600M GT/PCIe/SSE2 -- 3.3.0 NVIDIA 313.09 -- texture_from_pixmap\r\n", "StartupTime": "1357769913", "FramePoisonSize": "4096", "FramePoisonBase": "7ffffffff0dea000", "Add-ons": "%7B972ce4c6-7e08-4474-a285-3208198ce6fd%7D:20.0a1,crashme%40ted.mielczarek.org:0.4", "BuildID": "20130107030932", "SecondsSinceLastCrash": "1831736", "ProductName": "Firefox", "legacy_processing": 0, "ProductID": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"}
Please sign in to comment.
Something went wrong with that request. Please try again.