Skip to content

Commit 48e7ef2

Browse files
committed
Stop swallowing errors from tasks
We have had lots of intermittent test failures on these tasks. These tasks are all swallowing their errors which makes it difficult to debug. We could make the tests output the rails log to standard out or make the log available after but this will make the output hard to match up to the individual test. Generally we shouldn't swallow errors like this as it makes it difficult to debug and easy for tests to pass for the wrong reasons. The transaction will work as before as any error raised in a transaction will call a rollback.
1 parent a35c7fe commit 48e7ef2

2 files changed

Lines changed: 0 additions & 19 deletions

File tree

lib/tasks/for_education.rake

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ namespace :for_education do
4141
School.find(school_id).destroy
4242

4343
Rails.logger.info 'Done...'
44-
rescue StandardError => e
45-
Rails.logger.error "Failed: #{e.message}"
46-
raise ActiveRecord::Rollback
4744
end
4845
end
4946

@@ -60,9 +57,6 @@ namespace :for_education do
6057
create_school(creator_id, TEST_SCHOOL)
6158

6259
Rails.logger.info 'Done...'
63-
rescue StandardError => e
64-
Rails.logger.error "Failed: #{e.message}"
65-
raise ActiveRecord::Rollback
6660
end
6761
end
6862

@@ -80,9 +74,6 @@ namespace :for_education do
8074
school = create_school(creator_id, TEST_SCHOOL)
8175
verify_school(school)
8276
Rails.logger.info 'Done...'
83-
rescue StandardError => e
84-
Rails.logger.error "Failed: #{e.message}"
85-
raise ActiveRecord::Rollback
8677
end
8778
end
8879

@@ -110,9 +101,6 @@ namespace :for_education do
110101
create_project(creator_id, school, lesson)
111102
end
112103
Rails.logger.info 'Done...'
113-
rescue StandardError => e
114-
Rails.logger.error "Failed: #{e.message}"
115-
raise ActiveRecord::Rollback
116104
end
117105
end
118106
end

lib/tasks/test_seeds.rake

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ namespace :test_seeds do
3939
School.where(id: school_ids).destroy_all
4040

4141
Rails.logger.info 'Done...'
42-
rescue StandardError => e
43-
pp "Failed: #{e.message}"
44-
Rails.logger.error "Failed: #{e.message}"
45-
raise ActiveRecord::Rollback
4642
end
4743
end
4844

@@ -74,9 +70,6 @@ namespace :test_seeds do
7470
end
7571
end
7672
Rails.logger.info 'Done...'
77-
rescue StandardError => e
78-
Rails.logger.error "Failed: #{e.message}"
79-
raise ActiveRecord::Rollback
8073
end
8174
end
8275
end

0 commit comments

Comments
 (0)