spec: don't truncate cassandra in tests

Turns out that truncate is a super slow operation in Cassandra. For the
tests that this affects, we'll handle the potentially non-empty db.

Change-Id: Ie7e64add3b53f26eb98ba441e46270a8c08657ea
Reviewed-on: https://gerrit.instructure.com/36593
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Shawn Meredith <shawn@instructure.com>
QA-Review: Shawn Meredith <shawn@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
This commit is contained in:
Brian Palmer 2014-06-18 08:47:31 -06:00
parent 298a1a5242
commit b2dbb1c868
2 changed files with 1 additions and 10 deletions

View File

@ -28,6 +28,7 @@ module DataFixup::FilterPageViewUrlParams
rows = get_rows(last_request_id, batch_size) rows = get_rows(last_request_id, batch_size)
break if rows.empty? break if rows.empty?
rows.each do |pv| rows.each do |pv|
next if !pv.url
pv.url = LoggingFilter.filter_uri(pv.url) pv.url = LoggingFilter.filter_uri(pv.url)
PageView::EventStream.update(pv) if pv.url_changed? PageView::EventStream.update(pv) if pv.url_changed?
end end

View File

@ -277,15 +277,6 @@ def truncate_all_tables
end end
end end
def truncate_all_cassandra_tables
Canvas::Cassandra::DatabaseBuilder.config_names.each do |cass_config|
db = Canvas::Cassandra::DatabaseBuilder.from_config(cass_config)
db.tables.each do |table|
db.execute("TRUNCATE #{table}")
end
end
end
# wipe out the test db, in case some non-transactional tests crapped out before # wipe out the test db, in case some non-transactional tests crapped out before
# cleaning up after themselves # cleaning up after themselves
truncate_all_tables truncate_all_tables
@ -440,7 +431,6 @@ end
Attachment.clear_cached_mime_ids Attachment.clear_cached_mime_ids
RoleOverride.clear_cached_contexts RoleOverride.clear_cached_contexts
Delayed::Job.redis.flushdb if Delayed::Job == Delayed::Backend::Redis::Job Delayed::Job.redis.flushdb if Delayed::Job == Delayed::Backend::Redis::Job
#truncate_all_cassandra_tables
Rails::logger.try(:info, "Running #{self.class.description} #{@method_name}") Rails::logger.try(:info, "Running #{self.class.description} #{@method_name}")
Attachment.domain_namespace = nil Attachment.domain_namespace = nil
end end