[ARVADOS] created: 703b780005538de9edc94e643267f5f20cc320ce
Git user
git at public.curoverse.com
Wed Jan 11 16:28:39 EST 2017
at 703b780005538de9edc94e643267f5f20cc320ce (commit)
commit 703b780005538de9edc94e643267f5f20cc320ce
Author: radhika <radhika at curoverse.com>
Date: Wed Jan 4 06:19:57 2017 -0500
10705: container_request unlock method is no-op if object state is Queued.
diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb
index 7731a8d..34ed642 100644
--- a/services/api/app/models/container.rb
+++ b/services/api/app/models/container.rb
@@ -147,9 +147,7 @@ class Container < ArvadosModel
def unlock
with_lock do
- if self.state == Queued
- raise InvalidStateTransitionError
- end
+ return if self.state == Queued
self.state = Queued
self.save!
end
diff --git a/services/api/test/functional/arvados/v1/containers_controller_test.rb b/services/api/test/functional/arvados/v1/containers_controller_test.rb
index 65a1a91..be7b3d1 100644
--- a/services/api/test/functional/arvados/v1/containers_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/containers_controller_test.rb
@@ -74,7 +74,7 @@ class Arvados::V1::ContainersControllerTest < ActionController::TestCase
[
[:queued, :lock, :success, 'Locked'],
- [:queued, :unlock, 422, 'Queued'],
+ [:queued, :unlock, :success, 'Queued'],
[:locked, :lock, 422, 'Locked'],
[:running, :lock, 422, 'Running'],
[:running, :unlock, 422, 'Running'],
diff --git a/services/api/test/unit/container_test.rb b/services/api/test/unit/container_test.rb
index a175533..15136c1 100644
--- a/services/api/test/unit/container_test.rb
+++ b/services/api/test/unit/container_test.rb
@@ -374,6 +374,8 @@ class ContainerTest < ActiveSupport::TestCase
refute c.locked_by_uuid
refute c.auth_uuid
+ assert_nothing_raised {c.unlock}
+
refute c.update_attributes(state: Container::Running), "not locked"
c.reload
refute c.locked_by_uuid
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list