Commit a3ff7e4b2a6250355a627c1c8e24dae3212a9a6f
1 parent
e6b5fe35
Exists in
master
and in
1 other branch
Tweaking api tests
Showing
3 changed files
with
15 additions
and
5 deletions
Show diff stats
config/environment.rb
| @@ -12,8 +12,8 @@ Rails::Initializer.run do |config| | @@ -12,8 +12,8 @@ Rails::Initializer.run do |config| | ||
| 12 | #config.time_zone = 'Eastern Time (US & Canada)' | 12 | #config.time_zone = 'Eastern Time (US & Canada)' |
| 13 | 13 | ||
| 14 | config.active_record.default_timezone = 'Eastern Time (US & Canada)' | 14 | config.active_record.default_timezone = 'Eastern Time (US & Canada)' |
| 15 | - #config.action_mailer.delivery_method = :smtp | ||
| 16 | - config.action_mailer.delivery_method = :sendmail | 15 | + config.action_mailer.delivery_method = :smtp |
| 16 | + #config.action_mailer.delivery_method = :sendmail | ||
| 17 | 17 | ||
| 18 | config.gem 'hoptoad_notifier', | 18 | config.gem 'hoptoad_notifier', |
| 19 | :version => '2.3.4' | 19 | :version => '2.3.4' |
config/initializers/mail.rb
| @@ -13,5 +13,5 @@ ActionMailer::Base.smtp_settings = { | @@ -13,5 +13,5 @@ ActionMailer::Base.smtp_settings = { | ||
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | DO_NOT_REPLY = "donotreply@example.com" | 15 | DO_NOT_REPLY = "donotreply@example.com" |
| 16 | -CRON_EMAIL = "cron@allourideas.org" | 16 | +CRON_EMAIL = ["cron@allourideas.org", 'aoi_cron@dkapadia.com', 'matt@allourideasorg'] |
| 17 | ERRORS_EMAIL = "errors@allourideas.org" | 17 | ERRORS_EMAIL = "errors@allourideas.org" |
lib/tasks/test_api.rake
| @@ -398,6 +398,16 @@ namespace :test_api do | @@ -398,6 +398,16 @@ namespace :test_api do | ||
| 398 | 398 | ||
| 399 | end | 399 | end |
| 400 | 400 | ||
| 401 | + if (choice.wins != choice.votes.count) | ||
| 402 | + error_message += "Error!: Cached choice wins != actual choice wins" | ||
| 403 | + error_bool= true | ||
| 404 | + end | ||
| 405 | + | ||
| 406 | + if (choice.losses != question.votes.count(:conditions => {:loser_choice_id})) | ||
| 407 | + error_message += "Error!: Cached choice wins != actual choice wins" | ||
| 408 | + error_bool= true | ||
| 409 | + end | ||
| 410 | + | ||
| 401 | if (2*total_wins != total_votes) | 411 | if (2*total_wins != total_votes) |
| 402 | error_message += "Error 1: 2 x Total Wins != Total votes" | 412 | error_message += "Error 1: 2 x Total Wins != Total votes" |
| 403 | error_bool= true | 413 | error_bool= true |
| @@ -505,7 +515,7 @@ namespace :test_api do | @@ -505,7 +515,7 @@ namespace :test_api do | ||
| 505 | if yesterday_appearances > 5 # this test isn't worthwhile for small numbers of appearances | 515 | if yesterday_appearances > 5 # this test isn't worthwhile for small numbers of appearances |
| 506 | miss_rate = misses.to_f / yesterday_appearances.to_f | 516 | miss_rate = misses.to_f / yesterday_appearances.to_f |
| 507 | if miss_rate > 0.1 | 517 | if miss_rate > 0.1 |
| 508 | - error_message += "Error! Question #{question.id} has less than 90% of appearances taken from a pre-generated cache! Expected <#{0.1}, Actual: #{miss_rate}, total appearances yesterday: #{yesterday_appearances}\n" | 518 | + error_message += "Warning! Question #{question.id} has less than 90% of appearances taken from a pre-generated cache! Expected <#{0.1}, Actual: #{miss_rate}, total appearances yesterday: #{yesterday_appearances}\n" |
| 509 | end | 519 | end |
| 510 | end | 520 | end |
| 511 | return error_message.blank? ? [success_message, false] : [error_message, true] | 521 | return error_message.blank? ? [success_message, false] : [error_message, true] |
| @@ -576,7 +586,7 @@ namespace :test_api do | @@ -576,7 +586,7 @@ namespace :test_api do | ||
| 576 | end | 586 | end |
| 577 | 587 | ||
| 578 | if v.time_viewed && v.time_viewed/1000 > server_response_time | 588 | if v.time_viewed && v.time_viewed/1000 > server_response_time |
| 579 | - the_error_msg = "Error! Vote #{v.id} with Appearance #{v.appearance.id}, has a longer client response time than is possible. Server roundtrip time is: #{v.created_at.to_f - v.appearance.created_at.to_f} seconds, but client side response time is: #{v.time_viewed.to_f / 1000.0} seconds\n" | 589 | + the_error_msg = "Warning! Vote #{v.id} with Appearance #{v.appearance.id}, has a longer client response time than is possible. Server roundtrip time is: #{v.created_at.to_f - v.appearance.created_at.to_f} seconds, but client side response time is: #{v.time_viewed.to_f / 1000.0} seconds\n" |
| 580 | 590 | ||
| 581 | error_message += the_error_msg | 591 | error_message += the_error_msg |
| 582 | print the_error_msg | 592 | print the_error_msg |