Skip to content

Commit

Permalink
initial work on appraisal and rails integration testing, #3241
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Nov 17, 2016
1 parent 53b3b82 commit 7737da1
Show file tree
Hide file tree
Showing 12 changed files with 387 additions and 8 deletions.
7 changes: 7 additions & 0 deletions myapp/Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
appraise "rails-4" do
gem "rails", "4.2.7"
end

appraise "rails-5" do
gem "rails", "5.0.0"
end
1 change: 1 addition & 0 deletions myapp/Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
source 'https://rubygems.org'

gem 'appraisal'
gem 'pry'
gem 'sidekiq', :path => '..'
gem 'rails', '5.0.0'
Expand Down
32 changes: 24 additions & 8 deletions myapp/Rakefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)

Myapp::Application.load_tasks
task :test do
require 'timeout'

task :load_jobs => :environment do
require 'sidekiq/api'
Sidekiq::Queue.new.clear
%(production development).each do |env|
pid = fork do
ENV['RAILS_ENV'] = env
puts eval(File.read("integration_test.rb"))
end

50_000.times do |x|
EmptyWorker.perform_async
begin
Timeout.timeout(20) do
Process.wait
end
rescue Timeout::Error
Process.kill 9, pid
# collect status so it doesn't stick around as zombie process
Process.wait pid
end
puts "#{server} child exited, pid = #{pid}"
Process.wait4(pid)
end
end

if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
task :default => :appraisal
else
task :default => :test
end
2 changes: 2 additions & 0 deletions myapp/app/jobs/application_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class ApplicationJob < ActiveJob::Base
end
10 changes: 10 additions & 0 deletions myapp/app/jobs/exit_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class ExitJob < ApplicationJob
queue_as :default

def perform(*args)
Thread.new do
sleep 0.1
exit(0)
end
end
end
8 changes: 8 additions & 0 deletions myapp/app/models/exiter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Exiter
def self.run
Thread.new do
sleep 0.1
exit(0)
end
end
end
11 changes: 11 additions & 0 deletions myapp/app/workers/exit_worker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class ExitWorker
include Sidekiq::Worker

def perform
puts Rails.version
Thread.new do
sleep 0.1
exit(0)
end
end
end
13 changes: 13 additions & 0 deletions myapp/gemfiles/rails_4.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "pry"
gem "sidekiq", :path => "../.."
gem "rails", "4.2.7"

platforms :ruby do
gem "sqlite3"
gem "redis-namespace"
end
137 changes: 137 additions & 0 deletions myapp/gemfiles/rails_4.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
PATH
remote: ../..
specs:
sidekiq (4.2.6)
concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0)
rack-protection (>= 1.5.0)
redis (~> 3.2, >= 3.2.1)

GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.7)
actionpack (= 4.2.7)
actionview (= 4.2.7)
activejob (= 4.2.7)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.7)
actionview (= 4.2.7)
activesupport (= 4.2.7)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.7)
activesupport (= 4.2.7)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.7)
activesupport (= 4.2.7)
globalid (>= 0.3.0)
activemodel (4.2.7)
activesupport (= 4.2.7)
builder (~> 3.1)
activerecord (4.2.7)
activemodel (= 4.2.7)
activesupport (= 4.2.7)
arel (~> 6.0)
activesupport (4.2.7)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
appraisal (2.1.0)
bundler
rake
thor (>= 0.14.0)
arel (6.0.3)
builder (3.2.2)
coderay (1.1.1)
concurrent-ruby (1.0.2)
connection_pool (2.2.0)
erubis (2.7.0)
globalid (0.3.7)
activesupport (>= 4.1.0)
i18n (0.7.0)
json (1.8.3)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
mime-types (>= 1.16, < 4)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.9.1)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.6.4)
rack-protection (1.5.3)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.7)
actionmailer (= 4.2.7)
actionpack (= 4.2.7)
actionview (= 4.2.7)
activejob (= 4.2.7)
activemodel (= 4.2.7)
activerecord (= 4.2.7)
activesupport (= 4.2.7)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.7)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (4.2.7)
actionpack (= 4.2.7)
activesupport (= 4.2.7)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (11.3.0)
redis (3.3.1)
redis-namespace (1.5.2)
redis (~> 3.0, >= 3.0.4)
slop (3.6.0)
sprockets (3.7.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.11)
thor (0.19.1)
thread_safe (0.3.5)
tzinfo (1.2.2)
thread_safe (~> 0.1)

PLATFORMS
ruby

DEPENDENCIES
appraisal
pry
rails (= 4.2.7)
redis-namespace
sidekiq!
sqlite3

BUNDLED WITH
1.12.5
13 changes: 13 additions & 0 deletions myapp/gemfiles/rails_5.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "pry"
gem "sidekiq", :path => "../.."
gem "rails", "5.0.0"

platforms :ruby do
gem "sqlite3"
gem "redis-namespace"
end
141 changes: 141 additions & 0 deletions myapp/gemfiles/rails_5.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
PATH
remote: ../..
specs:
sidekiq (4.2.6)
concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0)
rack-protection (>= 1.5.0)
redis (~> 3.2, >= 3.2.1)

GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.0)
actionpack (= 5.0.0)
nio4r (~> 1.2)
websocket-driver (~> 0.6.1)
actionmailer (5.0.0)
actionpack (= 5.0.0)
actionview (= 5.0.0)
activejob (= 5.0.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.0)
actionview (= 5.0.0)
activesupport (= 5.0.0)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.0)
activesupport (= 5.0.0)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (5.0.0)
activesupport (= 5.0.0)
globalid (>= 0.3.6)
activemodel (5.0.0)
activesupport (= 5.0.0)
activerecord (5.0.0)
activemodel (= 5.0.0)
activesupport (= 5.0.0)
arel (~> 7.0)
activesupport (5.0.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
appraisal (2.1.0)
bundler
rake
thor (>= 0.14.0)
arel (7.1.4)
builder (3.2.2)
coderay (1.1.1)
concurrent-ruby (1.0.2)
connection_pool (2.2.0)
erubis (2.7.0)
globalid (0.3.7)
activesupport (>= 4.1.0)
i18n (0.7.0)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
mime-types (>= 1.16, < 4)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.9.1)
nio4r (1.2.1)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rack (2.0.1)
rack-protection (1.5.3)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.0)
actioncable (= 5.0.0)
actionmailer (= 5.0.0)
actionpack (= 5.0.0)
actionview (= 5.0.0)
activejob (= 5.0.0)
activemodel (= 5.0.0)
activerecord (= 5.0.0)
activesupport (= 5.0.0)
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.0)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.1)
activesupport (>= 4.2.0, < 6.0)
nokogiri (~> 1.6.0)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (5.0.0)
actionpack (= 5.0.0)
activesupport (= 5.0.0)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (11.3.0)
redis (3.3.1)
redis-namespace (1.5.2)
redis (~> 3.0, >= 3.0.4)
slop (3.6.0)
sprockets (3.7.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.11)
thor (0.19.1)
thread_safe (0.3.5)
tzinfo (1.2.2)
thread_safe (~> 0.1)
websocket-driver (0.6.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)

PLATFORMS
ruby

DEPENDENCIES
appraisal
pry
rails (= 5.0.0)
redis-namespace
sidekiq!
sqlite3

BUNDLED WITH
1.12.5
Loading

0 comments on commit 7737da1

Please sign in to comment.