Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add the ability to run PG as part of the stress test

  • Loading branch information...
commit 6b215143832b2a588e9b1b193ecab271f45a566a 1 parent d5cf0f2
@carllerche carllerche authored
View
5 Gemfile
@@ -10,6 +10,7 @@ gem 'rack-test', '~> 0.5.0'
group :stress do
gem "rails", "~> 3.0.0"
- gem 'activerecord-jdbc-adapter'
- gem "jdbc-mysql", :require => false
+ gem 'activerecord-jdbc-adapter', :require => false
+ gem "jdbc-mysql", :require => false
+ gem 'activerecord-jdbcpostgresql-adapter', :require => false
end
View
7 stress/run
@@ -10,9 +10,10 @@ def redeploy(path)
FileUtils.touch File.expand_path("../#{path}/REVISION", __FILE__)
end
-def background(int = 1)
+def background(int = 1, iterations = nil)
t = Thread.new do
- while true
+ while iterations.nil? || iterations > 0
+ iterations -= 1 if iterations
sleep int
yield
end
@@ -55,7 +56,7 @@ unless ARGV.include?("--no-train-app")
end
# Reload
- background 2 do
+ background 4 do
redeploy "train_app"
end
end
View
1  stress/train_app/Gemfile
@@ -3,3 +3,4 @@ source 'http://rubygems.org'
gem "rails", "~> 3.0.0"
gem 'activerecord-jdbc-adapter'
gem "jdbc-mysql", :require => false
+gem 'activerecord-jdbcpostgresql-adapter', :require => false
View
6 stress/train_app/config.ru
@@ -1,4 +1,10 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
+
+at_exit do
+ # Cleanup after the JDBC drives
+ ActiveRecord::Base.clear_all_connections!
+end
+
run TrainApp::Application
View
9 stress/train_app/config/database.yml
@@ -1,5 +1,3 @@
-# SQLite version 3.x
-# gem install sqlite3-ruby (not necessary on OS X Leopard)
production:
adapter: mysql
encoding: utf8
@@ -8,3 +6,10 @@ production:
pool: 5
username: root
socket: /tmp/mysql.sock
+
+# production:
+# adapter: postgresql
+# encoding: unicode
+# database: zomg_production
+# pool: 5
+# username: carllerche
Please sign in to comment.
Something went wrong with that request. Please try again.