[ARVADOS] updated: b0993528fa57bb1866bbd6a2b19822cc75010a66
Git user
git at public.curoverse.com
Tue Aug 2 09:30:07 EDT 2016
Summary of changes:
services/api/test/unit/container_request_test.rb | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
via b0993528fa57bb1866bbd6a2b19822cc75010a66 (commit)
from b6a922bd21b2c9da8861de4c84c2a2ab25666ef2 (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 b0993528fa57bb1866bbd6a2b19822cc75010a66
Author: Lucas Di Pentima <lucas at curoverse.com>
Date: Tue Aug 2 10:28:57 2016 -0300
9617: Added one more invalid constraint case to the tests, also check for container_uuid on successful test
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index 648b92d..4db7b18 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -55,25 +55,27 @@ 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
[{"vcpus" => 1},
{"vcpus" => 1, "ram" => nil},
- {"vcpus" => 0, "ram" => 123}].each do |invalid_constraint|
+ {"vcpus" => 0, "ram" => 123},
+ {"vcpus" => "1", "ram" => "123"}].each do |invalid_constraint|
assert_raises(ActiveRecord::RecordInvalid) do
- cr = create_minimal_req!(state: "Committed", priority: 1,
+ cr = create_minimal_req!(state: "Committed",
+ priority: 1,
runtime_constraints: invalid_constraint)
cr.save!
end
end
- cr = create_minimal_req!(state: "Committed", priority: 1)
- cr.save!
+
# Validations on update
cr = create_minimal_req!(state: "Uncommitted", priority: 1)
cr.save!
-
[{"vcpus" => 1},
{"vcpus" => 1, "ram" => nil},
- {"vcpus" => 0, "ram" => 123}].each do |invalid_constraint|
+ {"vcpus" => 0, "ram" => 123},
+ {"vcpus" => "1", "ram" => "123"}].each do |invalid_constraint|
cr = ContainerRequest.find_by_uuid cr.uuid
assert_raises(ActiveRecord::RecordInvalid) do
cr.update_attributes!(state: "Committed",
@@ -85,6 +87,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
cr.update_attributes!(state: "Committed",
runtime_constraints: {"vcpus" => 1, "ram" => 23})
cr.save!
+ assert_not_nil cr.container_uuid
end
test "Container request priority must be non-nil" do
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list