[ARVADOS] updated: fbb6cc64c687a92ef3598c2cce9ef7a2d54e777f

Git user git at public.curoverse.com
Fri Aug 26 21:46:24 EDT 2016


Summary of changes:
 apps/workbench/Gemfile                             |   5 +
 apps/workbench/Gemfile.lock                        |  12 ++
 .../app/controllers/collections_controller.rb      |   7 -
 .../controllers/work_unit_templates_controller.rb  |  30 ++++
 .../app/controllers/work_units_controller.rb       |  77 +++++++++++
 .../app/controllers/workflows_controller.rb        |   2 +
 apps/workbench/app/models/container_work_unit.rb   |   7 +
 .../app/models/pipeline_instance_work_unit.rb      |   4 +
 apps/workbench/app/models/work_unit.rb             |   4 +
 .../app/models/{specimen.rb => workflow.rb}        |   2 +-
 .../_choose_rows.html.erb                          |   0
 apps/workbench/app/views/collections/show.html.erb |  40 +-----
 .../app/views/projects/_show_dashboard.html.erb    |   8 +-
 apps/workbench/app/views/projects/show.html.erb    |  10 +-
 .../views/workflows/_show_chooser_preview.html.erb |   3 +
 apps/workbench/config/initializers/lograge.rb      |  14 ++
 apps/workbench/config/load_config.rb               |   2 +-
 apps/workbench/config/routes.rb                    |   4 +
 .../controllers/collections_controller_test.rb     |   7 -
 .../test/controllers/workflows_controller_test.rb  |   9 ++
 .../test/integration/application_layout_test.rb    |  25 ++++
 apps/workbench/test/integration/projects_test.rb   |  23 ++++
 .../collections_perf_test.rb                       |   4 +-
 build/go-package-scripts/postinst                  |  31 +++++
 build/go-package-scripts/prerm                     |  19 +++
 build/run-build-docker-images.sh                   |   8 +-
 build/run-library.sh                               |  13 +-
 doc/_config.yml                                    |   6 +
 doc/_includes/_install_compute_docker.liquid       |  45 ++++++
 doc/_includes/_install_compute_fuse.liquid         |  17 +++
 doc/_includes/_install_docker_cleaner.liquid       |  41 ++++++
 .../install-compute-node.html.textile.liquid       |  39 ++++++
 .../install-dispatch.html.textile.liquid           | 114 +++++++++++++++
 .../install-prerequisites.html.textile.liquid      |   9 ++
 .../crunch2-slurm/install-test.html.textile.liquid | 109 +++++++++++++++
 .../install-compute-node.html.textile.liquid       |  82 +----------
 sdk/cwl/arvados_cwl/__init__.py                    |  50 +++++--
 sdk/cwl/test_with_arvbox.sh                        |   4 +-
 services/api/Gemfile                               |   3 +
 services/api/Gemfile.lock                          |   9 ++
 .../app/controllers/arvados/v1/jobs_controller.rb  | 153 +++++++++++----------
 .../controllers/arvados/v1/workflows_controller.rb |   2 +
 .../api/app/models/api_client_authorization.rb     |   4 +-
 services/api/app/models/arvados_model.rb           |  28 ++--
 services/api/app/models/collection.rb              |  10 +-
 services/api/app/models/container.rb               |  11 ++
 services/api/app/models/job.rb                     |  20 +++
 services/api/app/models/log.rb                     |  12 ++
 services/api/app/models/workflow.rb                |  42 ++++++
 services/api/config/application.default.yml        |   8 ++
 services/api/config/initializers/load_config.rb    |   2 +-
 services/api/config/initializers/lograge.rb        |  14 ++
 services/api/config/routes.rb                      |   1 +
 .../db/migrate/20160808151559_create_workflows.rb  |  30 ++++
 ...9195557_add_script_parameters_digest_to_jobs.rb |   6 +
 ...0819195725_populate_script_parameters_digest.rb |  21 +++
 services/api/db/structure.sql                      | 101 +++++++++++++-
 services/api/lib/eventbus.rb                       |   2 +-
 services/api/test/fixtures/container_requests.yml  |   2 +-
 services/api/test/fixtures/containers.yml          |  19 ++-
 services/api/test/fixtures/jobs.yml                |  28 ++++
 services/api/test/fixtures/logs.yml                |   4 +-
 services/api/test/fixtures/workflows.yml           |  46 +++++++
 .../arvados/v1/job_reuse_controller_test.rb        |   4 +-
 services/api/test/unit/container_request_test.rb   |   6 +
 services/api/test/unit/job_test.rb                 |  16 +++
 services/api/test/unit/log_test.rb                 |  40 +++++-
 services/api/test/unit/permission_test.rb          |  23 ++++
 services/api/test/unit/workflow_test.rb            | 125 +++++++++++++++++
 .../crunch-dispatch-slurm/crunch-dispatch-slurm.go |   7 +-
 .../crunch-dispatch-slurm.service                  |  12 ++
 71 files changed, 1420 insertions(+), 277 deletions(-)
 create mode 100644 apps/workbench/app/controllers/work_unit_templates_controller.rb
 create mode 100644 apps/workbench/app/controllers/workflows_controller.rb
 copy apps/workbench/app/models/{specimen.rb => workflow.rb} (62%)
 copy apps/workbench/app/views/{pipeline_templates => application}/_choose_rows.html.erb (100%)
 create mode 100644 apps/workbench/app/views/workflows/_show_chooser_preview.html.erb
 create mode 100644 apps/workbench/config/initializers/lograge.rb
 create mode 100644 apps/workbench/test/controllers/workflows_controller_test.rb
 create mode 100755 build/go-package-scripts/postinst
 create mode 100755 build/go-package-scripts/prerm
 create mode 100644 doc/_includes/_install_compute_docker.liquid
 create mode 100644 doc/_includes/_install_compute_fuse.liquid
 create mode 100644 doc/_includes/_install_docker_cleaner.liquid
 create mode 100644 doc/install/crunch2-slurm/install-compute-node.html.textile.liquid
 create mode 100644 doc/install/crunch2-slurm/install-dispatch.html.textile.liquid
 create mode 100644 doc/install/crunch2-slurm/install-prerequisites.html.textile.liquid
 create mode 100644 doc/install/crunch2-slurm/install-test.html.textile.liquid
 create mode 100644 services/api/app/controllers/arvados/v1/workflows_controller.rb
 create mode 100644 services/api/app/models/workflow.rb
 create mode 100644 services/api/config/initializers/lograge.rb
 create mode 100644 services/api/db/migrate/20160808151559_create_workflows.rb
 create mode 100644 services/api/db/migrate/20160819195557_add_script_parameters_digest_to_jobs.rb
 create mode 100644 services/api/db/migrate/20160819195725_populate_script_parameters_digest.rb
 create mode 100644 services/api/test/fixtures/workflows.yml
 create mode 100644 services/api/test/unit/workflow_test.rb
 create mode 100644 services/crunch-dispatch-slurm/crunch-dispatch-slurm.service

  discards  4c4a74d1f077945376a2d3bbbdc5f2eebc2f8de2 (commit)
  discards  f9a00e30a8461c52791481d3ffa9d73b7507f654 (commit)
       via  fbb6cc64c687a92ef3598c2cce9ef7a2d54e777f (commit)
       via  c668c6b1204c4a388f6250c8ecc71679ae984145 (commit)
       via  f06b652091ba857dc844c63fc55745d2117c2577 (commit)
       via  0574ef526196c291dc7dd9f9c8a6d6ac31008126 (commit)
       via  845c28dcd5b6bf60875af12037887e7d7f1838ab (commit)
       via  5664fc03a410be5abad40afbcb27450719499950 (commit)
       via  ca8cd8c34d7feea9a81c4baca470f2fe0d6a1853 (commit)
       via  7213d3096cdb5d5e03b559a04f88fcd22a835076 (commit)
       via  f502351f855098ecdc76819a0340e1ab06d2c2d8 (commit)
       via  f2c6c618fba3b262d1b5e0f54a1421c9660df9bd (commit)
       via  cbba74fcd57b7b81337d44c2e663ba317e6538de (commit)
       via  2bd7edf29bad74e61da31b801afd85b4c33ef7fe (commit)
       via  1062d90268c69372ff98be2d86cf7d9423c31da0 (commit)
       via  c4916927cdfad0fff3cc8b121405b2518dcabb26 (commit)
       via  d18557927ac033c2e33c1f7770881367b252f329 (commit)
       via  f6a485f2af3665d66d93621d3e0c40ee3e541eef (commit)
       via  e18a2167616da4d45fa3314df55483c4b1862240 (commit)
       via  9192507c4d15cd083231d16331c96bd197c79cec (commit)
       via  44af40bbc9c3617100d7360809275140ac7b7cd2 (commit)
       via  d25acd6794de48d6927cd5d6250cedef3ba4e2d1 (commit)
       via  7d4f5d69a2dced1bb0c807da46a791e094a8cc47 (commit)
       via  382f262d2c9c2c104808fa4bb38fb395e28c85bc (commit)
       via  3ffd38b8e0792fc68be55d954cd65ab32f64586a (commit)
       via  369b6de63a042bd7b0a95a5510f0260a314c2361 (commit)
       via  8382fe1d7ee8c0c050873c05f0702d35c5e1305f (commit)
       via  ffc0c0768c4d2dc9aae3d4e3be3cb5584e42a4ba (commit)
       via  1c258a38bf9170704728c10d42cdb31f286137d3 (commit)
       via  897f8c02f36454c6627d0c5fb78c6adb03137a28 (commit)
       via  5c30ff39945f72a633db91b52ba881ac5b02f762 (commit)
       via  282d1464bdc2584d69a2a7734106acc67d6a16e6 (commit)
       via  bfccffd3ca2ea0ee4c129f52f8a1907c973f3951 (commit)
       via  321b2b5486a7e64527eae9718c54425de9285d7c (commit)
       via  a786d20e2ac2dbc5fd78a6100b23e391ddb3ce32 (commit)
       via  69e7b5b364a3e4708325ec214d8d3117095491fd (commit)
       via  4c47283466981a99d27467c086d49a2235f5d0c2 (commit)
       via  9d3c5bef462c95d52ff61693cce49d435461367f (commit)
       via  3f23d6fdf6fd1808249840a3635c1afe47726dfe (commit)
       via  4b7c0f2aa4da6fdb25419a24d1a7f5b57ab35bfd (commit)
       via  1356cd61457b8a48ed879b97c5cd14eb4ccf0f29 (commit)
       via  6b2ee0dd59e39307649b72940824ceafada35fac (commit)
       via  7ffda8eec81106fe7d017f8fdb67ef1fa1a0f761 (commit)
       via  7daef1e224ee6fb8b03cd7b71773c5381c07324e (commit)
       via  e0fc29c78d959d19c3d63d3bfb204b1c444518bd (commit)
       via  d4bb1f8a3c68288f45d2c1fa618c333825fcc8d0 (commit)
       via  aabc7a74ca16c8d72872988354e5e6d32be4fb00 (commit)
       via  4da106ba69c8574366887a32c9e699f9b7410499 (commit)
       via  02c34d4ceba8fc2b4b7ea64e22f7530f2dca60ef (commit)
       via  f824f854b26dbf5e6c1d10dc3eb4689349dd71fe (commit)
       via  f90267f98880d40c3038391561c5435e531b0722 (commit)
       via  2bcd1451cbcad6e96610f0ddfe14a19f8dd4a3ba (commit)
       via  1ca3acc34896c8f1325925cb017c70bb23eac704 (commit)
       via  2755c8e5060fc5f84c91e089b43d5019c84cd93b (commit)
       via  35806ff1bb3106bcf5874f2b3956fb785acc852a (commit)
       via  bb741f18407fd0190e1b6c642c14ef9f502b004e (commit)
       via  728faddf2628bf1ee9123a0673cb75f4d2ce74fe (commit)
       via  19b9a0324dd6ffd179e09fa11e97d3d2c4b98fcb (commit)
       via  3723f697b61ce60858455473b3a5464a2da65bfb (commit)
       via  f9ffb421cddf3a1bfcb6d79b31958b4d54ed5906 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (4c4a74d1f077945376a2d3bbbdc5f2eebc2f8de2)
            \
             N -- N -- N (fbb6cc64c687a92ef3598c2cce9ef7a2d54e777f)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

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 fbb6cc64c687a92ef3598c2cce9ef7a2d54e777f
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Aug 26 21:46:10 2016 -0400

    9799: Update test: "spectator" user is now allowed to read log entries about itself.

