[ARVADOS] created: 5dcf1726deccf90ebf6ae670d9ab7434398f50e7
Git user
git at public.curoverse.com
Mon Oct 10 17:43:39 EDT 2016
at 5dcf1726deccf90ebf6ae670d9ab7434398f50e7 (commit)
commit 5dcf1726deccf90ebf6ae670d9ab7434398f50e7
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 10 17:42:43 2016 -0400
5737: Tweak websocket tests
diff --git a/services/api/Gemfile.lock b/services/api/Gemfile.lock
index 0eff952..1dfa92d 100644
--- a/services/api/Gemfile.lock
+++ b/services/api/Gemfile.lock
@@ -82,9 +82,9 @@ GEM
railties (>= 3.0.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
- faye-websocket (0.7.2)
+ faye-websocket (0.10.4)
eventmachine (>= 0.12.0)
- websocket-driver (>= 0.3.1)
+ websocket-driver (>= 0.5.1)
google-api-client (0.7.1)
addressable (>= 2.3.2)
autoparse (>= 0.3.3)
@@ -231,7 +231,9 @@ GEM
execjs (>= 0.3.0)
json (>= 1.8.0)
uuidtools (2.1.5)
- websocket-driver (0.3.2)
+ websocket-driver (0.6.4)
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.2)
PLATFORMS
ruby
diff --git a/services/api/test/integration/websocket_test.rb b/services/api/test/integration/websocket_test.rb
index 198ea71..e19f0f1 100644
--- a/services/api/test/integration/websocket_test.rb
+++ b/services/api/test/integration/websocket_test.rb
@@ -20,6 +20,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
@@port = s.addr[1]
s.close
pidfile = "tmp/pids/passenger.#{@@port}.pid"
+ DatabaseCleaner.start
Dir.chdir(Rails.root) do |apidir|
# Only passenger seems to be able to run the websockets server
# successfully.
@@ -63,7 +64,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
end
- def ws_helper (token = nil, timeout = true)
+ def ws_helper(token: nil, timeout: 8)
opened = false
close_status = nil
too_long = false
@@ -78,7 +79,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
ws.on :open do |event|
opened = true
if timeout
- EM::Timer.new 8 do
+ EM::Timer.new(timeout) do
too_long = true if close_status.nil?
EM.stop_event_loop
end
@@ -101,7 +102,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
test "connect with no token" do
status = nil
- ws_helper do |ws|
+ ws_helper(token: :expired) do |ws|
ws.on :message do |event|
d = Oj.strict_load event.data
status = d["status"]
@@ -116,7 +117,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
test "connect, subscribe and get response" do
status = nil
- ws_helper :active do |ws|
+ ws_helper(token: :active) do |ws|
ws.on :open do |event|
ws.send ({method: 'subscribe'}.to_json)
end
@@ -138,7 +139,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
authorize_with :active
- ws_helper :active do |ws|
+ ws_helper(token: :active) do |ws|
ws.on :open do |event|
ws.send ({method: 'subscribe'}.to_json)
end
@@ -175,7 +176,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
authorize_with :active
- ws_helper :active do |ws|
+ ws_helper(token: :active) do |ws|
ws.on :open do |event|
ws.send ({method: 'subscribe'}.to_json)
end
@@ -215,7 +216,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
authorize_with :active
- ws_helper :active do |ws|
+ ws_helper(token: :active) do |ws|
ws.on :open do |event|
ws.send ({method: 'subscribe', filters: [['object_uuid', 'is_a', 'arvados#human']]}.to_json)
end
@@ -253,7 +254,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
authorize_with :active
- ws_helper :active do |ws|
+ ws_helper(token: :active) do |ws|
ws.on :open do |event|
ws.send ({method: 'subscribe', filters: [['object_uuid', 'is_a', 'arvados#human']]}.to_json)
ws.send ({method: 'subscribe', filters: [['object_uuid', 'is_a', 'arvados#specimen']]}.to_json)
@@ -298,7 +299,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
authorize_with :active
- ws_helper :active do |ws|
+ ws_helper(token: :active) do |ws|
ws.on :open do |event|
ws.send ({method: 'subscribe', filters: [['object_uuid', 'is_a', 'arvados#trait'], ['event_type', '=', 'update']]}.to_json)
end
@@ -338,7 +339,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
l1 = nil
l2 = nil
- ws_helper :active do |ws|
+ ws_helper(token: :active) do |ws|
ws.on :open do |event|
ws.send ({method: 'subscribe', last_log_id: lastid}.to_json)
end
@@ -378,7 +379,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
authorize_with :active
- ws_helper :active, false do |ws|
+ ws_helper(token: :active, timeout: false) do |ws|
ws.on :open do |event|
ws.send ({method: 'subscribe'}.to_json)
EM::Timer.new 3 do
@@ -427,7 +428,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
authorize_with :active
- ws_helper :active, false do |ws|
+ ws_helper(token: :active, timeout: false) do |ws|
ws.on :open do |event|
ws.send ({method: 'subscribe', filters: [['object_uuid', 'is_a', 'arvados#human']]}.to_json)
EM::Timer.new 6 do
@@ -479,7 +480,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
authorize_with :active
- ws_helper :active do |ws|
+ ws_helper(token: :active) do |ws|
ws.on :open do |event|
ws.send ({method: 'subscribe'}.to_json)
end
@@ -526,7 +527,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
slow_test
authorize_with :active
- ws_helper :active, false do |ws|
+ ws_helper(token: :active, timeout: false) do |ws|
ws.on :open do |event|
EM::Timer.new 1 do
Specimen.create
@@ -549,7 +550,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
authorize_with :admin
- ws_helper :active, false do |ws|
+ ws_helper(token: :active, timeout: false) do |ws|
ws.on :open do |event|
ws.send ({method: 'subscribe'}.to_json)
@@ -577,7 +578,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
test "connect, try bogus method" do
status = nil
- ws_helper :active do |ws|
+ ws_helper(token: :active) do |ws|
ws.on :open do |event|
ws.send ({method: 'frobnabble'}.to_json)
end
@@ -595,7 +596,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
test "connect, missing method" do
status = nil
- ws_helper :active do |ws|
+ ws_helper(token: :active) do |ws|
ws.on :open do |event|
ws.send ({fizzbuzz: 'frobnabble'}.to_json)
end
@@ -613,7 +614,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
test "connect, send malformed request" do
status = nil
- ws_helper :active do |ws|
+ ws_helper(token: :active) do |ws|
ws.on :open do |event|
ws.send '<XML4EVER></XML4EVER>'
end
@@ -634,7 +635,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
authorize_with :active
- ws_helper :active do |ws|
+ ws_helper(token: :active) do |ws|
ws.on :open do |event|
(1..17).each do |i|
ws.send ({method: 'subscribe', filters: [['object_uuid', '=', i]]}.to_json)
@@ -667,7 +668,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
authorize_with :active
- ws_helper :active, false do |ws|
+ ws_helper(token: :active, timeout: false) do |ws|
EM::Timer.new 45 do
# Needs a longer timeout than the default
ws.close
@@ -710,7 +711,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
authorize_with :active
- ws_helper :active do |ws|
+ ws_helper(token: :active) do |ws|
ws.on :open do |event|
# test that #6451 is fixed (invalid filter crashes websockets)
ws.send ({method: 'subscribe', filters: [['object_blarg', 'is_a', 'arvados#human']]}.to_json)
commit 62efb0eed28402cbd7710a0dc5bf89ee03bb4a3b
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 10 17:39:58 2016 -0400
5737: Fix test so call counts are as expected
diff --git a/services/api/test/unit/app_version_test.rb b/services/api/test/unit/app_version_test.rb
index 4718ac2..2e58505 100644
--- a/services/api/test/unit/app_version_test.rb
+++ b/services/api/test/unit/app_version_test.rb
@@ -20,9 +20,12 @@ class AppVersionTest < ActiveSupport::TestCase
end
end
- test 'override with configuration' do
+ test 'override with configuration "foobar"' do
Rails.configuration.source_version = 'foobar'
assert_equal 'foobar', AppVersion.hash
+ end
+
+ test 'override with configuration false' do
Rails.configuration.source_version = false
assert_not_equal 'foobar', AppVersion.hash
end
commit a3b819c87dad5168072506883ff8254edd53ffb0
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 10 17:39:21 2016 -0400
5737: Avoid expects().with(includes(...))
diff --git a/services/api/test/unit/fail_jobs_test.rb b/services/api/test/unit/fail_jobs_test.rb
index c390b32..974563f 100644
--- a/services/api/test/unit/fail_jobs_test.rb
+++ b/services/api/test/unit/fail_jobs_test.rb
@@ -44,7 +44,7 @@ class FailJobsTest < ActiveSupport::TestCase
with(['squeue', '-h', '-o', '%i %j']).
returns(fake_squeue)
File.expects(:popen).
- with(includes('sudo', '-u', 'foobar', 'scancel', '1234')).
+ with(['sudo', '-u', 'foobar', 'scancel', '1234']).
returns(fake_scancel)
@dispatch.fail_jobs(before: Time.at(BOOT_TIME).to_s)
assert_end_states
commit 1a3efb2231e26ac90a5f437e078860f9a4e780c3
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 10 16:35:49 2016 -0400
5737: Fix some ruby warnings
diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index 672374b..ceec552 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -490,7 +490,7 @@ class ArvadosModel < ActiveRecord::Base
end
def foreign_key_attributes
- attributes.keys.select { |a| a.match /_uuid$/ }
+ attributes.keys.select { |a| a.match(/_uuid$/) }
end
def skip_uuid_read_permission_check
@@ -505,7 +505,7 @@ class ArvadosModel < ActiveRecord::Base
foreign_key_attributes.each do |attr|
attr_value = send attr
if attr_value.is_a? String and
- attr_value.match /^[0-9a-f]{32,}(\+[@\w]+)*$/
+ attr_value.match(/^[0-9a-f]{32,}(\+[@\w]+)*$/)
begin
send "#{attr}=", Collection.normalize_uuid(attr_value)
rescue
@@ -590,7 +590,7 @@ class ArvadosModel < ActiveRecord::Base
return uuid_prefixes[re[1]] if uuid_prefixes[re[1]]
end
- if uuid.match /.+ at .+/
+ if uuid.match(/.+ at .+/)
return Email
end
diff --git a/services/api/app/models/node.rb b/services/api/app/models/node.rb
index f92c78b..63fd9ea 100644
--- a/services/api/app/models/node.rb
+++ b/services/api/app/models/node.rb
@@ -227,7 +227,7 @@ class Node < ArvadosModel
(0..Rails.configuration.max_compute_nodes-1).each do |slot_number|
hostname = hostname_for_slot(slot_number)
hostfile = File.join Rails.configuration.dns_server_conf_dir, "#{hostname}.conf"
- if !File.exists? hostfile
+ if !File.exist? hostfile
n = Node.where(:slot_number => slot_number).first
if n.nil? or n.ip_address.nil?
dns_server_update(hostname, '127.40.4.0')
diff --git a/services/api/config/boot.rb b/services/api/config/boot.rb
index 4489e58..f2830ae 100644
--- a/services/api/config/boot.rb
+++ b/services/api/config/boot.rb
@@ -3,4 +3,4 @@ require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
-require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
+require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
diff --git a/services/api/config/initializers/inflections.rb b/services/api/config/initializers/inflections.rb
index 79bca3a..b6dadf7 100644
--- a/services/api/config/initializers/inflections.rb
+++ b/services/api/config/initializers/inflections.rb
@@ -10,8 +10,8 @@
# end
ActiveSupport::Inflector.inflections do |inflect|
- inflect.plural /^([Ss]pecimen)$/i, '\1s'
- inflect.singular /^([Ss]pecimen)s?/i, '\1'
- inflect.plural /^([Hh]uman)$/i, '\1s'
- inflect.singular /^([Hh]uman)s?/i, '\1'
+ inflect.plural(/^([Ss]pecimen)$/i, '\1s')
+ inflect.singular(/^([Ss]pecimen)s?/i, '\1')
+ inflect.plural(/^([Hh]uman)$/i, '\1s')
+ inflect.singular(/^([Hh]uman)s?/i, '\1')
end
diff --git a/services/api/config/initializers/load_config.rb b/services/api/config/initializers/load_config.rb
index 76234d3..fd3c977 100644
--- a/services/api/config/initializers/load_config.rb
+++ b/services/api/config/initializers/load_config.rb
@@ -6,7 +6,7 @@ rescue LoadError
# configured by application.yml (i.e., here!) instead.
end
-if (File.exists?(File.expand_path '../omniauth.rb', __FILE__) and
+if (File.exist?(File.expand_path '../omniauth.rb', __FILE__) and
not defined? WARNED_OMNIAUTH_CONFIG)
Rails.logger.warn <<-EOS
DEPRECATED CONFIGURATION:
@@ -26,7 +26,7 @@ $application_config = {}
%w(application.default application).each do |cfgfile|
path = "#{::Rails.root.to_s}/config/#{cfgfile}.yml"
- if File.exists? path
+ if File.exist? path
yaml = ERB.new(IO.read path).result(binding)
confs = YAML.load(yaml, deserialize_symbols: true)
# Ignore empty YAML file:
diff --git a/services/api/lib/crunch_dispatch.rb b/services/api/lib/crunch_dispatch.rb
index ce94f73..83cd1b9 100644
--- a/services/api/lib/crunch_dispatch.rb
+++ b/services/api/lib/crunch_dispatch.rb
@@ -27,7 +27,7 @@ class CrunchDispatch
@cgroup_root = ENV['CRUNCH_CGROUP_ROOT']
@arvados_internal = Rails.configuration.git_internal_dir
- if not File.exists? @arvados_internal
+ if not File.exist? @arvados_internal
$stderr.puts `mkdir -p #{@arvados_internal.shellescape} && git init --bare #{@arvados_internal.shellescape}`
raise "No internal git repository available" unless ($? == 0)
end
diff --git a/services/api/lib/load_param.rb b/services/api/lib/load_param.rb
index 5b22274..3bab33f 100644
--- a/services/api/lib/load_param.rb
+++ b/services/api/lib/load_param.rb
@@ -92,11 +92,11 @@ module LoadParam
# has used set_table_name to use an alternate table name from the Rails standard.
# I could not find a perfect way to handle this well, but ActiveRecord::Base.send(:descendants)
# would be a place to start if this ever becomes necessary.
- if attr.match /^[a-z][_a-z0-9]+$/ and
+ if attr.match(/^[a-z][_a-z0-9]+$/) and
model_class.columns.collect(&:name).index(attr) and
['asc','desc'].index direction.downcase
@orders << "#{table_name}.#{attr} #{direction.downcase}"
- elsif attr.match /^([a-z][_a-z0-9]+)\.([a-z][_a-z0-9]+)$/ and
+ elsif attr.match(/^([a-z][_a-z0-9]+)\.([a-z][_a-z0-9]+)$/) and
['asc','desc'].index(direction.downcase) and
ActiveRecord::Base.connection.tables.include?($1) and
$1.classify.constantize.columns.collect(&:name).index($2)
diff --git a/services/api/script/arvados-git-sync.rb b/services/api/script/arvados-git-sync.rb
index 3a8ed27..b785534 100755
--- a/services/api/script/arvados-git-sync.rb
+++ b/services/api/script/arvados-git-sync.rb
@@ -22,7 +22,7 @@ DEBUG = 1
# load and merge in the environment-specific application config info
# if present, overriding base config parameters as specified
path = File.absolute_path('../../config/arvados-clients.yml', __FILE__)
-if File.exists?(path) then
+if File.exist?(path) then
cp_config = YAML.load_file(path)[ENV['RAILS_ENV']]
else
puts "Please create a\n #{path}\n file"
@@ -214,7 +214,7 @@ end
begin
# Get our local gitolite-admin repo up to snuff
- if not File.exists?(gitolite_admin) then
+ if not File.exist?(gitolite_admin) then
ensure_directory(gitolite_tmpdir, 0700)
Dir.chdir(gitolite_tmpdir)
`git clone #{gitolite_url}`
diff --git a/services/api/script/migrate-gitolite-to-uuid-storage.rb b/services/api/script/migrate-gitolite-to-uuid-storage.rb
index 8db1a0e..169509f 100755
--- a/services/api/script/migrate-gitolite-to-uuid-storage.rb
+++ b/services/api/script/migrate-gitolite-to-uuid-storage.rb
@@ -35,7 +35,7 @@ DEBUG = 1
# load and merge in the environment-specific application config info
# if present, overriding base config parameters as specified
path = File.dirname(__FILE__) + '/config/arvados-clients.yml'
-if File.exists?(path) then
+if File.exist?(path) then
cp_config = YAML.load_file(path)[ENV['RAILS_ENV']]
else
puts "Please create a\n " + File.dirname(__FILE__) + "/config/arvados-clients.yml\n file"
@@ -186,7 +186,7 @@ end
begin
# Get our local gitolite-admin repo up to snuff
- if not File.exists?(gitolite_admin) then
+ if not File.exist?(gitolite_admin) then
ensure_directory(gitolite_tmpdir, 0700)
Dir.chdir(gitolite_tmpdir)
`git clone #{gitolite_url}`
diff --git a/services/api/test/functional/arvados/v1/jobs_controller_test.rb b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
index b84c93d..9a0aa50 100644
--- a/services/api/test/functional/arvados/v1/jobs_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
@@ -97,7 +97,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
'server should correct bogus cancelled_at ' +
job['cancelled_at'])
assert_equal(true,
- File.exists?(Rails.configuration.crunch_refresh_trigger),
+ File.exist?(Rails.configuration.crunch_refresh_trigger),
'trigger file should be created when job is cancelled')
end
diff --git a/services/api/test/unit/app_version_test.rb b/services/api/test/unit/app_version_test.rb
index 3e9b167..4718ac2 100644
--- a/services/api/test/unit/app_version_test.rb
+++ b/services/api/test/unit/app_version_test.rb
@@ -29,7 +29,7 @@ class AppVersionTest < ActiveSupport::TestCase
test 'override with file' do
path = Rails.root.join 'git-commit.version'
- assert(!File.exists?(path),
+ assert(!File.exist?(path),
"Packaged version file found in source tree: #{path}")
begin
File.open(path, 'w') do |f|
diff --git a/services/api/test/unit/commit_test.rb b/services/api/test/unit/commit_test.rb
index b57c23b..301e071 100644
--- a/services/api/test/unit/commit_test.rb
+++ b/services/api/test/unit/commit_test.rb
@@ -183,34 +183,34 @@ class CommitTest < ActiveSupport::TestCase
Dir.mktmpdir do |touchdir|
# invalid input to maximum
a = Commit.find_commit_range('active/foo', nil, "31ce37fe365b3dc204300a3e4c396ad333ed0556 ; touch #{touchdir}/uh_oh", nil)
- assert !File.exists?("#{touchdir}/uh_oh"), "#{touchdir}/uh_oh should not exist, 'maximum' parameter of find_commit_range is exploitable"
+ assert !File.exist?("#{touchdir}/uh_oh"), "#{touchdir}/uh_oh should not exist, 'maximum' parameter of find_commit_range is exploitable"
assert_equal [], a
# invalid input to maximum
a = Commit.find_commit_range('active/foo', nil, "$(uname>#{touchdir}/uh_oh)", nil)
- assert !File.exists?("#{touchdir}/uh_oh"), "#{touchdir}/uh_oh should not exist, 'maximum' parameter of find_commit_range is exploitable"
+ assert !File.exist?("#{touchdir}/uh_oh"), "#{touchdir}/uh_oh should not exist, 'maximum' parameter of find_commit_range is exploitable"
assert_equal [], a
# invalid input to minimum
a = Commit.find_commit_range('active/foo', "31ce37fe365b3dc204300a3e4c396ad333ed0556 ; touch #{touchdir}/uh_oh", "31ce37fe365b3dc204300a3e4c396ad333ed0556", nil)
- assert !File.exists?("#{touchdir}/uh_oh"), "#{touchdir}/uh_oh should not exist, 'minimum' parameter of find_commit_range is exploitable"
+ assert !File.exist?("#{touchdir}/uh_oh"), "#{touchdir}/uh_oh should not exist, 'minimum' parameter of find_commit_range is exploitable"
assert_equal [], a
# invalid input to minimum
a = Commit.find_commit_range('active/foo', "$(uname>#{touchdir}/uh_oh)", "31ce37fe365b3dc204300a3e4c396ad333ed0556", nil)
- assert !File.exists?("#{touchdir}/uh_oh"), "#{touchdir}/uh_oh should not exist, 'minimum' parameter of find_commit_range is exploitable"
+ assert !File.exist?("#{touchdir}/uh_oh"), "#{touchdir}/uh_oh should not exist, 'minimum' parameter of find_commit_range is exploitable"
assert_equal [], a
# invalid input to 'excludes'
# complains "fatal: bad object 077ba2ad3ea24a929091a9e6ce545c93199b8e57"
a = Commit.find_commit_range('active/foo', "31ce37fe365b3dc204300a3e4c396ad333ed0556", "077ba2ad3ea24a929091a9e6ce545c93199b8e57", ["4fe459abe02d9b365932b8f5dc419439ab4e2577 ; touch #{touchdir}/uh_oh"])
- assert !File.exists?("#{touchdir}/uh_oh"), "#{touchdir}/uh_oh should not exist, 'excludes' parameter of find_commit_range is exploitable"
+ assert !File.exist?("#{touchdir}/uh_oh"), "#{touchdir}/uh_oh should not exist, 'excludes' parameter of find_commit_range is exploitable"
assert_equal [], a
# invalid input to 'excludes'
# complains "fatal: bad object 077ba2ad3ea24a929091a9e6ce545c93199b8e57"
a = Commit.find_commit_range('active/foo', "31ce37fe365b3dc204300a3e4c396ad333ed0556", "077ba2ad3ea24a929091a9e6ce545c93199b8e57", ["$(uname>#{touchdir}/uh_oh)"])
- assert !File.exists?("#{touchdir}/uh_oh"), "#{touchdir}/uh_oh should not exist, 'excludes' parameter of find_commit_range is exploitable"
+ assert !File.exist?("#{touchdir}/uh_oh"), "#{touchdir}/uh_oh should not exist, 'excludes' parameter of find_commit_range is exploitable"
assert_equal [], a
end
end
commit 25e38abdfed8bffb07537cb5b76272adc675bda3
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 10 16:25:48 2016 -0400
5737: Update httpclient gem
diff --git a/apps/workbench/Gemfile.lock b/apps/workbench/Gemfile.lock
index a8431a7..11f32d6 100644
--- a/apps/workbench/Gemfile.lock
+++ b/apps/workbench/Gemfile.lock
@@ -123,7 +123,7 @@ GEM
signet (~> 0.7)
headless (1.0.2)
highline (1.6.21)
- httpclient (2.6.0.1)
+ httpclient (2.8.2.4)
i18n (0.7.0)
jquery-rails (3.1.2)
railties (>= 3.0, < 5.0)
@@ -320,4 +320,4 @@ DEPENDENCIES
wiselinks
BUNDLED WITH
- 1.12.1
+ 1.13.2
commit ce0fb468e4c8a147396f8beb9b58d3e3ab5cc4ff
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 10 16:19:25 2016 -0400
5737: Use test-unit-activesupport gem. Fixes "omit".
diff --git a/services/api/Gemfile b/services/api/Gemfile
index 77605aa..523009a 100644
--- a/services/api/Gemfile
+++ b/services/api/Gemfile
@@ -9,7 +9,8 @@ group :test, :development do
gem 'factory_girl_rails'
gem 'database_cleaner'
gem 'ruby-prof'
- gem 'test-unit', '~> 3.0'
+ gem 'test-unit'
+ gem 'test-unit-activesupport'
# Note: "require: false" here tells bunder not to automatically
# 'require' the packages during application startup. Installation is
# still mandatory.
diff --git a/services/api/Gemfile.lock b/services/api/Gemfile.lock
index c02cbd1..0eff952 100644
--- a/services/api/Gemfile.lock
+++ b/services/api/Gemfile.lock
@@ -153,7 +153,7 @@ GEM
pg
rails (~> 3.1)
polyglot (0.3.5)
- power_assert (0.2.6)
+ power_assert (0.3.1)
puma (2.8.2)
rack (>= 1.1, < 2.0)
rack (1.4.7)
@@ -209,8 +209,11 @@ GEM
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sshkey (1.6.1)
- test-unit (3.1.5)
+ test-unit (3.2.1)
power_assert
+ test-unit-activesupport (1.0.6)
+ activesupport
+ test-unit
test_after_commit (0.2.3)
themes_for_rails (0.5.1)
rails (>= 3.0.0)
@@ -262,7 +265,8 @@ DEPENDENCIES
simplecov (~> 0.7.1)
simplecov-rcov
sshkey
- test-unit (~> 3.0)
+ test-unit
+ test-unit-activesupport
test_after_commit
themes_for_rails
therubyracer
diff --git a/services/api/Rakefile b/services/api/Rakefile
index fbbf53e..99eb343 100644
--- a/services/api/Rakefile
+++ b/services/api/Rakefile
@@ -12,27 +12,6 @@ end
Server::Application.load_tasks
-namespace :test do
- task(:run).clear
- # Copied from the definition in Rails 3.2.
- # This may need to be updated if we upgrade Rails.
- task :run do
- errors = %w(test:units test:functionals test:integration test:tasks).collect do |task|
- begin
- Rake::Task[task].invoke
- nil
- rescue => e
- { :task => task, :exception => e }
- end
- end.compact
-
- if errors.any?
- puts errors.map { |e| "Errors running #{e[:task]}! #{e[:exception].inspect}" }.join("\n")
- abort
- end
- end
-end
-
namespace :db do
namespace :structure do
task :dump do
diff --git a/services/api/test/test_helper.rb b/services/api/test/test_helper.rb
index f35b5fc..5baf503 100644
--- a/services/api/test/test_helper.rb
+++ b/services/api/test/test_helper.rb
@@ -21,6 +21,7 @@ unless ENV["NO_COVERAGE_TEST"]
end
require File.expand_path('../../config/environment', __FILE__)
+require 'test/unit/active_support'
require 'rails/test_help'
require 'mocha/mini_test'
commit 0450aa064b44894e3e5288d3737310cd329cafd7
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 10 15:20:08 2016 -0400
5737: Fix some ruby warnings
diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb
index 3c5bf94..6229b49 100644
--- a/services/api/app/controllers/application_controller.rb
+++ b/services/api/app/controllers/application_controller.rb
@@ -58,6 +58,18 @@ class ApplicationController < ActionController::Base
:with => :render_not_found)
end
+ def initialize *args
+ super
+ @object = nil
+ @objects = nil
+ @offset = nil
+ @limit = nil
+ @select = nil
+ @distinct = nil
+ @response_resource_name = nil
+ @attrs = nil
+ end
+
def default_url_options
if Rails.configuration.host
{:host => Rails.configuration.host}
diff --git a/services/api/app/middlewares/arvados_api_token.rb b/services/api/app/middlewares/arvados_api_token.rb
index d8c04a1..2487f2e 100644
--- a/services/api/app/middlewares/arvados_api_token.rb
+++ b/services/api/app/middlewares/arvados_api_token.rb
@@ -7,7 +7,7 @@ class ArvadosApiToken
# Create a new ArvadosApiToken handler
# +app+ The next layer of the Rack stack.
def initialize(app = nil, options = nil)
- @app = app if app.respond_to?(:call)
+ @app = app.respond_to?(:call) ? app : nil
end
def call env
diff --git a/services/api/app/models/blob.rb b/services/api/app/models/blob.rb
index 41d5b27..00c2501 100644
--- a/services/api/app/models/blob.rb
+++ b/services/api/app/models/blob.rb
@@ -64,9 +64,9 @@ class Blob
# Return value: true if the locator has a valid signature, false otherwise
# Arguments: signed_blob_locator, opts
#
- def self.verify_signature *args
+ def self.verify_signature(*args)
begin
- self.verify_signature! *args
+ self.verify_signature!(*args)
true
rescue Blob::InvalidSignatureError
false
diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 4a05441..98b29f4 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -50,6 +50,18 @@ class Collection < ArvadosModel
super + ["updated_at", "file_names"]
end
+ def initialize(*args)
+ super
+ @signatures_checked = false
+ @computed_pdh_for_manifest_text = false
+ end
+
+ def initialize_copy(*args)
+ super
+ @signatures_checked = false
+ @computed_pdh_for_manifest_text = false
+ end
+
FILE_TOKEN = /^[[:digit:]]+:[[:digit:]]+:/
def check_signatures
return false if self.manifest_text.nil?
@@ -61,7 +73,9 @@ class Collection < ArvadosModel
# subsequent passes without checking any signatures. This is
# important because the signatures have probably been stripped off
# by the time we get to a second validation pass!
- return true if @signatures_checked and @signatures_checked == computed_pdh
+ if @signatures_checked && @signatures_checked == computed_pdh
+ return true
+ end
if self.manifest_text_changed?
# Check permissions on the collection manifest.
diff --git a/services/api/app/models/job.rb b/services/api/app/models/job.rb
index 1c47425..a75af86 100644
--- a/services/api/app/models/job.rb
+++ b/services/api/app/models/job.rb
@@ -67,6 +67,11 @@ class Job < ArvadosModel
(Complete = 'Complete'),
]
+ def initialize(*args)
+ super
+ @need_crunch_dispatch_trigger = false
+ end
+
def assert_finished
update_attributes(finished_at: finished_at || db_current_time,
success: success.nil? ? false : success,
diff --git a/services/api/app/models/node.rb b/services/api/app/models/node.rb
index abb46fd..f92c78b 100644
--- a/services/api/app/models/node.rb
+++ b/services/api/app/models/node.rb
@@ -30,6 +30,11 @@ class Node < ArvadosModel
t.add lambda { |x| Rails.configuration.compute_node_nameservers }, :as => :nameservers
end
+ def initialize(*args)
+ super
+ @bypass_arvados_authorization = false
+ end
+
def domain
super || Rails.configuration.compute_node_domain
end
diff --git a/services/api/lib/current_api_client.rb b/services/api/lib/current_api_client.rb
index fbd4ef5..1d7dc41 100644
--- a/services/api/lib/current_api_client.rb
+++ b/services/api/lib/current_api_client.rb
@@ -1,3 +1,11 @@
+$system_user = nil
+$system_group = nil
+$all_users_group = nil
+$anonymous_user = nil
+$anonymous_group = nil
+$anonymous_group_read_permission = nil
+$empty_collection = nil
+
module CurrentApiClient
def current_user
Thread.current[:user]
commit 9f8e44c0a2514f6051db1228ccee81a108ff6ebb
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 10 15:18:28 2016 -0400
5737: Update passenger gem
diff --git a/services/api/Gemfile.lock b/services/api/Gemfile.lock
index ce31316..c02cbd1 100644
--- a/services/api/Gemfile.lock
+++ b/services/api/Gemfile.lock
@@ -70,7 +70,6 @@ GEM
execjs
coffee-script-source (1.7.0)
curb (0.9.3)
- daemon_controller (1.2.0)
database_cleaner (1.2.0)
erubis (2.7.0)
eventmachine (1.2.0.1)
@@ -146,11 +145,10 @@ GEM
omniauth-oauth2 (1.1.1)
oauth2 (~> 0.8.0)
omniauth (~> 1.0)
- passenger (4.0.41)
- daemon_controller (>= 1.2.0)
+ passenger (5.0.30)
rack
rake (>= 0.8.1)
- pg (0.17.1)
+ pg (0.19.0)
pg_power (1.6.4)
pg
rails (~> 3.1)
commit 592387b2beaf479299ec3efa6d66e2bc88519348
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 10 15:17:53 2016 -0400
5737: Rename "skip" to "omit"
diff --git a/services/api/test/functional/arvados/v1/collections_controller_test.rb b/services/api/test/functional/arvados/v1/collections_controller_test.rb
index a8583be..64f6195 100644
--- a/services/api/test/functional/arvados/v1/collections_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/collections_controller_test.rb
@@ -753,8 +753,10 @@ EOS
].each do |description_size, expected_response|
test "create collection with description size #{description_size}
and expect response #{expected_response}" do
- skip "(Descriptions are not part of search indexes. Skip until full-text search
- is implemented, at which point replace with a search in description.)"
+
+ omit "(Descriptions are not part of search indexes. Skip until
+ full-text search is implemented, at which point replace with a
+ search in description.)"
authorize_with :active
diff --git a/services/api/test/functional/arvados/v1/links_controller_test.rb b/services/api/test/functional/arvados/v1/links_controller_test.rb
index 1345701..af3cd3a 100644
--- a/services/api/test/functional/arvados/v1/links_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/links_controller_test.rb
@@ -306,7 +306,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
end
test "retrieve all permissions using generic links index api" do
- skip "(not implemented)"
+ omit "(not implemented)"
# Links.readable_by() does not return the full set of permission
# links that are visible to a user (i.e., all permission links
# whose head_uuid references an object for which the user has
diff --git a/services/api/test/test_helper.rb b/services/api/test/test_helper.rb
index 38aebf5..f35b5fc 100644
--- a/services/api/test/test_helper.rb
+++ b/services/api/test/test_helper.rb
@@ -113,7 +113,11 @@ class ActiveSupport::TestCase
end
def slow_test
- skip "RAILS_TEST_SHORT is set" unless (ENV['RAILS_TEST_SHORT'] || '').empty?
+ omit "RAILS_TEST_SHORT is set" if self.class.skip_slow_tests?
+ end
+
+ def self.skip_slow_tests?
+ !(ENV['RAILS_TEST_SHORT'] || '').empty?
end
end
diff --git a/services/api/test/unit/permission_test.rb b/services/api/test/unit/permission_test.rb
index 79fc1f2..dc3be0b 100644
--- a/services/api/test/unit/permission_test.rb
+++ b/services/api/test/unit/permission_test.rb
@@ -142,9 +142,8 @@ class PermissionTest < ActiveSupport::TestCase
assert test_perm.destroy, "could not delete new permission on target object"
end
- # TODO(twp): fix bug #3091, which should fix this test.
test "can_manage permission on a non-group object" do
- skip
+ omit "bug #3091"
set_user_from_auth :admin
ob = Specimen.create!
commit 8ab0c104ccacd4baf20499323bc819ac87684052
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 10 15:03:08 2016 -0400
5737: Refactor websocket test suite setup to behave well under test-unit
diff --git a/services/api/test/integration/websocket_test.rb b/services/api/test/integration/websocket_test.rb
index 99ca7ac..198ea71 100644
--- a/services/api/test/integration/websocket_test.rb
+++ b/services/api/test/integration/websocket_test.rb
@@ -1,5 +1,4 @@
require 'test_helper'
-require 'websocket_runner'
require 'oj'
require 'database_cleaner'
@@ -16,16 +15,64 @@ class WebsocketTest < ActionDispatch::IntegrationTest
DatabaseCleaner.clean
end
+ def self.startup
+ s = TCPServer.new('0.0.0.0', 0)
+ @@port = s.addr[1]
+ s.close
+ pidfile = "tmp/pids/passenger.#{@@port}.pid"
+ Dir.chdir(Rails.root) do |apidir|
+ # Only passenger seems to be able to run the websockets server
+ # successfully.
+ _system('passenger', 'start', '-d', "-p#{@@port}")
+ timeout = Time.now.tv_sec + 10
+ begin
+ sleep 0.2
+ begin
+ server_pid = IO.read(pidfile).to_i
+ good_pid = (server_pid > 0) and (Process.kill(0, pid) rescue false)
+ rescue Errno::ENOENT
+ good_pid = false
+ end
+ end while (not good_pid) and (Time.now.tv_sec < timeout)
+ if not good_pid
+ raise RuntimeError, "could not find API server Rails pid"
+ end
+ STDERR.puts "Started websocket server on @@port #{@@port} with pid #{server_pid}"
+ end
+ end
+
+ def self.shutdown
+ Dir.chdir(Rails.root) do
+ _system('passenger', 'stop', "-p#{@@port}")
+ end
+ # DatabaseCleaner leaves the database empty. Prefer to leave it full.
+ dc = DatabaseController.new
+ dc.define_singleton_method :render do |*args| end
+ dc.reset
+ end
+
+ def self._system(*cmd)
+ Bundler.with_clean_env do
+ env = {
+ 'ARVADOS_WEBSOCKETS' => 'ws-only',
+ 'RAILS_ENV' => 'test',
+ }
+ if not system(env, *cmd)
+ raise RuntimeError, "Command exited #{$?}: #{cmd.inspect}"
+ end
+ end
+ end
+
def ws_helper (token = nil, timeout = true)
opened = false
close_status = nil
too_long = false
- EM.run {
+ EM.run do
if token
- ws = Faye::WebSocket::Client.new("ws://localhost:#{WEBSOCKET_PORT}/websocket?api_token=#{api_client_authorizations(token).api_token}")
+ ws = Faye::WebSocket::Client.new("ws://localhost:#{@@port}/websocket?api_token=#{api_client_authorizations(token).api_token}")
else
- ws = Faye::WebSocket::Client.new("ws://localhost:#{WEBSOCKET_PORT}/websocket")
+ ws = Faye::WebSocket::Client.new("ws://localhost:#{@@port}/websocket")
end
ws.on :open do |event|
@@ -44,7 +91,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
yield ws
- }
+ end
assert opened, "Should have opened web socket"
assert (not too_long), "Test took too long"
diff --git a/services/api/test/test_helper.rb b/services/api/test/test_helper.rb
index 417ddf6..38aebf5 100644
--- a/services/api/test/test_helper.rb
+++ b/services/api/test/test_helper.rb
@@ -135,6 +135,21 @@ class ActionController::TestCase
super action, *args
end
end
+
+ def self.suite
+ s = super
+ def s.run(*args)
+ @test_case.startup()
+ begin
+ super
+ ensure
+ @test_case.shutdown()
+ end
+ end
+ s
+ end
+ def self.startup; end
+ def self.shutdown; end
end
class ActionDispatch::IntegrationTest
commit 98ebf95bb1232175cf97df3cfe0d36b90a667ee2
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 10 13:45:11 2016 -0400
5737: Avoid redefining recursive_hash_search() on each use
diff --git a/services/api/app/models/job.rb b/services/api/app/models/job.rb
index 30ca7f8..1c47425 100644
--- a/services/api/app/models/job.rb
+++ b/services/api/app/models/job.rb
@@ -565,24 +565,6 @@ class Job < ArvadosModel
end
def ensure_no_collection_uuids_in_script_params
- # recursive_hash_search searches recursively through hashes and
- # arrays in 'thing' for string fields matching regular expression
- # 'pattern'. Returns true if pattern is found, false otherwise.
- def recursive_hash_search thing, pattern
- if thing.is_a? Hash
- thing.each do |k, v|
- return true if recursive_hash_search v, pattern
- end
- elsif thing.is_a? Array
- thing.each do |k|
- return true if recursive_hash_search k, pattern
- end
- elsif thing.is_a? String
- return true if thing.match pattern
- end
- false
- end
-
# Fail validation if any script_parameters field includes a string containing a
# collection uuid pattern.
if self.script_parameters_changed?
@@ -593,4 +575,22 @@ class Job < ArvadosModel
end
true
end
+
+ # recursive_hash_search searches recursively through hashes and
+ # arrays in 'thing' for string fields matching regular expression
+ # 'pattern'. Returns true if pattern is found, false otherwise.
+ def recursive_hash_search thing, pattern
+ if thing.is_a? Hash
+ thing.each do |k, v|
+ return true if recursive_hash_search v, pattern
+ end
+ elsif thing.is_a? Array
+ thing.each do |k|
+ return true if recursive_hash_search k, pattern
+ end
+ elsif thing.is_a? String
+ return true if thing.match pattern
+ end
+ false
+ end
end
commit 13e418064a2a23d7c27915b2fa89c14c5e4fe9f6
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 10 11:15:35 2016 -0400
5737: Swap comparison so we get non-equal strings instead of a time parse error.
diff --git a/services/api/test/unit/job_test.rb b/services/api/test/unit/job_test.rb
index 3da2c83..2d401a3 100644
--- a/services/api/test/unit/job_test.rb
+++ b/services/api/test/unit/job_test.rb
@@ -223,7 +223,7 @@ class JobTest < ActiveSupport::TestCase
parameters.each do |parameter|
expectations = parameter[2]
- if parameter[1] == 'use_current_user_uuid'
+ if 'use_current_user_uuid' == parameter[1]
parameter[1] = Thread.current[:user].uuid
end
commit 53ca9d2906648a363ba26bffb90dfee9edfe8a4c
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 10 11:12:57 2016 -0400
5737: Update gems so tests run in Ruby >2.1
diff --git a/build/run-tests.sh b/build/run-tests.sh
index 2797ec3..ef84a2f 100755
--- a/build/run-tests.sh
+++ b/build/run-tests.sh
@@ -155,6 +155,12 @@ sanity_checks() {
echo -n 'virtualenv: '
virtualenv --version \
|| fatal "No virtualenv. Try: apt-get install virtualenv (on ubuntu: python-virtualenv)"
+ echo -n 'ruby: '
+ ruby -v \
+ || fatal "No ruby. Install >=2.1.9 (using rbenv, rvm, or source)"
+ echo -n 'bundler: '
+ bundle version \
+ || fatal "No bundler. Try: gem install bundler"
echo -n 'go: '
go version \
|| fatal "No go binary. See http://golang.org/doc/install"
diff --git a/services/api/Gemfile b/services/api/Gemfile
index 5134fc4..77605aa 100644
--- a/services/api/Gemfile
+++ b/services/api/Gemfile
@@ -9,6 +9,7 @@ group :test, :development do
gem 'factory_girl_rails'
gem 'database_cleaner'
gem 'ruby-prof'
+ gem 'test-unit', '~> 3.0'
# Note: "require: false" here tells bunder not to automatically
# 'require' the packages during application startup. Installation is
# still mandatory.
@@ -17,9 +18,7 @@ group :test, :development do
gem 'mocha', require: false
end
-# This might not be needed in :test and :development, but we load it
-# anyway to make sure it always gets in Gemfile.lock and to help
-# reveal install problems sooner rather than later.
+# pg is the only supported database driver.
gem 'pg'
# Start using multi_json once we are on Rails 3.2;
diff --git a/services/api/Gemfile.lock b/services/api/Gemfile.lock
index 1fb4369..ce31316 100644
--- a/services/api/Gemfile.lock
+++ b/services/api/Gemfile.lock
@@ -1,12 +1,12 @@
GEM
remote: https://rubygems.org/
specs:
- actionmailer (3.2.17)
- actionpack (= 3.2.17)
+ actionmailer (3.2.22.5)
+ actionpack (= 3.2.22.5)
mail (~> 2.5.4)
- actionpack (3.2.17)
- activemodel (= 3.2.17)
- activesupport (= 3.2.17)
+ actionpack (3.2.22.5)
+ activemodel (= 3.2.22.5)
+ activesupport (= 3.2.22.5)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
@@ -14,18 +14,18 @@ GEM
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
- activemodel (3.2.17)
- activesupport (= 3.2.17)
+ activemodel (3.2.22.5)
+ activesupport (= 3.2.22.5)
builder (~> 3.0.0)
- activerecord (3.2.17)
- activemodel (= 3.2.17)
- activesupport (= 3.2.17)
+ activerecord (3.2.22.5)
+ activemodel (= 3.2.22.5)
+ activesupport (= 3.2.22.5)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
- activeresource (3.2.17)
- activemodel (= 3.2.17)
- activesupport (= 3.2.17)
- activesupport (3.2.17)
+ activeresource (3.2.22.5)
+ activemodel (= 3.2.22.5)
+ activesupport (= 3.2.22.5)
+ activesupport (3.2.22.5)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
acts_as_api (0.4.2)
@@ -73,7 +73,7 @@ GEM
daemon_controller (1.2.0)
database_cleaner (1.2.0)
erubis (2.7.0)
- eventmachine (1.0.3)
+ eventmachine (1.2.0.1)
execjs (2.0.2)
extlib (0.9.16)
factory_girl (4.4.0)
@@ -124,7 +124,7 @@ GEM
mime-types (1.25.1)
mocha (1.1.0)
metaclass (~> 0.0.1)
- multi_json (1.12.0)
+ multi_json (1.12.1)
multipart-post (2.0.0)
net-scp (1.2.0)
net-ssh (>= 2.6.5)
@@ -154,32 +154,33 @@ GEM
pg_power (1.6.4)
pg
rails (~> 3.1)
- polyglot (0.3.4)
+ polyglot (0.3.5)
+ power_assert (0.2.6)
puma (2.8.2)
rack (>= 1.1, < 2.0)
- rack (1.4.5)
- rack-cache (1.2)
+ rack (1.4.7)
+ rack-cache (1.6.1)
rack (>= 0.4)
rack-ssl (1.3.4)
rack
- rack-test (0.6.2)
+ rack-test (0.6.3)
rack (>= 1.0)
- rails (3.2.17)
- actionmailer (= 3.2.17)
- actionpack (= 3.2.17)
- activerecord (= 3.2.17)
- activeresource (= 3.2.17)
- activesupport (= 3.2.17)
+ rails (3.2.22.5)
+ actionmailer (= 3.2.22.5)
+ actionpack (= 3.2.22.5)
+ activerecord (= 3.2.22.5)
+ activeresource (= 3.2.22.5)
+ activesupport (= 3.2.22.5)
bundler (~> 1.0)
- railties (= 3.2.17)
- railties (3.2.17)
- actionpack (= 3.2.17)
- activesupport (= 3.2.17)
+ railties (= 3.2.22.5)
+ railties (3.2.22.5)
+ actionpack (= 3.2.22.5)
+ activesupport (= 3.2.22.5)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
- rake (10.2.2)
+ rake (11.3.0)
rdoc (3.12.2)
json (~> 1.4)
ref (1.0.5)
@@ -204,12 +205,14 @@ GEM
simplecov-html (0.7.1)
simplecov-rcov (0.2.3)
simplecov (>= 0.4.1)
- sprockets (2.2.2)
+ sprockets (2.2.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sshkey (1.6.1)
+ test-unit (3.1.5)
+ power_assert
test_after_commit (0.2.3)
themes_for_rails (0.5.1)
rails (>= 3.0.0)
@@ -222,7 +225,7 @@ GEM
polyglot
polyglot (>= 0.3.1)
trollop (2.1.2)
- tzinfo (0.3.39)
+ tzinfo (0.3.51)
uglifier (2.5.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
@@ -261,8 +264,12 @@ DEPENDENCIES
simplecov (~> 0.7.1)
simplecov-rcov
sshkey
+ test-unit (~> 3.0)
test_after_commit
themes_for_rails
therubyracer
trollop
uglifier (>= 1.0.3)
+
+BUNDLED WITH
+ 1.13.2
diff --git a/services/api/test/websocket_runner.rb b/services/api/test/websocket_runner.rb
deleted file mode 100644
index be32a0f..0000000
--- a/services/api/test/websocket_runner.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-require 'bundler'
-require 'socket'
-
-$ARV_API_SERVER_DIR = File.expand_path('../..', __FILE__)
-
-s = TCPServer.new('0.0.0.0', 0)
-WEBSOCKET_PORT = s.addr[1]
-s.close
-SERVER_PID_PATH = "tmp/pids/passenger.#{WEBSOCKET_PORT}.pid"
-
-class WebsocketTestRunner < MiniTest::Unit
- def _system(*cmd)
- Bundler.with_clean_env do
- if not system({'ARVADOS_WEBSOCKETS' => 'ws-only', 'RAILS_ENV' => 'test'}, *cmd)
- raise RuntimeError, "Command failed with exit status #{$?}: #{cmd.inspect}"
- end
- end
- end
-
- def _run(args=[])
- server_pid = Dir.chdir($ARV_API_SERVER_DIR) do |apidir|
- # Only passenger seems to be able to run the websockets server successfully.
- _system('passenger', 'start', '-d', "-p#{WEBSOCKET_PORT}")
- timeout = Time.now.tv_sec + 10
- begin
- sleep 0.2
- begin
- server_pid = IO.read(SERVER_PID_PATH).to_i
- good_pid = (server_pid > 0) and (Process.kill(0, pid) rescue false)
- rescue Errno::ENOENT
- good_pid = false
- end
- end while (not good_pid) and (Time.now.tv_sec < timeout)
- if not good_pid
- raise RuntimeError, "could not find API server Rails pid"
- end
- server_pid
- end
- begin
- super(args)
- ensure
- Dir.chdir($ARV_API_SERVER_DIR) do
- _system('passenger', 'stop', "-p#{WEBSOCKET_PORT}")
- end
- # DatabaseCleaner leaves the database empty. Prefer to leave it full.
- dc = DatabaseController.new
- dc.define_singleton_method :render do |*args| end
- dc.reset
- end
- end
-end
-
-MiniTest::Unit.runner = WebsocketTestRunner.new
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list