[ARVADOS] updated: 97c669426fd4a086883d1cf666043af17f99f758

Git user git at public.curoverse.com
Mon Aug 1 15:45:09 EDT 2016


Summary of changes:
 services/api/test/unit/container_request_test.rb | 38 ++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

       via  97c669426fd4a086883d1cf666043af17f99f758 (commit)
      from  b7f8614e177be3fb989f5ddf17ba474492d19af1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 97c669426fd4a086883d1cf666043af17f99f758
Author: Lucas Di Pentima <lucas at curoverse.com>
Date:   Mon Aug 1 16:44:16 2016 -0300

    9617: Added validations on updates & tests on sucessful cases.

diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index 1156979..2096170 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -55,19 +55,57 @@ class ContainerRequestTest < ActiveSupport::TestCase
 
   test "Container request constraints must include valid vcpus and ram fields when committed" do
     set_user_from_auth :active
+    # Validations on creation
+    assert_raises(ActiveRecord::RecordInvalid) do
+      cr = create_minimal_req!(state: "Committed", priority: 1,
+                               runtime_constraints: {"vcpus" => 1})
+      cr.save!
+    end
+    assert_raises(ActiveRecord::RecordInvalid) do
+      cr = create_minimal_req!(state: "Committed", priority: 1,
+                               runtime_constraints: {"vcpus" => 1,
+                                                     "ram" => nil})
+      cr.save!
+    end
+    assert_raises(ActiveRecord::RecordInvalid) do
+      cr = create_minimal_req!(state: "Committed", priority: 1,
+                               runtime_constraints: {"vcpus" => 0,
+                                                     "ram" => 123})
+      cr.save!
+    end
     cr = create_minimal_req!(state: "Committed", priority: 1)
+    cr.save!
+
+    # Validations on update
+    cr = create_minimal_req!(state: "Uncommitted", priority: 1)
+    cr.save!
+    cr.state = "Committed"
     assert_raises(ActiveRecord::RecordInvalid) do
       cr.runtime_constraints = {"vcpus" => 1}
       cr.save!
     end
+
+    cr = create_minimal_req!(state: "Uncommitted", priority: 1)
+    cr.save!
+    cr.state = "Committed"
     assert_raises(ActiveRecord::RecordInvalid) do
       cr.runtime_constraints = {"vcpus" => 1, "ram" => nil}
       cr.save!
     end
+
+    cr = create_minimal_req!(state: "Uncommitted", priority: 1)
+    cr.save!
+    cr.state = "Committed"
     assert_raises(ActiveRecord::RecordInvalid) do
       cr.runtime_constraints = {"vcpus" => 0, "ram" => 123}
       cr.save!
     end
+
+    cr = create_minimal_req!(state: "Uncommitted", priority: 1)
+    cr.save!
+    cr.state = "Committed"
+    cr.runtime_constraints = {"vcpus" => 1, "ram" => 23}
+    cr.save!
   end
 
   test "Container request priority must be non-nil" do

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list