X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/fd38b59aac9b4453cf04fb7d6e1b8ad51549d6c3..38a0f5e77f2190487d03d6538337d3b7055fd1e8:/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 5f17efc445..35e2b7ed1d 100644 --- a/services/api/test/unit/container_test.rb +++ b/services/api/test/unit/container_test.rb @@ -23,6 +23,8 @@ class ContainerTest < ActiveSupport::TestCase command: ["echo", "hello"], output_path: "test", runtime_constraints: { + "API" => false, + "keep_cache_ram" => 0, "ram" => 12000000000, "vcpus" => 4, }, @@ -227,11 +229,12 @@ class ContainerTest < ActiveSupport::TestCase set_user_from_auth :active env = {"C" => "3", "B" => "2", "A" => "1"} m = {"F" => {"kind" => "3"}, "E" => {"kind" => "2"}, "D" => {"kind" => "1"}} - rc = {"vcpus" => 1, "ram" => 1, "keep_cache_ram" => 1} + rc = {"vcpus" => 1, "ram" => 1, "keep_cache_ram" => 1, "API" => true} c, _ = minimal_new(environment: env, mounts: m, runtime_constraints: rc) - assert_equal c.environment.to_json, Container.deep_sort_hash(env).to_json - assert_equal c.mounts.to_json, Container.deep_sort_hash(m).to_json - assert_equal c.runtime_constraints.to_json, Container.deep_sort_hash(rc).to_json + c.reload + assert_equal Container.deep_sort_hash(env).to_json, c.environment.to_json + assert_equal Container.deep_sort_hash(m).to_json, c.mounts.to_json + assert_equal Container.deep_sort_hash(rc).to_json, c.runtime_constraints.to_json end test 'deep_sort_hash on array of hashes' do @@ -561,6 +564,7 @@ class ContainerTest < ActiveSupport::TestCase assert_equal Container::Queued, c1.state reused = Container.find_reusable(common_attrs.merge(runtime_token_attr(:container_runtime_token))) # See #14584 + assert_not_nil reused assert_equal c1.uuid, reused.uuid end @@ -571,6 +575,7 @@ class ContainerTest < ActiveSupport::TestCase assert_equal Container::Queued, c1.state reused = Container.find_reusable(common_attrs.merge(runtime_token_attr(:container_runtime_token))) # See #14584 + assert_not_nil reused assert_equal c1.uuid, reused.uuid end @@ -581,6 +586,7 @@ class ContainerTest < ActiveSupport::TestCase assert_equal Container::Queued, c1.state reused = Container.find_reusable(common_attrs.merge(runtime_token_attr(:container_runtime_token))) # See #14584 + assert_not_nil reused assert_equal c1.uuid, reused.uuid end @@ -663,6 +669,8 @@ class ContainerTest < ActiveSupport::TestCase auth_exp = ApiClientAuthorization.find_by_uuid(auth_uuid_was).expires_at assert_operator auth_exp, :<, db_current_time + + assert_nil ApiClientAuthorization.validate(token: ApiClientAuthorization.find_by_uuid(auth_uuid_was).token) end test "Exceed maximum lock-unlock cycles" do @@ -795,6 +803,8 @@ class ContainerTest < ActiveSupport::TestCase [Container::Running, {priority: 123456789}], [Container::Running, {runtime_status: {'error' => 'oops'}}], [Container::Running, {cwd: '/'}], + [Container::Running, {gateway_address: "172.16.0.1:12345"}], + [Container::Running, {interactive_session_started: true}], [Container::Complete, {state: Container::Cancelled}], [Container::Complete, {priority: 123456789}], [Container::Complete, {runtime_status: {'error' => 'oops'}}],