diff --git a/lib/tasks/test_api.rake b/lib/tasks/test_api.rake index 20053ff..5a1d2f8 100644 --- a/lib/tasks/test_api.rake +++ b/lib/tasks/test_api.rake @@ -501,11 +501,13 @@ namespace :test_api do if misses + hits != yesterday_appearances error_message += "Error! Question #{question.id} isn't tracking prompt cache hits and misses accurately! Expected #{yesterday_appearances}, Actual: #{misses+hits}\n" end - - miss_rate = misses.to_f / yesterday_appearances.to_f - if miss_rate > 0.1 + + if yesterday_appearances > 5 # this test isn't worthwhile for small numbers of appearances + miss_rate = misses.to_f / yesterday_appearances.to_f + if miss_rate > 0.1 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" - end + end + end return error_message.blank? ? [success_message, false] : [error_message, true] end -- libgit2 0.21.2