integrate cassandra to run in a parallel test environment
Change-Id: Ic04ee524be774f89aba0b3c0186dc970cde3c329 Reviewed-on: https://gerrit.instructure.com/15640 Reviewed-by: Bryan Madsen <bryan@instructure.com> QA-Review: Bryan Madsen <bryan@instructure.com> Tested-by: Jenkins <jenkins@instructure.com>
This commit is contained in:
parent
cf16537d09
commit
73a7b27c2f
2
Gemfile
2
Gemfile
|
@ -90,7 +90,7 @@ group :test do
|
|||
gem 'coffee-script-source', '1.3.1' #pinned so everyone's compiled output matches
|
||||
gem 'bluecloth', '2.0.10' # for generating api docs
|
||||
gem 'parallel', '0.5.16'
|
||||
gem 'parallelized_specs', '0.3.38'
|
||||
gem 'parallelized_specs', '0.3.54'
|
||||
gem 'mocha', '0.12.3', :require => 'mocha_standalone'
|
||||
gem 'rcov', '0.9.9'
|
||||
gem 'rspec', '1.3.2'
|
||||
|
|
|
@ -31,8 +31,14 @@ module Canvas::Cassandra
|
|||
servers = Array(config['servers'])
|
||||
raise "No Cassandra servers defined for: #{config_name.inspect}" unless servers.present?
|
||||
keyspace = config['keyspace']
|
||||
keyspace = "#{keyspace}#{ENV['TEST_ENV_NUMBER']}" if Rails.env.test?
|
||||
raise "No keyspace specified for: #{config_name.inspect}" unless keyspace.present?
|
||||
self.new(servers, keyspace)
|
||||
opts = {:keyspace => keyspace, :cql_version => '3.0.0'}
|
||||
thrift_opts = {}
|
||||
thrift_opts[:retries] = config['retries'] if config['retries']
|
||||
thrift_opts[:connect_timeout] = config['connect_timeout'] if config['connect_timeout']
|
||||
thrift_opts[:timeout] = config['timeout'] if config['timeout']
|
||||
self.new(servers, opts, thrift_opts)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -40,9 +46,9 @@ module Canvas::Cassandra
|
|||
Setting.from_config('cassandra').try(:keys) || []
|
||||
end
|
||||
|
||||
def initialize(servers, keyspace)
|
||||
def initialize(servers, opts, thrift_opts)
|
||||
Bundler.require 'cassandra'
|
||||
@db = CassandraCQL::Database.new(servers, :keyspace => keyspace, :cql_version => '3.0.0')
|
||||
@db = CassandraCQL::Database.new(servers, opts, thrift_opts)
|
||||
end
|
||||
|
||||
attr_reader :db
|
||||
|
|
Loading…
Reference in New Issue