diff --git a/services/api/test/fixtures/logs.yml b/services/api/test/fixtures/logs.yml
index 9179e6d..2f45d69 100644
--- a/services/api/test/fixtures/logs.yml
+++ b/services/api/test/fixtures/logs.yml
@@ -1,7 +1,9 @@
-noop:
+noop: # nothing happened ...to the 'spectator' user
   id: 1
   uuid: zzzzz-xxxxx-pshmckwoma9plh7
+  owner_uuid: zzzzz-tpzed-000000000000000
   object_uuid: zzzzz-tpzed-l1s2piq4t4mps8r
+  object_owner_uuid: zzzzz-tpzed-000000000000000
   event_at: <%= 1.minute.ago.to_s(:db) %>
 
 admin_changes_repository2: # admin changes repository2, which is owned by active user
diff --git a/services/api/test/unit/log_test.rb b/services/api/test/unit/log_test.rb
index fd71576..632271e 100644
--- a/services/api/test/unit/log_test.rb
+++ b/services/api/test/unit/log_test.rb
@@ -253,7 +253,8 @@ class LogTest < ActiveSupport::TestCase
                                       :crunchstat_for_running_job] # log & job owned by active
 
     c = Log.readable_by(users(:spectator)).order("id asc").each.to_a
-    assert_log_result c, known_logs, [:admin_changes_specimen, # owned by spectator
+    assert_log_result c, known_logs, [:noop,                   # object_uuid is spectator
+                                      :admin_changes_specimen, # object_uuid is a specimen owned by spectator
                                       :system_adds_baz] # readable via 'all users' group
   end
 

commit c668c6b1204c4a388f6250c8ecc71679ae984145
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Aug 26 21:45:17 2016 -0400

    9799: Permit read access to containers via container requests. Move Log- and Container-specific permission queries to log.rb and container.rb.

diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index c663d21..012d99b 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -222,15 +222,6 @@ class ArvadosModel < ActiveRecord::Base
       sql_params += [user_uuids, user_uuids]
     end
 
-    if sql_table == "logs" and users_list.any?
-      # Link head points to the object described by this row
-      sql_conds += ["#{sql_table}.object_uuid IN #{permitted_uuids}"]
-
-      # This object described by this row is owned by this user, or owned by a group readable by this user
-      sql_conds += ["#{sql_table}.object_owner_uuid in (?)"]
-      sql_params += [uuid_list]
-    end
-
     # Link head points to this row, or to the owner of this row (the
     # thing to be read)
     #
diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb
index 4c77008..ae4d983 100644
--- a/services/api/app/models/container.rb
+++ b/services/api/app/models/container.rb
@@ -76,6 +76,17 @@ class Container < ArvadosModel
     end
   end
 
+  def self.readable_by *users_list
+    if users_list.select { |u| u.is_admin }.any?
+      return self
+    end
+    user_uuids = users_list.map { |u| u.uuid }
+    uuid_list = user_uuids + users_list.flat_map { |u| u.groups_i_can(:read) }
+    permitted_uuids = "(SELECT head_uuid FROM links WHERE link_class='permission' AND tail_uuid IN (?))"
+    joins(:container_requests).where("container_requests.uuid IN #{permitted_uuids} OR container_requests.owner_uuid IN (?)",
+                                     uuid_list, uuid_list)
+  end
+
   protected
 
   def fill_field_defaults
diff --git a/services/api/app/models/log.rb b/services/api/app/models/log.rb
index b10a491..7a8b50a 100644
--- a/services/api/app/models/log.rb
+++ b/services/api/app/models/log.rb
@@ -53,6 +53,18 @@ class Log < ArvadosModel
     self
   end
 
+  def self.readable_by *users_list
+    if users_list.select { |u| u.is_admin }.any?
+      return self
+    end
+    user_uuids = users_list.map { |u| u.uuid }
+    uuid_list = user_uuids + users_list.flat_map { |u| u.groups_i_can(:read) }
+    permitted_uuids = "(SELECT head_uuid FROM links WHERE link_class='permission' AND tail_uuid IN (?))"
+    joins("LEFT JOIN container_requests ON container_requests.container_uuid=logs.object_uuid").
+      where("logs.object_uuid IN #{permitted_uuids} OR container_requests.uuid IN (?)  OR container_requests.owner_uuid IN (?) OR logs.object_uuid IN (?) OR logs.object_owner_uuid IN (?)",
+            uuid_list, uuid_list, uuid_list, uuid_list, uuid_list)
+  end
+
   protected
 
   def permission_to_create
diff --git a/services/api/lib/eventbus.rb b/services/api/lib/eventbus.rb
index e7f2bb1..16bb030 100644
--- a/services/api/lib/eventbus.rb
+++ b/services/api/lib/eventbus.rb
@@ -143,7 +143,7 @@ class EventBus
         #
         # Note: find_each implies order('id asc'), which is what we
         # want.
-        logs.select(:id).find_each do |l|
+        logs.select('logs.id').find_each do |l|
           if not ws.sent_ids.include?(l.id)
             # only send if not a duplicate
             ws.send(Log.find(l.id).as_api_response.to_json)

commit f06b652091ba857dc844c63fc55745d2117c2577
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Aug 26 21:03:57 2016 -0400

    9799: Add tests for container permissions.

diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index b0c55c1..a4b060b 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -389,4 +389,10 @@ class ContainerRequestTest < ActiveSupport::TestCase
       end
     end
   end
+
+  test "requestor can retrieve container owned by dispatch" do
+    assert_not_empty Container.readable_by(users(:admin)).where(uuid: containers(:running).uuid)
+    assert_not_empty Container.readable_by(users(:active)).where(uuid: containers(:running).uuid)
+    assert_empty Container.readable_by(users(:spectator)).where(uuid: containers(:running).uuid)
+  end
 end

commit 0574ef526196c291dc7dd9f9c8a6d6ac31008126
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Aug 26 17:34:25 2016 -0400

    9799: Add tests for container log permissions.

diff --git a/services/api/test/fixtures/container_requests.yml b/services/api/test/fixtures/container_requests.yml
index de41ff0..a2660b7 100644
--- a/services/api/test/fixtures/container_requests.yml
+++ b/services/api/test/fixtures/container_requests.yml
@@ -36,7 +36,7 @@ running:
     vcpus: 1
     ram: 123
 
-running-older:
+running_older:
   uuid: zzzzz-xvhdp-cr4runningcntn2
   owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   name: running
diff --git a/services/api/test/fixtures/containers.yml b/services/api/test/fixtures/containers.yml
index 4201d11..d1358fc 100644
--- a/services/api/test/fixtures/containers.yml
+++ b/services/api/test/fixtures/containers.yml
@@ -31,7 +31,7 @@ running:
     vcpus: 4
   auth_uuid: zzzzz-gj3su-077z32aux8dg2s1
 
-running-older:
+running_older:
   uuid: zzzzz-dz642-runningcontain2
   owner_uuid: zzzzz-tpzed-000000000000000
   state: Running
diff --git a/services/api/test/unit/permission_test.rb b/services/api/test/unit/permission_test.rb
index 4a6ddc6..5bc296a 100644
--- a/services/api/test/unit/permission_test.rb
+++ b/services/api/test/unit/permission_test.rb
@@ -353,4 +353,27 @@ class PermissionTest < ActiveSupport::TestCase
       ob.update_attributes!(owner_uuid: groups(:aproject).uuid)
     end
   end
+
+  def container_logs container, user
+    Log.readable_by(users(user)).
+      where(object_uuid: containers(container).uuid, event_type: "test")
+  end
+
+  test "container logs created by dispatch are visible to container requestor" do
+    set_user_from_auth :dispatch1
+    Log.create!(object_uuid: containers(:running).uuid,
+                event_type: "test")
+
+    assert_not_empty container_logs(:running, :admin)
+    assert_not_empty container_logs(:running, :active)
+    assert_empty container_logs(:running, :spectator)
+  end
+
+  test "container logs created by dispatch are public if container request is public" do
+    set_user_from_auth :dispatch1
+    Log.create!(object_uuid: containers(:running_older).uuid,
+                event_type: "test")
+
+    assert_not_empty container_logs(:running_older, :anonymous)
+  end
 end

commit 845c28dcd5b6bf60875af12037887e7d7f1838ab
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Aug 26 17:09:42 2016 -0400

    9799: Fix container fixture owner_uuid attributes to look like real-life containers.

diff --git a/services/api/test/fixtures/containers.yml b/services/api/test/fixtures/containers.yml
index 79e472b..4201d11 100644
--- a/services/api/test/fixtures/containers.yml
+++ b/services/api/test/fixtures/containers.yml
@@ -1,6 +1,6 @@
 queued:
   uuid: zzzzz-dz642-queuedcontainer
-  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  owner_uuid: zzzzz-tpzed-000000000000000
   state: Queued
   priority: 1
   created_at: 2016-01-11 11:11:11.111111111 Z
@@ -16,8 +16,7 @@ queued:
 
 running:
   uuid: zzzzz-dz642-runningcontainr
-  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
-  state: Running
+  owner_uuid: zzzzz-tpzed-000000000000000
   priority: 1
   created_at: <%= 1.minute.ago.to_s(:db) %>
   updated_at: <%= 1.minute.ago.to_s(:db) %>
@@ -34,7 +33,7 @@ running:
 
 running-older:
   uuid: zzzzz-dz642-runningcontain2
-  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  owner_uuid: zzzzz-tpzed-000000000000000
   state: Running
   priority: 1
   created_at: <%= 2.minute.ago.to_s(:db) %>
@@ -51,7 +50,7 @@ running-older:
 
 locked:
   uuid: zzzzz-dz642-lockedcontainer
-  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  owner_uuid: zzzzz-tpzed-000000000000000
   state: Locked
   priority: 2
   created_at: <%= 2.minute.ago.to_s(:db) %>
@@ -67,7 +66,7 @@ locked:
 
 completed:
   uuid: zzzzz-dz642-compltcontainer
-  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  owner_uuid: zzzzz-tpzed-000000000000000
   state: Complete
   priority: 1
   created_at: 2016-01-11 11:11:11.111111111 Z
@@ -86,7 +85,7 @@ completed:
 
 completed_older:
   uuid: zzzzz-dz642-compltcontainr2
-  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  owner_uuid: zzzzz-tpzed-000000000000000
   state: Complete
   priority: 1
   created_at: 2016-01-11 11:11:11.111111111 Z
@@ -104,7 +103,7 @@ completed_older:
 
 requester:
   uuid: zzzzz-dz642-requestingcntnr
-  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  owner_uuid: zzzzz-tpzed-000000000000000
   state: Complete
   priority: 1
   created_at: 2016-01-11 11:11:11.111111111 Z
@@ -120,7 +119,7 @@ requester:
 
 requester_container:
   uuid: zzzzz-dz642-requestercntnr1
-  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  owner_uuid: zzzzz-tpzed-000000000000000
   state: Complete
   priority: 1
   created_at: 2016-01-11 11:11:11.111111111 Z

commit 5664fc03a410be5abad40afbcb27450719499950
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Aug 19 11:14:03 2016 -0400

    9799: Use regular (non-admin) user in Workbench websocket tests.

diff --git a/apps/workbench/test/integration/websockets_test.rb b/apps/workbench/test/integration/websockets_test.rb
index e9f5a79..e302a39 100644
--- a/apps/workbench/test/integration/websockets_test.rb
+++ b/apps/workbench/test/integration/websockets_test.rb
@@ -6,20 +6,20 @@ class WebsocketTest < ActionDispatch::IntegrationTest
   end
 
   test "test page" do
-    visit(page_with_token("admin", "/websockets"))
+    visit(page_with_token("active", "/websockets"))
     fill_in("websocket-message-content", :with => "Stuff")
     click_button("Send")
     assert_text '"status":400'
   end
 
   test "test live logging" do
-    visit(page_with_token("admin", "/pipeline_instances/zzzzz-d1hrv-9fm8l10i9z2kqc6"))
+    visit(page_with_token("active", "/pipeline_instances/zzzzz-d1hrv-9fm8l10i9z2kqc6"))
     click_link("Log")
     assert_no_text '123 hello'
 
     api = ArvadosApiClient.new
 
-    Thread.current[:arvados_api_token] = @@API_AUTHS["admin"]['api_token']
+    use_token :active
     api.api("logs", "", {log: {
                 object_uuid: "zzzzz-d1hrv-9fm8l10i9z2kqc6",
                 event_type: "stderr",
@@ -32,14 +32,12 @@ class WebsocketTest < ActionDispatch::IntegrationTest
    ["jobs", api_fixture("jobs")['running']['uuid']],
    ["containers", api_fixture("containers")['running']['uuid']],
    ["container_requests", api_fixture("container_requests")['running']['uuid'], api_fixture("containers")['running']['uuid']],
-  ].each do |c|
-    test "test live logging scrolling #{c[0]}" do
+  ].each do |controller, uuid, log_uuid|
+    log_uuid = log_uuid || uuid
 
-      controller = c[0]
-      uuid = c[1]
-      log_uuid = c[2] || c[1]
+    test "test live logging scrolling for #{controller}" do
 
-      visit(page_with_token("admin", "/#{controller}/#{uuid}"))
+      visit(page_with_token("active", "/#{controller}/#{uuid}"))
       click_link("Log")
       assert_no_text '123 hello'
 
@@ -50,11 +48,12 @@ class WebsocketTest < ActionDispatch::IntegrationTest
         text << "#{i} hello\n"
       end
 
-      Thread.current[:arvados_api_token] = @@API_AUTHS["admin"]['api_token']
-      api.api("logs", "", {log: {
-                  object_uuid: log_uuid,
-                  event_type: "stderr",
-                  properties: {"text" => text}}})
+      use_token :dispatch1 do
+        api.api("logs", "", {log: {
+                    object_uuid: log_uuid,
+                    event_type: "stderr",
+                    properties: {"text" => text}}})
+      end
       assert_text '1000 hello'
 
       # First test that when we're already at the bottom of the page, it scrolls down
@@ -87,7 +86,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
   end
 
   test "pipeline instance arv-refresh-on-log-event" do
-    Thread.current[:arvados_api_token] = @@API_AUTHS["admin"]['api_token']
+    use_token :active
     # Do something and check that the pane reloads.
     p = PipelineInstance.create({state: "RunningOnServer",
                                   components: {
@@ -98,15 +97,17 @@ class WebsocketTest < ActionDispatch::IntegrationTest
                                   }
                                 })
 
-    visit(page_with_token("admin", "/pipeline_instances/#{p.uuid}"))
+    visit(page_with_token("active", "/pipeline_instances/#{p.uuid}"))
 
     assert_text 'Active'
     assert page.has_link? 'Pause'
     assert_no_text 'Complete'
     assert page.has_no_link? 'Re-run with latest'
 
-    p.state = "Complete"
-    p.save!
+    use_token :admin do
+      p.state = "Complete"
+      p.save!
+    end
 
     assert_no_text 'Active'
     assert page.has_no_link? 'Pause'
@@ -115,26 +116,28 @@ class WebsocketTest < ActionDispatch::IntegrationTest
   end
 
   test "job arv-refresh-on-log-event" do
-    Thread.current[:arvados_api_token] = @@API_AUTHS["admin"]['api_token']
+    use_token :active
     # Do something and check that the pane reloads.
     p = Job.where(uuid: api_fixture('jobs')['running_will_be_completed']['uuid']).results.first
 
-    visit(page_with_token("admin", "/jobs/#{p.uuid}"))
+    visit(page_with_token("active", "/jobs/#{p.uuid}"))
 
     assert_no_text 'complete'
     assert_no_text 'Re-run job'
 
-    p.state = "Complete"
-    p.save!
+    use_token :admin do
+      p.state = "Complete"
+      p.save!
+    end
 
     assert_text 'complete'
     assert_text 'Re-run job'
   end
 
   test "dashboard arv-refresh-on-log-event" do
-    Thread.current[:arvados_api_token] = @@API_AUTHS["admin"]['api_token']
+    use_token :active
 
-    visit(page_with_token("admin", "/"))
+    visit(page_with_token("active", "/"))
 
     assert_no_text 'test dashboard arv-refresh-on-log-event'
 
@@ -217,9 +220,9 @@ class WebsocketTest < ActionDispatch::IntegrationTest
   end
 
   test "test running job with just a few previous log records" do
-    Thread.current[:arvados_api_token] = @@API_AUTHS["admin"]['api_token']
+    use_token :active
     job = Job.where(uuid: api_fixture("jobs")['running']['uuid']).results.first
-    visit page_with_token("admin", "/jobs/#{job.uuid}")
+    visit page_with_token("active", "/jobs/#{job.uuid}")
 
     api = ArvadosApiClient.new
 
@@ -246,10 +249,10 @@ class WebsocketTest < ActionDispatch::IntegrationTest
   test "test running job with too many previous log records" do
     Rails.configuration.running_job_log_records_to_fetch = 5
 
-    Thread.current[:arvados_api_token] = @@API_AUTHS["admin"]['api_token']
+    use_token :active
     job = Job.where(uuid: api_fixture("jobs")['running']['uuid']).results.first
 
-    visit page_with_token("admin", "/jobs/#{job.uuid}")
+    visit page_with_token("active", "/jobs/#{job.uuid}")
 
     api = ArvadosApiClient.new
 

commit ca8cd8c34d7feea9a81c4baca470f2fe0d6a1853
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Aug 19 09:29:58 2016 -0400

    9799: Use regular (non-admin) user in websocket integration tests.

diff --git a/services/api/test/integration/websocket_test.rb b/services/api/test/integration/websocket_test.rb
index 0c99fcc..99ca7ac 100644
--- a/services/api/test/integration/websocket_test.rb
+++ b/services/api/test/integration/websocket_test.rb
@@ -69,7 +69,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
   test "connect, subscribe and get response" do
     status = nil
 
-    ws_helper :admin do |ws|
+    ws_helper :active do |ws|
       ws.on :open do |event|
         ws.send ({method: 'subscribe'}.to_json)
       end
@@ -89,9 +89,9 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     spec = nil
     ev_uuid = nil
 
-    authorize_with :admin
+    authorize_with :active
 
-    ws_helper :admin do |ws|
+    ws_helper :active do |ws|
       ws.on :open do |event|
         ws.send ({method: 'subscribe'}.to_json)
       end
@@ -126,9 +126,9 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     spec_ev_uuid = nil
     human_ev_uuid = nil
 
-    authorize_with :admin
+    authorize_with :active
 
-    ws_helper :admin do |ws|
+    ws_helper :active do |ws|
       ws.on :open do |event|
         ws.send ({method: 'subscribe'}.to_json)
       end
@@ -166,9 +166,9 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     human = nil
     human_ev_uuid = nil
 
-    authorize_with :admin
+    authorize_with :active
 
-    ws_helper :admin do |ws|
+    ws_helper :active do |ws|
       ws.on :open do |event|
         ws.send ({method: 'subscribe', filters: [['object_uuid', 'is_a', 'arvados#human']]}.to_json)
       end
@@ -204,9 +204,9 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     spec_ev_uuid = nil
     human_ev_uuid = nil
 
-    authorize_with :admin
+    authorize_with :active
 
-    ws_helper :admin do |ws|
+    ws_helper :active do |ws|
       ws.on :open do |event|
         ws.send ({method: 'subscribe', filters: [['object_uuid', 'is_a', 'arvados#human']]}.to_json)
         ws.send ({method: 'subscribe', filters: [['object_uuid', 'is_a', 'arvados#specimen']]}.to_json)
@@ -249,9 +249,9 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     state = 1
     t1 = nil
 
-    authorize_with :admin
+    authorize_with :active
 
-    ws_helper :admin do |ws|
+    ws_helper :active do |ws|
       ws.on :open do |event|
         ws.send ({method: 'subscribe', filters: [['object_uuid', 'is_a', 'arvados#trait'], ['event_type', '=', 'update']]}.to_json)
       end
@@ -285,13 +285,13 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     human = nil
     human_ev_uuid = nil
 
-    authorize_with :admin
+    authorize_with :active
 
     lastid = logs(:admin_changes_specimen).id
     l1 = nil
     l2 = nil
 
-    ws_helper :admin do |ws|
+    ws_helper :active do |ws|
       ws.on :open do |event|
         ws.send ({method: 'subscribe', last_log_id: lastid}.to_json)
       end
@@ -329,9 +329,9 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     spec_ev_uuid = nil
     filter_id = nil
 
-    authorize_with :admin
+    authorize_with :active
 
-    ws_helper :admin, false do |ws|
+    ws_helper :active, false do |ws|
       ws.on :open do |event|
         ws.send ({method: 'subscribe'}.to_json)
         EM::Timer.new 3 do
@@ -378,9 +378,9 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     spec = nil
     spec_ev_uuid = nil
 
-    authorize_with :admin
+    authorize_with :active
 
-    ws_helper :admin, false do |ws|
+    ws_helper :active, false do |ws|
       ws.on :open do |event|
         ws.send ({method: 'subscribe', filters: [['object_uuid', 'is_a', 'arvados#human']]}.to_json)
         EM::Timer.new 6 do
@@ -430,9 +430,9 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     human = nil
     human_ev_uuid = nil
 
-    authorize_with :admin
+    authorize_with :active
 
-    ws_helper :admin do |ws|
+    ws_helper :active do |ws|
       ws.on :open do |event|
         ws.send ({method: 'subscribe'}.to_json)
       end
@@ -477,9 +477,9 @@ class WebsocketTest < ActionDispatch::IntegrationTest
 
   test "connected, not subscribed, no event" do
     slow_test
-    authorize_with :admin
+    authorize_with :active
 
-    ws_helper :admin, false do |ws|
+    ws_helper :active, false do |ws|
       ws.on :open do |event|
         EM::Timer.new 1 do
           Specimen.create
@@ -530,7 +530,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
   test "connect, try bogus method" do
     status = nil
 
-    ws_helper :admin do |ws|
+    ws_helper :active do |ws|
       ws.on :open do |event|
         ws.send ({method: 'frobnabble'}.to_json)
       end
@@ -548,7 +548,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
   test "connect, missing method" do
     status = nil
 
-    ws_helper :admin do |ws|
+    ws_helper :active do |ws|
       ws.on :open do |event|
         ws.send ({fizzbuzz: 'frobnabble'}.to_json)
       end
@@ -566,7 +566,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
   test "connect, send malformed request" do
     status = nil
 
-    ws_helper :admin do |ws|
+    ws_helper :active do |ws|
       ws.on :open do |event|
         ws.send '<XML4EVER></XML4EVER>'
       end
@@ -585,9 +585,9 @@ class WebsocketTest < ActionDispatch::IntegrationTest
   test "connect, try subscribe too many filters" do
     state = 1
 
-    authorize_with :admin
+    authorize_with :active
 
-    ws_helper :admin do |ws|
+    ws_helper :active do |ws|
       ws.on :open do |event|
         (1..17).each do |i|
           ws.send ({method: 'subscribe', filters: [['object_uuid', '=', i]]}.to_json)
@@ -618,9 +618,9 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     event_count = 0
     log_start = Log.order(:id).last.id
 
-    authorize_with :admin
+    authorize_with :active
 
-    ws_helper :admin, false do |ws|
+    ws_helper :active, false do |ws|
       EM::Timer.new 45 do
         # Needs a longer timeout than the default
         ws.close
@@ -661,9 +661,9 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     human = nil
     human_ev_uuid = nil
 
-    authorize_with :admin
+    authorize_with :active
 
-    ws_helper :admin do |ws|
+    ws_helper :active do |ws|
       ws.on :open do |event|
         # test that #6451 is fixed (invalid filter crashes websockets)
         ws.send ({method: 'subscribe', filters: [['object_blarg', 'is_a', 'arvados#human']]}.to_json)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list