projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
8128: De-dup container unit tests
[arvados.git]
/
services
/
api
/
test
/
unit
/
container_test.rb
diff --git
a/services/api/test/unit/container_test.rb
b/services/api/test/unit/container_test.rb
index 0cac6acd936332eaa3b76eb28fad3c84479b1f5a..a25f2af46781668786cae56f666147165b4ddb6c 100644
(file)
--- a/
services/api/test/unit/container_test.rb
+++ b/
services/api/test/unit/container_test.rb
@@
-1,6
+1,14
@@
require 'test_helper'
class ContainerTest < ActiveSupport::TestCase
require 'test_helper'
class ContainerTest < ActiveSupport::TestCase
+ def minimal_new
+ c = Container.new
+ c.command = ["echo", "foo"]
+ c.container_image = "img"
+ c.output_path = "/tmp"
+ c
+ end
+
def check_illegal_modify c
c.reload
c.command = ["echo", "bar"]
def check_illegal_modify c
c.reload
c.command = ["echo", "bar"]
@@
-90,10
+98,7
@@
class ContainerTest < ActiveSupport::TestCase
test "Container create" do
act_as_system_user do
test "Container create" do
act_as_system_user do
- c = Container.new
- c.command = ["echo", "foo"]
- c.container_image = "img"
- c.cwd = "/tmp"
+ c = minimal_new
c.environment = {}
c.mounts = {"BAR" => "FOO"}
c.output_path = "/tmp"
c.environment = {}
c.mounts = {"BAR" => "FOO"}
c.output_path = "/tmp"
@@
-112,10
+117,7
@@
class ContainerTest < ActiveSupport::TestCase
test "Container running" do
act_as_system_user do
test "Container running" do
act_as_system_user do
- c = Container.new
- c.command = ["echo", "foo"]
- c.container_image = "img"
- c.output_path = "/tmp"
+ c = minimal_new
c.save!
c.reload
c.save!
c.reload
@@
-145,10
+147,7
@@
class ContainerTest < ActiveSupport::TestCase
test "Container queued cancel" do
act_as_system_user do
test "Container queued cancel" do
act_as_system_user do
- c = Container.new
- c.command = ["echo", "foo"]
- c.container_image = "img"
- c.output_path = "/tmp"
+ c = minimal_new
c.save!
c.reload
c.save!
c.reload
@@
-161,10
+160,7
@@
class ContainerTest < ActiveSupport::TestCase
test "Container running cancel" do
act_as_system_user do
test "Container running cancel" do
act_as_system_user do
- c = Container.new
- c.command = ["echo", "foo"]
- c.container_image = "img"
- c.output_path = "/tmp"
+ c = minimal_new
c.save!
c.reload
c.save!
c.reload
@@
-181,10
+177,7
@@
class ContainerTest < ActiveSupport::TestCase
test "Container create forbidden for non-admin" do
set_user_from_auth :active_trustedclient
test "Container create forbidden for non-admin" do
set_user_from_auth :active_trustedclient
- c = Container.new
- c.command = ["echo", "foo"]
- c.container_image = "img"
- c.cwd = "/tmp"
+ c = minimal_new
c.environment = {}
c.mounts = {"BAR" => "FOO"}
c.output_path = "/tmp"
c.environment = {}
c.mounts = {"BAR" => "FOO"}
c.output_path = "/tmp"
@@
-197,10
+190,7
@@
class ContainerTest < ActiveSupport::TestCase
test "Container only set exit code on complete" do
act_as_system_user do
test "Container only set exit code on complete" do
act_as_system_user do
- c = Container.new
- c.command = ["echo", "foo"]
- c.container_image = "img"
- c.output_path = "/tmp"
+ c = minimal_new
c.save!
c.reload
c.save!
c.reload