11590: Add container logging tests.
authorTom Clegg <tom@curoverse.com>
Thu, 18 May 2017 18:53:38 +0000 (14:53 -0400)
committerTom Clegg <tom@curoverse.com>
Thu, 18 May 2017 18:53:38 +0000 (14:53 -0400)
services/api/test/unit/container_test.rb

index 9a859c622997151da334147581186ff462cf7722..9dbd56947577bbea7135b7942f18b2b277464354 100644 (file)
@@ -340,6 +340,19 @@ class ContainerTest < ActiveSupport::TestCase
     assert_nil reused
   end
 
+  test "find_reusable with logging disabled" do
+    set_user_from_auth :active
+    Rails.logger.expects(:info).never
+    Container.find_reusable(REUSABLE_COMMON_ATTRS)
+  end
+
+  test "find_reusable with logging enabled" do
+    set_user_from_auth :active
+    Rails.configuration.log_reuse_decisions = true
+    Rails.logger.expects(:info).at_least(3)
+    Container.find_reusable(REUSABLE_COMMON_ATTRS)
+  end
+
   test "Container running" do
     c, _ = minimal_new priority: 1