Merge branch 'master' into 14670-new-java-sdk-docs
authorPeter Amstutz <pamstutz@veritasgenetics.com>
Fri, 12 Apr 2019 14:56:24 +0000 (10:56 -0400)
committerPeter Amstutz <pamstutz@veritasgenetics.com>
Fri, 12 Apr 2019 14:56:24 +0000 (10:56 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz@veritasgenetics.com>

348 files changed:
apps/workbench/.gitignore
build/run-tests.sh
doc/_config.yml
doc/api/methods/collections.html.textile.liquid
doc/install/arvbox.html.textile.liquid
doc/install/install-dispatch-cloud.html.textile.liquid [new file with mode: 0644]
doc/install/install-nodemanager.html.textile.liquid
lib/cloud/azure/azure.go
lib/crunchstat/crunchstat.go
lib/dispatchcloud/container/queue.go
lib/dispatchcloud/container/queue_test.go
sdk/cwl/setup.py
sdk/cwl/tests/federation/framework/check-exist.cwl
sdk/cwl/tests/federation/framework/prepare.cwl
sdk/go/arvados/client.go
sdk/python/tests/nginx.conf
sdk/python/tests/run_test_server.py
sdk/python/tests/test_arv_put.py
services/api/.gitignore
services/api/Gemfile
services/api/Gemfile.lock
services/api/Rakefile
services/api/app/controllers/application_controller.rb
services/api/app/controllers/arvados/v1/api_client_authorizations_controller.rb
services/api/app/controllers/arvados/v1/api_clients_controller.rb
services/api/app/controllers/arvados/v1/containers_controller.rb
services/api/app/controllers/arvados/v1/groups_controller.rb
services/api/app/controllers/arvados/v1/healthcheck_controller.rb
services/api/app/controllers/arvados/v1/jobs_controller.rb
services/api/app/controllers/arvados/v1/keep_disks_controller.rb
services/api/app/controllers/arvados/v1/keep_services_controller.rb
services/api/app/controllers/arvados/v1/nodes_controller.rb
services/api/app/controllers/arvados/v1/repositories_controller.rb
services/api/app/controllers/arvados/v1/schema_controller.rb
services/api/app/controllers/arvados/v1/user_agreements_controller.rb
services/api/app/controllers/arvados/v1/users_controller.rb
services/api/app/controllers/arvados/v1/virtual_machines_controller.rb
services/api/app/controllers/database_controller.rb
services/api/app/controllers/static_controller.rb
services/api/app/controllers/user_sessions_controller.rb
services/api/app/models/application_record.rb [new file with mode: 0644]
services/api/app/models/arvados_model.rb
services/api/app/models/collection.rb
services/api/app/models/container.rb
services/api/app/models/container_request.rb
services/api/app/models/group.rb
services/api/app/models/job.rb
services/api/app/models/jsonb_type.rb [new file with mode: 0644]
services/api/app/models/link.rb
services/api/app/models/node.rb
services/api/app/models/pipeline_instance.rb
services/api/app/models/user.rb
services/api/bin/bundle [new file with mode: 0755]
services/api/bin/rails [new file with mode: 0755]
services/api/bin/rake [new file with mode: 0755]
services/api/bin/setup [new file with mode: 0755]
services/api/bin/update [new file with mode: 0755]
services/api/config/application.default.yml
services/api/config/application.rb
services/api/config/boot.rb
services/api/config/cable.yml [new file with mode: 0644]
services/api/config/database.yml.example
services/api/config/environment.rb
services/api/config/environments/production.rb.example
services/api/config/environments/test.rb.example
services/api/config/initializers/application_controller_renderer.rb [new file with mode: 0644]
services/api/config/initializers/assets.rb [new file with mode: 0644]
services/api/config/initializers/cookies_serializer.rb [new file with mode: 0644]
services/api/config/initializers/custom_types.rb [new file with mode: 0644]
services/api/config/initializers/filter_parameter_logging.rb [new file with mode: 0644]
services/api/config/initializers/new_framework_defaults.rb [new file with mode: 0644]
services/api/config/initializers/session_store.rb
services/api/config/puma.rb [new file with mode: 0644]
services/api/config/secrets.yml [new file with mode: 0644]
services/api/config/spring.rb [new file with mode: 0644]
services/api/db/migrate/20121016005009_create_collections.rb
services/api/db/migrate/20130105203021_create_metadata.rb
services/api/db/migrate/20130105224358_rename_metadata_class.rb
services/api/db/migrate/20130105224618_rename_collection_created_by_client.rb
services/api/db/migrate/20130107181109_add_uuid_to_collections.rb
services/api/db/migrate/20130107212832_create_nodes.rb
services/api/db/migrate/20130109175700_create_pipelines.rb
services/api/db/migrate/20130109220548_create_pipeline_invocations.rb
services/api/db/migrate/20130113214204_add_index_to_collections_and_metadata.rb
services/api/db/migrate/20130116024233_create_specimens.rb
services/api/db/migrate/20130116215213_create_projects.rb
services/api/db/migrate/20130118002239_rename_metadata_attributes.rb
services/api/db/migrate/20130122020042_create_users.rb
services/api/db/migrate/20130122201442_create_logs.rb
services/api/db/migrate/20130122221616_add_modified_at_to_logs.rb
services/api/db/migrate/20130123174514_add_uuid_index_to_users.rb
services/api/db/migrate/20130123180224_create_api_clients.rb
services/api/db/migrate/20130123180228_create_api_client_authorizations.rb
services/api/db/migrate/20130125220425_rename_created_by_to_owner.rb
services/api/db/migrate/20130128202518_rename_metadata_to_links.rb
services/api/db/migrate/20130128231343_add_properties_to_specimen.rb
services/api/db/migrate/20130130205749_add_manifest_text_to_collection.rb
services/api/db/migrate/20130203104818_create_jobs.rb
services/api/db/migrate/20130203104824_create_job_steps.rb
services/api/db/migrate/20130203115329_add_priority_to_jobs.rb
services/api/db/migrate/20130207195855_add_index_on_timestamps.rb
services/api/db/migrate/20130218181504_add_properties_to_pipeline_invocations.rb
services/api/db/migrate/20130226170000_remove_native_target_from_links.rb
services/api/db/migrate/20130313175417_rename_projects_to_groups.rb
services/api/db/migrate/20130315155820_add_is_locked_by_to_jobs.rb
services/api/db/migrate/20130315183626_add_log_to_jobs.rb
services/api/db/migrate/20130315213205_add_tasks_summary_to_jobs.rb
services/api/db/migrate/20130318002138_add_resource_limits_to_jobs.rb
services/api/db/migrate/20130319165853_rename_job_command_to_script.rb
services/api/db/migrate/20130319180730_rename_pipeline_invocation_to_pipeline_instance.rb
services/api/db/migrate/20130319194637_rename_pipelines_to_pipeline_templates.rb
services/api/db/migrate/20130319201431_rename_job_steps_to_job_tasks.rb
services/api/db/migrate/20130319235957_add_default_owner_to_users.rb
services/api/db/migrate/20130320000107_add_default_owner_to_api_client_authorizations.rb
services/api/db/migrate/20130326173804_create_commits.rb
services/api/db/migrate/20130326182917_create_commit_ancestors.rb
services/api/db/migrate/20130415020241_rename_orvos_to_arvados.rb
services/api/db/migrate/20130425024459_create_keep_disks.rb
services/api/db/migrate/20130425214427_add_service_host_and_service_port_and_service_ssl_flag_to_keep_disks.rb
services/api/db/migrate/20130523060112_add_created_by_job_task_to_job_tasks.rb
services/api/db/migrate/20130523060213_add_qsequence_to_job_tasks.rb
services/api/db/migrate/20130524042319_fix_job_task_qsequence_type.rb
services/api/db/migrate/20130528134100_update_nodes_index.rb
services/api/db/migrate/20130606183519_create_authorized_keys.rb
services/api/db/migrate/20130608053730_create_virtual_machines.rb
services/api/db/migrate/20130610202538_create_repositories.rb
services/api/db/migrate/20130611163736_rename_authorized_key_authorized_user_to_authorized_user_uuid.rb
services/api/db/migrate/20130612042554_add_name_unique_index_to_repositories.rb
services/api/db/migrate/20130617150007_add_is_trusted_to_api_clients.rb
services/api/db/migrate/20130626002829_add_is_active_to_users.rb
services/api/db/migrate/20130626022810_activate_all_admins.rb
services/api/db/migrate/20130627154537_create_traits.rb
services/api/db/migrate/20130627184333_create_humans.rb
services/api/db/migrate/20130708163414_rename_foreign_uuid_attributes.rb
services/api/db/migrate/20130708182912_rename_job_foreign_uuid_attributes.rb
services/api/db/migrate/20130708185153_rename_user_default_owner.rb
services/api/db/migrate/20130724153034_add_scopes_to_api_client_authorizations.rb
services/api/db/migrate/20131007180607_rename_resource_limits_to_runtime_constraints.rb
services/api/db/migrate/20140117231056_normalize_collection_uuid.rb
services/api/db/migrate/20140124222114_fix_link_kind_underscores.rb
services/api/db/migrate/20140129184311_normalize_collection_uuids_in_script_parameters.rb
services/api/db/migrate/20140317135600_add_nondeterministic_column_to_job.rb
services/api/db/migrate/20140319160547_separate_repository_from_script_version.rb
services/api/db/migrate/20140321191343_add_repository_column_to_job.rb
services/api/db/migrate/20140324024606_add_output_is_persistent_to_job.rb
services/api/db/migrate/20140325175653_remove_kind_columns.rb
services/api/db/migrate/20140402001908_add_system_group.rb
services/api/db/migrate/20140407184311_rename_log_info_to_properties.rb
services/api/db/migrate/20140421140924_add_group_class_to_groups.rb
services/api/db/migrate/20140421151939_rename_auth_keys_user_index.rb
services/api/db/migrate/20140421151940_timestamps_not_null.rb
services/api/db/migrate/20140422011506_pipeline_instance_state.rb
services/api/db/migrate/20140423132913_add_object_owner_to_logs.rb
services/api/db/migrate/20140423133559_new_scope_format.rb
services/api/db/migrate/20140501165548_add_unique_name_index_to_links.rb
services/api/db/migrate/20140519205916_create_keep_services.rb
services/api/db/migrate/20140527152921_add_description_to_pipeline_templates.rb
services/api/db/migrate/20140530200539_add_supplied_script_version.rb
services/api/db/migrate/20140601022548_remove_name_from_collections.rb
services/api/db/migrate/20140602143352_remove_active_and_success_from_pipeline_instances.rb
services/api/db/migrate/20140607150616_rename_folder_to_project.rb
services/api/db/migrate/20140611173003_add_docker_locator_to_jobs.rb
services/api/db/migrate/20140627210837_anonymous_group.rb
services/api/db/migrate/20140709172343_job_task_serial_qsequence.rb
services/api/db/migrate/20140714184006_empty_collection.rb
services/api/db/migrate/20140811184643_collection_use_regular_uuids.rb
services/api/db/migrate/20140817035914_add_unique_name_constraints.rb
services/api/db/migrate/20140818125735_add_not_null_constraint_to_group_name.rb
services/api/db/migrate/20140826180337_remove_output_is_persistent_column.rb
services/api/db/migrate/20140828141043_job_priority_fixup.rb
services/api/db/migrate/20140909183946_add_start_finish_time_to_tasks_and_pipelines.rb
services/api/db/migrate/20140911221252_add_description_to_pipeline_instances_and_jobs.rb
services/api/db/migrate/20140918141529_change_user_owner_uuid_not_null.rb
services/api/db/migrate/20140918153541_add_properties_to_node.rb
services/api/db/migrate/20140918153705_add_state_to_job.rb
services/api/db/migrate/20140924091559_add_job_uuid_to_nodes.rb
services/api/db/migrate/20141111133038_add_arvados_sdk_version_to_jobs.rb
services/api/db/migrate/20141208164553_owner_uuid_index.rb
services/api/db/migrate/20141208174553_descriptions_are_strings.rb
services/api/db/migrate/20141208174653_collection_file_names.rb
services/api/db/migrate/20141208185217_search_index.rb
services/api/db/migrate/20150122175935_no_description_in_search_index.rb
services/api/db/migrate/20150123142953_full_text_search.rb
services/api/db/migrate/20150203180223_set_group_class_on_anonymous_group.rb
services/api/db/migrate/20150206210804_all_users_can_read_anonymous_group.rb
services/api/db/migrate/20150206230342_rename_replication_attributes.rb
services/api/db/migrate/20150216193428_collection_name_owner_unique_only_non_expired.rb
services/api/db/migrate/20150303210106_fix_collection_portable_data_hash_with_hinted_manifest.rb
services/api/db/migrate/20150312151136_change_collection_expires_at_to_datetime.rb
services/api/db/migrate/20150317132720_add_username_to_users.rb
services/api/db/migrate/20150324152204_backward_compatibility_for_user_repositories.rb
services/api/db/migrate/20150423145759_no_filenames_in_collection_search_index.rb
services/api/db/migrate/20150512193020_read_only_on_keep_services.rb
services/api/db/migrate/20150526180251_leading_space_on_full_text_index.rb
services/api/db/migrate/20151202151426_create_containers_and_requests.rb
services/api/db/migrate/20151215134304_fix_containers_index.rb
services/api/db/migrate/20151229214707_add_exit_code_to_containers.rb
services/api/db/migrate/20160208210629_add_uuid_to_api_client_authorization.rb
services/api/db/migrate/20160209155729_add_uuid_to_api_token_search_index.rb
services/api/db/migrate/20160324144017_add_components_to_job.rb
services/api/db/migrate/20160506175108_add_auths_to_container.rb
services/api/db/migrate/20160509143250_add_auth_and_lock_to_container_index.rb
services/api/db/migrate/20160808151559_create_workflows.rb
services/api/db/migrate/20160819195557_add_script_parameters_digest_to_jobs.rb
services/api/db/migrate/20160819195725_populate_script_parameters_digest.rb
services/api/db/migrate/20160901210110_repair_script_parameters_digest.rb
services/api/db/migrate/20160909181442_rename_workflow_to_definition.rb
services/api/db/migrate/20160926194129_add_container_count.rb
services/api/db/migrate/20161019171346_add_use_existing_to_container_requests.rb
services/api/db/migrate/20161111143147_add_scheduling_parameters_to_container.rb
services/api/db/migrate/20161115171221_add_output_and_log_uuid_to_container_request.rb
services/api/db/migrate/20161115174218_add_output_and_log_uuids_to_container_request_search_index.rb
services/api/db/migrate/20161213172944_full_text_search_indexes.rb
services/api/db/migrate/20161222153434_split_expiry_to_trash_and_delete.rb
services/api/db/migrate/20161223090712_add_output_name_to_container_requests.rb
services/api/db/migrate/20170102153111_add_output_name_to_container_request_search_index.rb
services/api/db/migrate/20170105160301_add_output_name_to_cr_fts_index.rb
services/api/db/migrate/20170105160302_set_finished_at_on_finished_pipeline_instances.rb
services/api/db/migrate/20170216170823_no_cr_mounts_and_workflow_def_in_full_text_search_index.rb
services/api/db/migrate/20170301225558_no_downgrade_after_json.rb
services/api/db/migrate/20170319063406_serialized_columns_accept_null.rb
services/api/db/migrate/20170328215436_add_portable_data_hash_index_to_collections.rb
services/api/db/migrate/20170330012505_add_output_ttl_to_container_requests.rb
services/api/db/migrate/20170419173031_add_created_by_job_task_index_to_job_tasks.rb
services/api/db/migrate/20170419173712_add_object_owner_index_to_logs.rb
services/api/db/migrate/20170419175801_add_requesting_container_index_to_container_requests.rb
services/api/db/migrate/20170628185847_jobs_yaml_to_json.rb
services/api/db/migrate/20170704160233_yaml_to_json.rb
services/api/db/migrate/20170706141334_json_collection_properties.rb
services/api/db/migrate/20170824202826_trashable_groups.rb
services/api/db/migrate/20170906224040_materialized_permission_view.rb
services/api/db/migrate/20171027183824_add_index_to_containers.rb
services/api/db/migrate/20171208203841_fix_trash_flag_follow.rb
services/api/db/migrate/20171212153352_add_gin_index_to_collection_properties.rb
services/api/db/migrate/20180216203422_add_storage_classes_to_collections.rb
services/api/db/migrate/20180228220311_add_secret_mounts_to_containers.rb
services/api/db/migrate/20180313180114_change_container_priority_bigint.rb
services/api/db/migrate/20180501182859_add_redirect_to_user_uuid_to_users.rb
services/api/db/migrate/20180514135529_add_container_auth_uuid_index.rb
services/api/db/migrate/20180607175050_properties_to_jsonb.rb
services/api/db/migrate/20180608123145_add_properties_to_groups.rb
services/api/db/migrate/20180806133039_index_all_filenames.rb
services/api/db/migrate/20180820130357_add_pdh_and_trash_index_to_collections.rb
services/api/db/migrate/20180820132617_add_lock_index_to_containers.rb
services/api/db/migrate/20180820135808_drop_pdh_index_from_collections.rb
services/api/db/migrate/20180824152014_add_md5_index_to_containers.rb
services/api/db/migrate/20180824155207_add_queue_index_to_containers.rb
services/api/db/migrate/20180904110712_add_runtime_status_to_containers.rb
services/api/db/migrate/20180913175443_add_version_info_to_collections.rb
services/api/db/migrate/20180915155335_set_current_version_uuid_on_collections.rb
services/api/db/migrate/20180917200000_replace_full_text_indexes.rb
services/api/db/migrate/20180917205609_recompute_file_names_index.rb
services/api/db/migrate/20180919001158_recreate_collection_unique_name_index.rb
services/api/db/migrate/20181001175023_add_preserve_version_to_collections.rb
services/api/db/migrate/20181004131141_add_current_version_uuid_to_collection_search_index.rb
services/api/db/migrate/20181005192222_add_container_runtime_token.rb
services/api/db/migrate/20181011184200_add_runtime_token_to_container.rb
services/api/db/migrate/20181213183234_add_expression_index_to_links.rb
services/api/db/migrate/20190214214814_add_container_lock_count.rb
services/api/db/migrate/20190322174136_add_file_info_to_collection.rb [new file with mode: 0755]
services/api/db/structure.sql
services/api/lib/can_be_an_owner.rb
services/api/lib/enable_jobs_api.rb
services/api/lib/group_pdhs.rb [new file with mode: 0644]
services/api/lib/has_uuid.rb
services/api/lib/load_param.rb
services/api/script/fail-jobs.rb
services/api/script/get_anonymous_user_token.rb
services/api/script/salvage_collection.rb
services/api/script/setup-new-user.rb
services/api/test/fixtures/collections.yml
services/api/test/fixtures/nodes.yml
services/api/test/functional/application_controller_test.rb
services/api/test/functional/arvados/v1/api_client_authorizations_controller_test.rb
services/api/test/functional/arvados/v1/collections_controller_test.rb
services/api/test/functional/arvados/v1/container_requests_controller_test.rb
services/api/test/functional/arvados/v1/containers_controller_test.rb
services/api/test/functional/arvados/v1/filters_test.rb
services/api/test/functional/arvados/v1/groups_controller_test.rb
services/api/test/functional/arvados/v1/job_reuse_controller_test.rb
services/api/test/functional/arvados/v1/jobs_controller_test.rb
services/api/test/functional/arvados/v1/keep_disks_controller_test.rb
services/api/test/functional/arvados/v1/keep_services_controller_test.rb
services/api/test/functional/arvados/v1/links_controller_test.rb
services/api/test/functional/arvados/v1/logs_controller_test.rb
services/api/test/functional/arvados/v1/nodes_controller_test.rb
services/api/test/functional/arvados/v1/pipeline_instances_controller_test.rb
services/api/test/functional/arvados/v1/query_test.rb
services/api/test/functional/arvados/v1/repositories_controller_test.rb
services/api/test/functional/arvados/v1/users_controller_test.rb
services/api/test/functional/arvados/v1/virtual_machines_controller_test.rb
services/api/test/functional/user_sessions_controller_test.rb
services/api/test/integration/api_client_authorizations_api_test.rb
services/api/test/integration/api_client_authorizations_scopes_test.rb
services/api/test/integration/collections_api_test.rb
services/api/test/integration/collections_performance_test.rb
services/api/test/integration/container_auth_test.rb
services/api/test/integration/cross_origin_test.rb
services/api/test/integration/crunch_dispatch_test.rb
services/api/test/integration/database_reset_test.rb
services/api/test/integration/errors_test.rb
services/api/test/integration/groups_test.rb
services/api/test/integration/jobs_api_test.rb
services/api/test/integration/keep_proxy_test.rb
services/api/test/integration/login_workflow_test.rb
services/api/test/integration/noop_deep_munge_test.rb
services/api/test/integration/permissions_test.rb
services/api/test/integration/pipeline_test.rb
services/api/test/integration/reader_tokens_test.rb
services/api/test/integration/remote_user_test.rb
services/api/test/integration/select_test.rb
services/api/test/integration/serialized_encoding_test.rb
services/api/test/integration/user_sessions_test.rb
services/api/test/integration/users_test.rb
services/api/test/integration/valid_links_test.rb
services/api/test/performance/links_index_test.rb
services/api/test/performance/permission_test.rb
services/api/test/test_helper.rb
services/api/test/unit/arvados_model_test.rb
services/api/test/unit/collection_test.rb
services/api/test/unit/container_test.rb
services/api/test/unit/crunch_dispatch_test.rb
services/api/test/unit/group_pdhs_test.rb [new file with mode: 0644]
services/api/test/unit/job_test.rb
services/arv-git-httpd/gitolite_test.go
services/arv-git-httpd/integration_test.go
services/crunch-dispatch-local/crunch-dispatch-local.go
services/crunch-dispatch-local/crunch-dispatch-local_test.go
services/crunch-run/crunchrun.go
services/keep-web/server_test.go
services/keepproxy/keepproxy.go
services/login-sync/Gemfile
services/login-sync/arvados-login-sync.gemspec
services/login-sync/bin/arvados-login-sync
services/login-sync/test/stubs.rb
services/login-sync/test/test_add_user.rb
tools/arvbox/bin/arvbox
tools/arvbox/lib/arvbox/docker/Dockerfile.base
tools/arvbox/lib/arvbox/docker/Dockerfile.dev
tools/arvbox/lib/arvbox/docker/api-setup.sh
tools/arvbox/lib/arvbox/docker/service/slurmctld/log/main/.gitstub [deleted file]
tools/arvbox/lib/arvbox/docker/service/slurmctld/log/run [deleted symlink]
tools/arvbox/lib/arvbox/docker/service/slurmctld/run [deleted file]
tools/arvbox/lib/arvbox/docker/service/slurmd/log/main/.gitstub [deleted file]
tools/arvbox/lib/arvbox/docker/service/slurmd/log/run [deleted symlink]
tools/arvbox/lib/arvbox/docker/service/slurmd/run [deleted file]
tools/arvbox/lib/arvbox/docker/service/sso/run-service
tools/arvbox/lib/arvbox/docker/waitforpostgres.sh

index 25c7c3ef24ea04acc225e1d1295d424d3959a0cc..fa42a32dd921a22ce9406d55e7dc71ff2c551bf1 100644 (file)
@@ -7,6 +7,8 @@
 /tmp
 .byebug_history
 
+package-lock.json
+
 /config/.secret_token
 /config/initializers/secret_token.rb
 
index a4596bd23698565e121ae89bd9c4f193e5f27858..15ad4eae853eb4087d9e18af95429813518b977c 100755 (executable)
@@ -149,6 +149,7 @@ PYTHONPATH=
 GEMHOME=
 PERLINSTALLBASE=
 R_LIBS=
+export LANG=en_US.UTF-8
 
 short=
 only_install=
@@ -190,6 +191,9 @@ sanity_checks() {
     ( [[ -n "$WORKSPACE" ]] && [[ -d "$WORKSPACE/services" ]] ) \
         || fatal "WORKSPACE environment variable not set to a source directory (see: $0 --help)"
     echo Checking dependencies:
+    echo "locale: ${LANG}"
+    [[ "$(locale charmap)" = "UTF-8" ]] \
+        || fatal "Locale '${LANG}' is broken/missing. Try: echo ${LANG} | sudo tee -a /etc/locale.gen && sudo locale-gen"
     echo -n 'virtualenv: '
     virtualenv --version \
         || fatal "No virtualenv. Try: apt-get install virtualenv (on ubuntu: python-virtualenv)"
@@ -365,6 +369,27 @@ if [[ $NEED_SDK_R == false ]]; then
        echo "R SDK not needed, it will not be installed."
 fi
 
+checkpidfile() {
+    svc="$1"
+    pid="$(cat "$WORKSPACE/tmp/${svc}.pid")"
+    if [[ -z "$pid" ]] || ! kill -0 "$pid"; then
+        tail $WORKSPACE/tmp/${1}*.log
+        echo "${svc} pid ${pid} not running"
+        return 1
+    fi
+    echo "${svc} pid ${pid} ok"
+}
+
+checkdiscoverydoc() {
+    dd="https://${1}/discovery/v1/apis/arvados/v1/rest"
+    if ! (set -o pipefail; curl -fsk "$dd" | grep -q ^{ ); then
+        echo >&2 "ERROR: could not retrieve discovery doc from RailsAPI at $dd"
+        tail -v $WORKSPACE/services/api/log/test.log
+        return 1
+    fi
+    echo "${dd} ok"
+}
+
 start_services() {
     if [[ -n "$ARVADOS_TEST_API_HOST" ]]; then
         return 0
@@ -379,19 +404,29 @@ start_services() {
        rm -f "$WORKSPACE/tmp/api.pid"
     fi
     all_services_stopped=
-    fail=0
+    fail=1
     cd "$WORKSPACE" \
-        && eval $(python sdk/python/tests/run_test_server.py start --auth admin || echo "fail=1; false") \
+        && eval $(python sdk/python/tests/run_test_server.py start --auth admin) \
         && export ARVADOS_TEST_API_HOST="$ARVADOS_API_HOST" \
         && export ARVADOS_TEST_API_INSTALLED="$$" \
+        && checkpidfile api \
+        && checkdiscoverydoc $ARVADOS_API_HOST \
         && python sdk/python/tests/run_test_server.py start_controller \
+        && checkpidfile controller \
         && python sdk/python/tests/run_test_server.py start_keep_proxy \
+        && checkpidfile keepproxy \
         && python sdk/python/tests/run_test_server.py start_keep-web \
+        && checkpidfile keep-web \
         && python sdk/python/tests/run_test_server.py start_arv-git-httpd \
+        && checkpidfile arv-git-httpd \
         && python sdk/python/tests/run_test_server.py start_ws \
-        && eval $(python sdk/python/tests/run_test_server.py start_nginx || echo "fail=1; false") \
+        && checkpidfile ws \
+        && eval $(python sdk/python/tests/run_test_server.py start_nginx) \
+        && checkdiscoverydoc $ARVADOS_API_HOST \
+        && checkpidfile nginx \
+        && export ARVADOS_TEST_PROXY_SERVICES=1 \
         && (env | egrep ^ARVADOS) \
-        || fail=1
+        && fail=0
     deactivate
     if [[ $fail != 0 ]]; then
         unset ARVADOS_TEST_API_HOST
@@ -403,7 +438,7 @@ stop_services() {
     if [[ -n "$all_services_stopped" ]]; then
         return
     fi
-    unset ARVADOS_TEST_API_HOST
+    unset ARVADOS_TEST_API_HOST ARVADOS_TEST_PROXY_SERVICES
     . "$VENVDIR/bin/activate" || return
     cd "$WORKSPACE" \
         && python sdk/python/tests/run_test_server.py stop_nginx \
@@ -696,7 +731,7 @@ do_test() {
         services/api)
             stop_services
             ;;
-        doc | lib/cli | lib/cloud/azure | lib/cloud/ec2 | lib/cmd | lib/dispatchcloud/ssh_executor | lib/dispatchcloud/worker)
+        gofmt | doc | lib/cli | lib/cloud/azure | lib/cloud/ec2 | lib/cmd | lib/dispatchcloud/ssh_executor | lib/dispatchcloud/worker)
             # don't care whether services are running
             ;;
         *)
@@ -729,7 +764,6 @@ do_test_once() {
         # compilation errors.
         go get -ldflags "-X main.version=${ARVADOS_VERSION:-$(git log -n1 --format=%H)-dev}" -t "git.curoverse.com/arvados.git/$1" && \
             cd "$GOPATH/src/git.curoverse.com/arvados.git/$1" && \
-            [[ -z "$(gofmt -e -d . | tee /dev/stderr)" ]] && \
             if [[ -n "${testargs[$1]}" ]]
         then
             # "go test -check.vv giturl" doesn't work, but this
@@ -746,6 +780,7 @@ do_test_once() {
             go tool cover -html="$WORKSPACE/tmp/.$covername.tmp" -o "$WORKSPACE/tmp/$covername.html"
             rm "$WORKSPACE/tmp/.$covername.tmp"
         fi
+        [[ $result = 0 ]] && gofmt -e -d *.go
     elif [[ "$2" == "pip" ]]
     then
         tries=0
@@ -896,7 +931,7 @@ install_services/api() {
     # database, so that we can drop it. This assumes the current user
     # is a postgresql superuser.
     cd "$WORKSPACE/services/api" \
-        && test_database=$(python -c "import yaml; print yaml.load(file('config/database.yml'))['test']['database']") \
+        && test_database=$(python -c "import yaml; print yaml.safe_load(file('config/database.yml'))['test']['database']") \
         && psql "$test_database" -c "SELECT pg_terminate_backend (pg_stat_activity.pid::int) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$test_database';" 2>/dev/null
 
     mkdir -p "$WORKSPACE/services/api/tmp/pids"
@@ -1003,6 +1038,12 @@ test_doc() {
     )
 }
 
+test_gofmt() {
+    cd "$WORKSPACE" || return 1
+    dirs=$(ls -d */ | egrep -v 'vendor|tmp')
+    [[ -z "$(gofmt -e -d $dirs | tee -a /dev/stderr)" ]]
+}
+
 test_services/api() {
     rm -f "$WORKSPACE/services/api/git-commit.version"
     cd "$WORKSPACE/services/api" \
@@ -1043,17 +1084,17 @@ test_services/nodemanager_integration() {
 
 test_apps/workbench_units() {
     cd "$WORKSPACE/apps/workbench" \
-        && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:units TESTOPTS=-v ${testargs[apps/workbench]}
+        && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:units TESTOPTS=-v ${testargs[apps/workbench]} ${testargs[apps/workbench_units]}
 }
 
 test_apps/workbench_functionals() {
     cd "$WORKSPACE/apps/workbench" \
-        && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:functionals TESTOPTS=-v ${testargs[apps/workbench]}
+        && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:functionals TESTOPTS=-v ${testargs[apps/workbench]} ${testargs[apps/workbench_functionals]}
 }
 
 test_apps/workbench_integration() {
     cd "$WORKSPACE/apps/workbench" \
-        && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:integration TESTOPTS=-v ${testargs[apps/workbench]}
+        && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:integration TESTOPTS=-v ${testargs[apps/workbench]} ${testargs[apps/workbench_integration]}
 }
 
 test_apps/workbench_benchmark() {
@@ -1122,6 +1163,7 @@ test_all() {
         exit_cleanly
     fi
 
+    do_test gofmt
     do_test doc
     do_test sdk/ruby
     do_test sdk/R
@@ -1177,11 +1219,8 @@ for g in "${gostuff[@]}"; do
 done
 for p in "${pythonstuff[@]}"; do
     dir=${p%:py3}
-    if [[ ${dir} = ${p} ]]; then
-        testfuncargs[$p]="$dir pip $VENVDIR/bin/"
-    else
-        testfuncargs[$p]="$dir pip $VENV3DIR/bin/"
-    fi
+    testfuncargs[$dir]="$dir pip $VENVDIR/bin/"
+    testfuncargs[$dir:py3]="$dir pip $VENV3DIR/bin/"
 done
 
 if [[ -z ${interactive} ]]; then
@@ -1193,7 +1232,11 @@ else
     only_install=()
     if [[ -e "$VENVDIR/bin/activate" ]]; then stop_services; fi
     setnextcmd() {
-        if [[ "$nextcmd" != "install deps" ]]; then
+        if [[ "$TERM" = dumb ]]; then
+            # assume emacs, or something, is offering a history buffer
+            # and pre-populating the command will only cause trouble
+            nextcmd=
+        elif [[ "$nextcmd" != "install deps" ]]; then
             :
         elif [[ -e "$VENVDIR/bin/activate" ]]; then
             nextcmd="test lib/cmd"
@@ -1207,30 +1250,34 @@ else
     setnextcmd
     while read -p 'What next? ' -e -i "${nextcmd}" nextcmd; do
         read verb target opts <<<"${nextcmd}"
+        target="${target%/}"
+        target="${target/\/:/:}"
         case "${verb}" in
-            "" | "help")
-                help_interactive
-                ;;
             "exit" | "quit")
                 exit_cleanly
                 ;;
             "reset")
                 stop_services
                 ;;
-            *)
-                target="${target%/}"
-                testargs["$target"]="${opts}"
+            "test" | "install")
                 case "$target" in
+                    "")
+                        help_interactive
+                        ;;
                     all | deps)
                         ${verb}_${target}
                         ;;
                     *)
+                        testargs["$target"]="${opts}"
                         tt="${testfuncargs[${target}]}"
                         tt="${tt:-$target}"
                         do_$verb $tt
                         ;;
                 esac
                 ;;
+            "" | "help" | *)
+                help_interactive
+                ;;
         esac
         if [[ ${#successes[@]} -gt 0 || ${#failures[@]} -gt 0 ]]; then
             report_outcomes
index 837e2a86808b985fb54feac845d8ec12b28b019b..98c572b0119f50e7613bbea7f7776f91a5955583 100644 (file)
@@ -215,6 +215,8 @@ navbar:
       - install/crunch2-slurm/install-test.html.textile.liquid
       - install/install-nodemanager.html.textile.liquid
       - install/install-compute-ping.html.textile.liquid
+    - Containers API support on cloud (experimental):
+      - install/install-dispatch-cloud.html.textile.liquid
     - Jobs API support (deprecated):
       - install/install-crunch-dispatch.html.textile.liquid
       - install/install-compute-node.html.textile.liquid
index c68773d900fd3dec88ec389ce73cc1410ac9ec2d..d611c5b1613ce4ba93c48039c6c335457c5584e4 100644 (file)
@@ -39,6 +39,8 @@ table(table table-bordered table-condensed).
 |current_version_uuid|string|UUID of the collection's current version. On new collections, it'll be equal to the @uuid@ attribute.||
 |version|number|Version number, starting at 1 on new collections. This attribute is read-only.||
 |preserve_version|boolean|When set to true on a current version, it will be saved on the next versionable update.||
+|file_count|number|The total number of files in the collection. This attribute is read-only.||
+|file_size_total|number|The sum of the file sizes in the collection. This attribute is read-only.||
 
 h3. Conditions of creating a Collection
 
index 8827cf8abfd2b1fcbe73849268d7124f43973adf..2d94d32ac5edbb844eaa9dca37c18d49aef7a689 100644 (file)
@@ -31,17 +31,19 @@ h2. Usage
 $ arvbox
 Arvados-in-a-box                      http://arvados.org
 
-build   <config>      build arvbox Docker image
-rebuild <config>      build arvbox Docker image, no layer cache
-start|run <config>  start arvbox container
-open       open arvbox workbench in a web browser
-shell      enter arvbox shell
-ip         print arvbox docker container ip address
-host       print arvbox published host
-status     print some information about current arvbox
+start|run <config> [tag]  start arvbox container
 stop       stop arvbox container
 restart <config>  stop, then run again
-reboot  <config>  stop, build arvbox Docker image, run
+status     print some information about current arvbox
+ip         print arvbox docker container ip address
+host       print arvbox published host
+shell      enter arvbox shell
+open       open arvbox workbench in a web browser
+root-cert  get copy of root certificate
+update  <config> stop, pull latest image, run
+build   <config> build arvbox Docker image
+reboot  <config> stop, build arvbox Docker image, run
+rebuild <config> build arvbox Docker image, no layer cache
 reset      delete arvbox arvados data (be careful!)
 destroy    delete all arvbox code and data (be careful!)
 log <service> tail log of specified service
@@ -52,6 +54,23 @@ sv <start|stop|restart> <service> change state of service inside arvbox
 clone <from> <to>   clone an arvbox
 </pre>
 
+h2. Install root certificate
+
+Arvbox creates root certificate to authorize Arvbox services.  Installing the root certificate into your web browser will prevent security errors when accessing Arvbox services with your web browser.  Every  Arvbox instance generates a new root signing key.
+
+# Export the certificate using @arvbox root-cert@
+# Go to the certificate manager in your browser.
+#* In Chrome, this can be found under "Settings &rarr; Advanced &rarr; Manage Certificates" or by entering @chrome://settings/certificates@ in the URL bar.
+#* In Firefox, this can be found under "Preferences &rarr; Privacy & Security" or entering @about:preferences#privacy@ in the URL bar and then choosing "View Certificates...".
+# Select the "Authorities" tab, then press the "Import" button.  Choose @arvbox-root-cert.pem@
+
+The certificate will be added under the "Arvados testing" organization as "arvbox testing root CA".
+
+To access your Arvbox instance using command line clients (such as arv-get and arv-put) without security errors, install the certificate into the OS certificate storage (instructions for Debian/Ubuntu):
+
+# copy @arvbox-root-cert.pem@ to @/usr/local/share/ca-certificates/@
+# run @/usr/sbin/update-ca-certificates@
+
 h2. Configs
 
 h3. dev
diff --git a/doc/install/install-dispatch-cloud.html.textile.liquid b/doc/install/install-dispatch-cloud.html.textile.liquid
new file mode 100644 (file)
index 0000000..42c814b
--- /dev/null
@@ -0,0 +1,200 @@
+---
+layout: default
+navsection: installguide
+title: Install the cloud dispatcher
+
+...
+{% comment %}
+Copyright (C) The Arvados Authors. All rights reserved.
+
+SPDX-License-Identifier: CC-BY-SA-3.0
+{% endcomment %}
+
+The cloud dispatch service is an *experimental* service for running containers on cloud VMs. It eliminates the need for SLURM, Node Manager, and SLURM dispatcher. It works with Microsoft Azure and Amazon EC2; future versions will also support Google Compute Engine.
+
+The cloud dispatch service can run on any node that can connect to the Arvados API service, the cloud provider's API, and the SSH service on cloud VMs.  It is not resource-intensive, so you can run it on the API server node.
+
+*Only one dispatch process should be running at a time.* If you are migrating a system that currently runs @crunch-dispatch-slurm@, it is safest to remove the @crunch-dispatch-slurm@ service entirely before installing @arvados-dispatch-cloud@.
+
+<notextile>
+<pre><code>~$ <span class="userinput">sudo systemctl --now disable crunch-dispatch-slurm</span>
+~$ <span class="userinput">sudo apt-get remove crunch-dispatch-slurm</span>
+</code></pre>
+</notextile>
+
+h2. Create a dispatcher token
+
+If you haven't already done so, create an Arvados superuser token to use as SystemRootToken in your cluster config file.
+
+{% include 'create_superuser_token' %}
+
+h2. Create a private key
+
+Generate an SSH private key with no passphrase. Save it in the cluster configuration file (see @PrivateKey@ in the example below).
+
+<notextile>
+<pre><code>~$ <span class="userinput">ssh-keygen -N '' -f ~/.ssh/id_dispatcher</span>
+Generating public/private rsa key pair.
+Your identification has been saved in /home/user/.ssh/id_dispatcher.
+Your public key has been saved in /home/user/.ssh/id_dispatcher.pub.
+The key fingerprint is:
+[...]
+~$ <span class="userinput">cat ~/.ssh/id_dispatcher</span>
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpQIBAAKCAQEAqXoCzcOBkFQ7w4dvXf9B++1ctgZRqEbgRYL3SstuMV4oawks
+ttUuxJycDdsPmeYcHsKo8vsEZpN6iYsX6ZZzhkO5nEayUTU8sBjmg1ZCTo4QqKXr
+...
+oFyAjVoexx0RBcH6BveTfQtJKbktP1qBO4mXo2dP0cacuZEtlAqW9Eb06Pvaw/D9
+foktmqOY8MyctzFgXBpGTxPliGjqo8OkrOyQP2g+FL7v+Km31Xs61P8=
+-----END RSA PRIVATE KEY-----
+</code></pre>
+</notextile>
+
+You can delete the key files after you have copied the private key to your configuration file.
+
+<notextile>
+<pre><code>~$ <span class="userinput">rm ~/.ssh/id_dispatcher ~/.ssh/id_dispatcher.pub</span>
+</code></pre>
+</notextile>
+
+h2. Configure the dispatcher
+
+Add or update the following portions of your cluster configuration file, @/etc/arvados/config.yml@. Refer to "config.defaults.yml":https://dev.arvados.org/projects/arvados/repository/revisions/13996-new-api-config/entry/lib/config/config.defaults.yml for information about additional configuration options.
+
+<notextile>
+<pre><code>Clusters:
+  <span class="userinput">uuid_prefix</span>:
+    ManagementToken: xyzzy
+    SystemRootToken: <span class="userinput">zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz</span>
+    NodeProfiles:
+      # The key "apiserver" corresponds to ARVADOS_NODE_PROFILE in environment file (see below).
+      apiserver:
+        arvados-dispatch-cloud:
+          Listen: ":9006"
+    Services:
+      Controller:
+        ExternalURL: "https://<span class="userinput">uuid_prefix.arvadosapi.com</span>"
+    CloudVMs:
+      # BootProbeCommand is a shell command that succeeds when an instance is ready for service
+      BootProbeCommand: "sudo systemctl status docker"
+
+      <b># --- driver-specific configuration goes here --- see Amazon and Azure examples below ---</b>
+
+    Dispatch:
+      PrivateKey: |
+        -----BEGIN RSA PRIVATE KEY-----
+        MIIEpQIBAAKCAQEAqXoCzcOBkFQ7w4dvXf9B++1ctgZRqEbgRYL3SstuMV4oawks
+        ttUuxJycDdsPmeYcHsKo8vsEZpN6iYsX6ZZzhkO5nEayUTU8sBjmg1ZCTo4QqKXr
+        FJ+amZ7oYMDof6QEdwl6KNDfIddL+NfBCLQTVInOAaNss7GRrxLTuTV7HcRaIUUI
+        jYg0Ibg8ZZTzQxCvFXXnjseTgmOcTv7CuuGdt91OVdoq8czG/w8TwOhymEb7mQlt
+        lXuucwQvYgfoUgcnTgpJr7j+hafp75g2wlPozp8gJ6WQ2yBWcfqL2aw7m7Ll88Nd
+        [...]
+        oFyAjVoexx0RBcH6BveTfQtJKbktP1qBO4mXo2dP0cacuZEtlAqW9Eb06Pvaw/D9
+        foktmqOY8MyctzFgXBpGTxPliGjqo8OkrOyQP2g+FL7v+Km31Xs61P8=
+        -----END RSA PRIVATE KEY-----
+    InstanceTypes:
+      x1md:
+        ProviderType: x1.medium
+        VCPUs: 8
+        RAM: 64GiB
+        IncludedScratch: 64GB
+        Price: 0.62
+      x1lg:
+        ProviderType: x1.large
+        VCPUs: 16
+        RAM: 128GiB
+        IncludedScratch: 128GB
+        Price: 1.23
+</code></pre>
+</notextile>
+
+Minimal configuration example for Amazon EC2:
+
+<notextile>
+<pre><code>Clusters:
+  <span class="userinput">uuid_prefix</span>:
+    CloudVMs:
+      ImageID: ami-01234567890abcdef
+      Driver: ec2
+      DriverParameters:
+        AccessKeyID: EALMF21BJC7MKNF9FVVR
+        SecretAccessKey: yKJAPmoCQOMtYWzEUQ1tKTyrocTcbH60CRvGP3pM
+        SecurityGroupIDs:
+        - sg-0123abcd
+        SubnetID: subnet-0123abcd
+        Region: us-east-1
+        EBSVolumeType: gp2
+        AdminUsername: debian
+</code></pre>
+</notextile>
+
+Minimal configuration example for Azure:
+
+<notextile>
+<pre><code>Clusters:
+  <span class="userinput">uuid_prefix</span>:
+    CloudVMs:
+      ImageID: "https://zzzzzzzz.blob.core.windows.net/system/Microsoft.Compute/Images/images/zzzzz-compute-osDisk.55555555-5555-5555-5555-555555555555.vhd"
+      Driver: azure
+      DriverParameters:
+        SubscriptionID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+        ClientID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+        ClientSecret: 2WyXt0XFbEtutnf2hp528t6Wk9S5bOHWkRaaWwavKQo=
+        TenantID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+        CloudEnvironment: AzurePublicCloud
+        ResourceGroup: zzzzz
+        Location: centralus
+        Network: zzzzz
+        Subnet: zzzzz-subnet-private
+        StorageAccount: example
+        BlobContainer: vhds
+        DeleteDanglingResourcesAfter: 20s
+        AdminUsername: arvados
+</code></pre>
+</notextile>
+
+Create the host configuration file @/etc/arvados/environment@.
+
+<notextile>
+<pre><code>ARVADOS_NODE_PROFILE=apiserver
+</code></pre>
+</notextile>
+
+h2. Install the dispatcher
+
+First, "add the appropriate package repository for your distribution":{{ site.baseurl }}/install/install-manual-prerequisites.html#repos.
+
+On Red Hat-based systems:
+
+<notextile>
+<pre><code>~$ <span class="userinput">sudo yum install arvados-dispatch-cloud</span>
+~$ <span class="userinput">sudo systemctl enable arvados-dispatch-cloud</span>
+</code></pre>
+</notextile>
+
+On Debian-based systems:
+
+<notextile>
+<pre><code>~$ <span class="userinput">sudo apt-get install arvados-dispatch-cloud</span>
+</code></pre>
+</notextile>
+
+{% include 'notebox_begin' %}
+
+The arvados-dispatch-cloud package includes configuration files for systemd. If you're using a different init system, configure a service to start and stop an @arvados-dispatch-cloud@ process as desired.
+
+{% include 'notebox_end' %}
+
+h2. Verify the dispatcher is running
+
+Use your ManagementToken to test the dispatcher's metrics endpoint.
+
+<notextile>
+<pre><code>~$ <span class="userinput">token="xyzzy"</span>
+~$ <span class="userinput">curl -H "Authorization: Bearer $token" http://localhost:9006/metrics</span>
+# HELP arvados_dispatchcloud_containers_running Number of containers reported running by cloud VMs.
+# TYPE arvados_dispatchcloud_containers_running gauge
+arvados_dispatchcloud_containers_running 0
+[...]
+</code></pre>
+</notextile>
index defec2589e82a3f32266f39e500c54401ee57683..770527da1fe4096af877a67363ee4d6e369a0a7d 100644 (file)
@@ -556,7 +556,7 @@ subscription_id = 00000000-0000-0000-0000-000000000000
 # https://azure.microsoft.com/en-us/documentation/articles/resource-group-authenticate-service-principal/
 # and updated for v2 of the Azure cli tool.
 #
-# az ad app create --display-name "Node Manager" --homepage "https://arvados.org" --identifier-uris "https://<Your_Application_Uri>" --password <Your_Password>
+# az ad app create --display-name "Node Manager" --homepage "https://arvados.org" --identifier-uris "https://<Your_Application_Uri>" --password <Your_Password> --end-date <Desired_credential_expiry_date>
 # az ad sp create "<Application_Id>"
 # az role assignment create --assignee "<Application_Id>" --role Owner --resource-group "<Your_Azure_Arvados_Resource_Group>"
 #
index d37183fbdf5e5f4b7ec639a61be1abf960a4f200..ac7ff14cc2539ff7c1305fc7df393c7e36d0a795 100644 (file)
@@ -649,14 +649,17 @@ func (ai *azureInstance) Destroy() error {
 }
 
 func (ai *azureInstance) Address() string {
-       if ai.nic.IPConfigurations != nil &&
-               len(*ai.nic.IPConfigurations) > 0 &&
-               (*ai.nic.IPConfigurations)[0].InterfaceIPConfigurationPropertiesFormat != nil &&
-               (*ai.nic.IPConfigurations)[0].InterfaceIPConfigurationPropertiesFormat.PrivateIPAddress != nil {
-
-               return *(*ai.nic.IPConfigurations)[0].PrivateIPAddress
+       if iprops := ai.nic.InterfacePropertiesFormat; iprops == nil {
+               return ""
+       } else if ipconfs := iprops.IPConfigurations; ipconfs == nil || len(*ipconfs) == 0 {
+               return ""
+       } else if ipconfprops := (*ipconfs)[0].InterfaceIPConfigurationPropertiesFormat; ipconfprops == nil {
+               return ""
+       } else if addr := ipconfprops.PrivateIPAddress; addr == nil {
+               return ""
+       } else {
+               return *addr
        }
-       return ""
 }
 
 func (ai *azureInstance) RemoteUser() string {
index 8afe828196d9ea029e2f66a411b9e9f40225efee..028083fa0d1a23442f527b24f8ce95aacff660f4 100644 (file)
@@ -256,8 +256,13 @@ func (r *Reporter) doMemoryStats() {
        }
        var outstat bytes.Buffer
        for _, key := range wantStats {
-               if val, ok := thisSample.memStat[key]; ok {
-                       outstat.WriteString(fmt.Sprintf(" %d %s", val, key))
+               // Use "total_X" stats (entire hierarchy) if enabled,
+               // otherwise just the single cgroup -- see
+               // https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt
+               if val, ok := thisSample.memStat["total_"+key]; ok {
+                       fmt.Fprintf(&outstat, " %d %s", val, key)
+               } else if val, ok := thisSample.memStat[key]; ok {
+                       fmt.Fprintf(&outstat, " %d %s", val, key)
                }
        }
        r.Logger.Printf("mem%s\n", outstat.String())
index af17aaf3927ce9f3b8b94a03ca289201c11640d2..50e73189efbc854433f8713e0a7762efafc0fe70 100644 (file)
@@ -314,15 +314,14 @@ func (cq *Queue) setRuntimeError(uuid, errorString string) error {
 
 // Cancel cancels the given container.
 func (cq *Queue) Cancel(uuid string) error {
-       err := cq.client.RequestAndDecode(nil, "PUT", "arvados/v1/containers/"+uuid, nil, map[string]map[string]interface{}{
+       var resp arvados.Container
+       err := cq.client.RequestAndDecode(&resp, "PUT", "arvados/v1/containers/"+uuid, nil, map[string]map[string]interface{}{
                "container": {"state": arvados.ContainerStateCancelled},
        })
        if err != nil {
                return err
        }
-       cq.mtx.Lock()
-       defer cq.mtx.Unlock()
-       cq.notify()
+       cq.updateWithResp(uuid, resp)
        return nil
 }
 
@@ -332,7 +331,13 @@ func (cq *Queue) apiUpdate(uuid, action string) error {
        if err != nil {
                return err
        }
+       cq.updateWithResp(uuid, resp)
+       return nil
+}
 
+// Update the local queue with the response received from a
+// state-changing API request (lock/unlock/cancel).
+func (cq *Queue) updateWithResp(uuid string, resp arvados.Container) {
        cq.mtx.Lock()
        defer cq.mtx.Unlock()
        if cq.dontupdate != nil {
@@ -345,7 +350,6 @@ func (cq *Queue) apiUpdate(uuid, action string) error {
                cq.current[uuid] = ent
        }
        cq.notify()
-       return nil
 }
 
 func (cq *Queue) poll() (map[string]*arvados.Container, error) {
index 91d65359e884a91955f47523a7d11836a52767df..3c63fe51e6e89a116a40ea5c72917a5d4528ab41 100644 (file)
@@ -74,6 +74,7 @@ func (suite *IntegrationSuite) TestGetLockUnlockCancel(c *check.C) {
                        defer wg.Done()
                        err := cq.Unlock(uuid)
                        c.Check(err, check.NotNil)
+
                        err = cq.Lock(uuid)
                        c.Check(err, check.IsNil)
                        ctr, ok := cq.Get(uuid)
@@ -81,6 +82,7 @@ func (suite *IntegrationSuite) TestGetLockUnlockCancel(c *check.C) {
                        c.Check(ctr.State, check.Equals, arvados.ContainerStateLocked)
                        err = cq.Lock(uuid)
                        c.Check(err, check.NotNil)
+
                        err = cq.Unlock(uuid)
                        c.Check(err, check.IsNil)
                        ctr, ok = cq.Get(uuid)
@@ -88,6 +90,14 @@ func (suite *IntegrationSuite) TestGetLockUnlockCancel(c *check.C) {
                        c.Check(ctr.State, check.Equals, arvados.ContainerStateQueued)
                        err = cq.Unlock(uuid)
                        c.Check(err, check.NotNil)
+
+                       err = cq.Cancel(uuid)
+                       c.Check(err, check.IsNil)
+                       ctr, ok = cq.Get(uuid)
+                       c.Check(ok, check.Equals, true)
+                       c.Check(ctr.State, check.Equals, arvados.ContainerStateCancelled)
+                       err = cq.Lock(uuid)
+                       c.Check(err, check.NotNil)
                }()
        }
        wg.Wait()
index d97e7428da0488e04009d4a0baeca01bbb18aa8b..1052fb0d76606ddf160c685830a88649b7c40acf 100644 (file)
@@ -40,6 +40,7 @@ setup(name='arvados-cwl-runner',
           'arvados-python-client>=1.3.0.20190205182514',
           'setuptools',
           'ciso8601 >= 2.0.0',
+          'networkx < 2.3'
       ],
       extras_require={
           ':os.name=="posix" and python_version<"3"': ['subprocess32 >= 3.5.1'],
index ebb0fb220fd556a93a96d0d8440a001af3659b3c..e795f026eab11028732bfbe82f6b9037e0dff6e1 100644 (file)
@@ -20,6 +20,9 @@ requirements:
       ARVADOS_API_TOKEN: $(inputs.arvados_api_token)
       ARVADOS_API_HOST_INSECURE: $(""+inputs.arvado_api_host_insecure)
   InlineJavascriptRequirement: {}
+hints:
+  DockerRequirement:
+    dockerPull: arvados/jobs
 inputs:
   arvados_api_token: string
   arvado_api_host_insecure: boolean
@@ -39,4 +42,4 @@ outputs:
       glob: success
       loadContents: true
       outputEval: $(self[0].contents=="true")
-baseCommand: python2
\ No newline at end of file
+baseCommand: python
index 03f792c5e1b111c47f8d7acf33c7e544172d7579..f377d7348275bb86f5b2f50013a2bfa34133d500 100644 (file)
@@ -24,6 +24,9 @@ requirements:
       ARVADOS_API_TOKEN: $(inputs.arvados_api_token)
       ARVADOS_API_HOST_INSECURE: $(""+inputs.arvado_api_host_insecure)
   InlineJavascriptRequirement: {}
+hints:
+  DockerRequirement:
+    dockerPull: arvados/jobs
 inputs:
   arvados_api_token: string
   arvado_api_host_insecure: boolean
@@ -45,4 +48,4 @@ outputs:
     type: boolean
     outputBinding:
       outputEval: $(true)
-baseCommand: python2
\ No newline at end of file
+baseCommand: python
index 37ff4d818a2ee33d1930a4842927f6a4994e33b7..cbc2ca72f035f150fce46613fa015d299a9bbd7b 100644 (file)
@@ -79,7 +79,7 @@ func NewClientFromConfig(cluster *Cluster) (*Client, error) {
                return nil, fmt.Errorf("no host in config Services.Controller.ExternalURL: %v", ctrlURL)
        }
        return &Client{
-               APIHost:  fmt.Sprintf("%v", ctrlURL),
+               APIHost:  ctrlURL.Host,
                Insecure: cluster.TLS.Insecure,
        }, nil
 }
index 130d8c964df2fdbc9931394049feb1bcf717dafd..1ef3b00c665e89c61aaa7853c7b0b455c944259a 100644 (file)
@@ -12,6 +12,10 @@ http {
     '"$http_referer" "$http_user_agent"';
   access_log "{{ACCESSLOG}}" customlog;
   client_body_temp_path "{{TMPDIR}}";
+  proxy_temp_path "{{TMPDIR}}";
+  fastcgi_temp_path "{{TMPDIR}}";
+  uwsgi_temp_path "{{TMPDIR}}";
+  scgi_temp_path "{{TMPDIR}}";
   upstream arv-git-http {
     server localhost:{{GITPORT}};
   }
index 7b1f6059aeef07b8ff2a2d03a6d4980f9d5a835f..6687ca491a769140aa8c803a5fd2b1a6ce3b1850 100644 (file)
@@ -582,6 +582,7 @@ def stop_keep(num_servers=2):
 
 def run_keep_proxy():
     if 'ARVADOS_TEST_PROXY_SERVICES' in os.environ:
+        os.environ["ARVADOS_KEEP_SERVICES"] = "http://localhost:{}".format(_getport('keepproxy'))
         return
     stop_keep_proxy()
 
@@ -738,7 +739,7 @@ def _getport(program):
 def _dbconfig(key):
     global _cached_db_config
     if not _cached_db_config:
-        _cached_db_config = yaml.load(open(os.path.join(
+        _cached_db_config = yaml.safe_load(open(os.path.join(
             SERVICES_SRC_DIR, 'api', 'config', 'database.yml')))
     return _cached_db_config['test'][key]
 
@@ -750,7 +751,7 @@ def _apiconfig(key):
         fullpath = os.path.join(SERVICES_SRC_DIR, 'api', 'config', f)
         if not required and not os.path.exists(fullpath):
             return {}
-        return yaml.load(fullpath)
+        return yaml.safe_load(fullpath)
     cdefault = _load('application.default.yml')
     csite = _load('application.yml', required=False)
     _cached_config = {}
@@ -769,7 +770,7 @@ def fixture(fix):
           yaml_file = yaml_file[0:trim_index]
         except ValueError:
           pass
-        return yaml.load(yaml_file)
+        return yaml.safe_load(yaml_file)
 
 def auth_token(token_name):
     return fixture("api_client_authorizations")[token_name]["api_token"]
index 01a52a5e6681ec07daaf16eb0c0c18a9b7ba2ada..540e06c6c6a0d571e7a269e5eae7c9e8a1989419 100644 (file)
@@ -859,7 +859,7 @@ class ArvPutIntegrationTest(run_test_server.TestCaseWithServers,
             if not mandatory and not os.path.exists(path):
                 continue
             with open(path) as f:
-                rails_config = yaml.load(f.read())
+                rails_config = yaml.safe_load(f.read())
                 for config_section in ['test', 'common']:
                     try:
                         key = rails_config[config_section]["blob_signing_key"]
index 2cda8bcb1441967135b1feb5c2adf344e970da81..793e981b505abb63cef5730b5f299afaf42564a6 100644 (file)
@@ -33,3 +33,6 @@
 
 # Generated when building distribution packages
 /package-build.version
+
+# Debugger history
+.byebug_history
\ No newline at end of file
index 25e441bfca87842ccbb9fd3a0bd7343587550fcf..6d42956940972da3ba776637345b6f321258a769 100644 (file)
@@ -4,14 +4,17 @@
 
 source 'https://rubygems.org'
 
-gem 'rails', '~> 4.2'
+gem 'rails', '~> 5.0.0'
 gem 'responders', '~> 2.0'
-gem 'protected_attributes'
 
 group :test, :development do
   gem 'factory_bot_rails'
   gem 'database_cleaner'
-  gem 'ruby-prof'
+
+  # As of now (2019-03-27) There's an open issue about incompatibilities with
+  # newer versions of this gem: https://github.com/rails/rails-perftest/issues/38
+  gem 'ruby-prof', '~> 0.15.0'
+
   # Note: "require: false" here tells bunder not to automatically
   # 'require' the packages during application startup. Installation is
   # still mandatory.
@@ -19,26 +22,17 @@ group :test, :development do
   gem 'simplecov', '~> 0.7.1', require: false
   gem 'simplecov-rcov', require: false
   gem 'mocha', require: false
+  gem 'byebug'
 end
 
 # We need this dependency because of crunchv1
 gem 'arvados-cli'
 
-# We'll need to update related code prior to Rails 5.
-# See: https://github.com/rails/activerecord-deprecated_finders
-gem 'activerecord-deprecated_finders', require: 'active_record/deprecated_finders'
-
-# pg is the only supported database driver.
-# Note: Rails 4.2 is not compatible with pg 1.0
-#       (See: https://github.com/rails/rails/pull/31671)
-gem 'pg', '~> 0.18'
+gem 'pg', '~> 1.0'
 
 gem 'multi_json'
 gem 'oj'
 
-# for building assets
-gem 'sass-rails',   '~> 4.0'
-gem 'coffee-rails', '~> 4.0'
 gem 'therubyracer'
 gem 'uglifier', '~> 2.0'
 
@@ -50,15 +44,16 @@ gem 'acts_as_api'
 
 gem 'passenger'
 
+# Locking to 5.10.3 to workaround issue in 5.11.1 (https://github.com/seattlerb/minitest/issues/730)
+gem 'minitest', '5.10.3'
+
 # Restricted because omniauth >= 1.5.0 requires Ruby >= 2.1.9:
 gem 'omniauth', '~> 1.4.0'
 gem 'omniauth-oauth2', '~> 1.1'
 
 gem 'andand'
 
-gem 'test_after_commit', :group => :test
-
-gem 'trollop'
+gem 'optimist'
 gem 'faye-websocket'
 
 gem 'themes_for_rails', git: 'https://github.com/curoverse/themes_for_rails'
@@ -73,6 +68,9 @@ gem 'logstash-event'
 
 gem 'rails-observers'
 
+gem 'rails-perftest'
+gem 'rails-controller-testing'
+
 # Install any plugin gems
 Dir.glob(File.join(File.dirname(__FILE__), 'lib', '**', "Gemfile")) do |f|
     eval(IO.read(f), binding)
index 6e2fa2cd66e3a2ddcf56502e95ae970940612ca0..13f7564be86576c231d35a6f04da416738a59954 100644 (file)
@@ -1,6 +1,6 @@
 GIT
   remote: https://github.com/curoverse/themes_for_rails
-  revision: 61154877047d2346890bda0b7be5827cf51a6a76
+  revision: ddf6e592b3b6493ea0c2de7b5d3faa120ed35be0
   specs:
     themes_for_rails (0.5.1)
       rails (>= 3.0.0)
@@ -8,40 +8,42 @@ GIT
 GEM
   remote: https://rubygems.org/
   specs:
-    actionmailer (4.2.11)
-      actionpack (= 4.2.11)
-      actionview (= 4.2.11)
-      activejob (= 4.2.11)
+    actioncable (5.0.7.2)
+      actionpack (= 5.0.7.2)
+      nio4r (>= 1.2, < 3.0)
+      websocket-driver (~> 0.6.1)
+    actionmailer (5.0.7.2)
+      actionpack (= 5.0.7.2)
+      actionview (= 5.0.7.2)
+      activejob (= 5.0.7.2)
       mail (~> 2.5, >= 2.5.4)
-      rails-dom-testing (~> 1.0, >= 1.0.5)
-    actionpack (4.2.11)
-      actionview (= 4.2.11)
-      activesupport (= 4.2.11)
-      rack (~> 1.6)
-      rack-test (~> 0.6.2)
-      rails-dom-testing (~> 1.0, >= 1.0.5)
+      rails-dom-testing (~> 2.0)
+    actionpack (5.0.7.2)
+      actionview (= 5.0.7.2)
+      activesupport (= 5.0.7.2)
+      rack (~> 2.0)
+      rack-test (~> 0.6.3)
+      rails-dom-testing (~> 2.0)
       rails-html-sanitizer (~> 1.0, >= 1.0.2)
-    actionview (4.2.11)
-      activesupport (= 4.2.11)
+    actionview (5.0.7.2)
+      activesupport (= 5.0.7.2)
       builder (~> 3.1)
       erubis (~> 2.7.0)
-      rails-dom-testing (~> 1.0, >= 1.0.5)
+      rails-dom-testing (~> 2.0)
       rails-html-sanitizer (~> 1.0, >= 1.0.3)
-    activejob (4.2.11)
-      activesupport (= 4.2.11)
-      globalid (>= 0.3.0)
-    activemodel (4.2.11)
-      activesupport (= 4.2.11)
-      builder (~> 3.1)
-    activerecord (4.2.11)
-      activemodel (= 4.2.11)
-      activesupport (= 4.2.11)
-      arel (~> 6.0)
-    activerecord-deprecated_finders (1.0.4)
-    activesupport (4.2.11)
-      i18n (~> 0.7)
+    activejob (5.0.7.2)
+      activesupport (= 5.0.7.2)
+      globalid (>= 0.3.6)
+    activemodel (5.0.7.2)
+      activesupport (= 5.0.7.2)
+    activerecord (5.0.7.2)
+      activemodel (= 5.0.7.2)
+      activesupport (= 5.0.7.2)
+      arel (~> 7.0)
+    activesupport (5.0.7.2)
+      concurrent-ruby (~> 1.0, >= 1.0.2)
+      i18n (>= 0.7, < 2)
       minitest (~> 5.1)
-      thread_safe (~> 0.3, >= 0.3.4)
       tzinfo (~> 1.1)
     acts_as_api (1.0.1)
       activemodel (>= 3.0.0)
@@ -50,71 +52,65 @@ GEM
     addressable (2.6.0)
       public_suffix (>= 2.0.2, < 4.0)
     andand (1.3.3)
-    arel (6.0.4)
-    arvados (1.3.1.20190301212059)
+    arel (7.1.4)
+    arvados (1.3.1.20190320201707)
       activesupport (>= 3)
       andand (~> 1.3, >= 1.3.3)
-      cure-google-api-client (>= 0.7, < 0.8.9)
+      arvados-google-api-client (>= 0.7, < 0.8.9)
       i18n (~> 0)
       json (>= 1.7.7, < 3)
       jwt (>= 0.1.5, < 2)
-    arvados-cli (1.3.1.20190211211047)
-      activesupport (>= 3.2.13, < 5)
+    arvados-cli (1.3.1.20190320201707)
+      activesupport (>= 3.2.13, < 5.1)
       andand (~> 1.3, >= 1.3.3)
       arvados (~> 1.3.0, >= 1.3.0)
+      arvados-google-api-client (~> 0.6, >= 0.6.3, < 0.8.9)
       curb (~> 0.8)
-      cure-google-api-client (~> 0.6, >= 0.6.3, < 0.8.9)
       json (>= 1.7.7, < 3)
       oj (~> 3.0)
       optimist (~> 3.0)
+    arvados-google-api-client (0.8.7.2)
+      activesupport (>= 3.2, < 5.1)
+      addressable (~> 2.3)
+      autoparse (~> 0.3)
+      extlib (~> 0.9)
+      faraday (~> 0.9)
+      googleauth (~> 0.3)
+      launchy (~> 2.4)
+      multi_json (~> 1.10)
+      retriable (~> 1.4)
+      signet (~> 0.6)
     autoparse (0.3.3)
       addressable (>= 2.3.1)
       extlib (>= 0.9.15)
       multi_json (>= 1.0.0)
     builder (3.2.3)
+    byebug (11.0.1)
     capistrano (2.15.9)
       highline
       net-scp (>= 1.0.0)
       net-sftp (>= 2.0.0)
       net-ssh (>= 2.0.14)
       net-ssh-gateway (>= 1.1.0)
-    coffee-rails (4.2.2)
-      coffee-script (>= 2.2.0)
-      railties (>= 4.0.0)
-    coffee-script (2.4.1)
-      coffee-script-source
-      execjs
-    coffee-script-source (1.12.2)
-    concurrent-ruby (1.1.4)
+    concurrent-ruby (1.1.5)
     crass (1.0.4)
-    curb (0.9.8)
-    cure-google-api-client (0.8.7.1)
-      activesupport (>= 3.2, < 5.0)
-      addressable (~> 2.3)
-      autoparse (~> 0.3)
-      extlib (~> 0.9)
-      faraday (~> 0.9)
-      googleauth (~> 0.3)
-      launchy (~> 2.4)
-      multi_json (~> 1.10)
-      retriable (~> 1.4)
-      signet (~> 0.6)
+    curb (0.9.9)
     database_cleaner (1.7.0)
     erubis (2.7.0)
-    eventmachine (1.2.6)
+    eventmachine (1.2.7)
     execjs (2.7.0)
     extlib (0.9.16)
-    factory_bot (4.11.1)
-      activesupport (>= 3.0.0)
-    factory_bot_rails (4.11.1)
-      factory_bot (~> 4.11.1)
-      railties (>= 3.0.0)
-    faraday (0.12.2)
+    factory_bot (5.0.2)
+      activesupport (>= 4.2.0)
+    factory_bot_rails (5.0.1)
+      factory_bot (~> 5.0.0)
+      railties (>= 4.2.0)
+    faraday (0.15.4)
       multipart-post (>= 1.2, < 3)
     faye-websocket (0.10.7)
       eventmachine (>= 0.12.0)
       websocket-driver (>= 0.5.1)
-    globalid (0.4.1)
+    globalid (0.4.2)
       activesupport (>= 4.2.0)
     googleauth (0.8.0)
       faraday (~> 0.12)
@@ -123,9 +119,8 @@ GEM
       multi_json (~> 1.11)
       os (>= 0.9, < 2.0)
       signet (~> 0.7)
-    hashie (3.5.7)
-    highline (1.7.10)
-    hike (1.2.3)
+    hashie (3.6.0)
+    highline (2.0.1)
     httpclient (2.8.3)
     i18n (0.9.5)
       concurrent-ruby (~> 1.0)
@@ -151,30 +146,32 @@ GEM
       mini_mime (>= 0.1.1)
     memoist (0.16.0)
     metaclass (0.0.4)
+    method_source (0.9.2)
     mini_mime (1.0.1)
     mini_portile2 (2.4.0)
-    minitest (5.11.3)
-    mocha (1.5.0)
+    minitest (5.10.3)
+    mocha (1.8.0)
       metaclass (~> 0.0.1)
     multi_json (1.13.1)
     multi_xml (0.6.0)
     multipart-post (2.0.0)
-    net-scp (1.2.1)
-      net-ssh (>= 2.6.5)
+    net-scp (2.0.0)
+      net-ssh (>= 2.6.5, < 6.0.0)
     net-sftp (2.1.2)
       net-ssh (>= 2.6.5)
-    net-ssh (4.2.0)
+    net-ssh (5.2.0)
     net-ssh-gateway (2.0.0)
       net-ssh (>= 4.0.0)
-    nokogiri (1.9.1)
+    nio4r (2.3.1)
+    nokogiri (1.10.2)
       mini_portile2 (~> 2.4.0)
-    oauth2 (1.4.0)
-      faraday (>= 0.8, < 0.13)
-      jwt (~> 1.0)
+    oauth2 (1.4.1)
+      faraday (>= 0.8, < 0.16.0)
+      jwt (>= 1.0, < 3.0)
       multi_json (~> 1.3)
       multi_xml (~> 0.5)
       rack (>= 1.2, < 3)
-    oj (3.7.9)
+    oj (3.7.11)
     omniauth (1.4.3)
       hashie (>= 1.2, < 4)
       rack (>= 1.6.2, < 3)
@@ -183,61 +180,57 @@ GEM
       omniauth (~> 1.2)
     optimist (3.0.0)
     os (1.0.0)
-    passenger (5.3.0)
+    passenger (6.0.2)
       rack
       rake (>= 0.8.1)
-    pg (0.21.0)
-    power_assert (1.1.1)
-    protected_attributes (1.1.4)
-      activemodel (>= 4.0.1, < 5.0)
+    pg (1.1.4)
+    power_assert (1.1.4)
     public_suffix (3.0.3)
-    rack (1.6.11)
+    rack (2.0.7)
     rack-test (0.6.3)
       rack (>= 1.0)
-    rails (4.2.11)
-      actionmailer (= 4.2.11)
-      actionpack (= 4.2.11)
-      actionview (= 4.2.11)
-      activejob (= 4.2.11)
-      activemodel (= 4.2.11)
-      activerecord (= 4.2.11)
-      activesupport (= 4.2.11)
-      bundler (>= 1.3.0, < 2.0)
-      railties (= 4.2.11)
-      sprockets-rails
-    rails-deprecated_sanitizer (1.0.3)
-      activesupport (>= 4.2.0.alpha)
-    rails-dom-testing (1.0.9)
-      activesupport (>= 4.2.0, < 5.0)
-      nokogiri (~> 1.6)
-      rails-deprecated_sanitizer (>= 1.0.1)
+    rails (5.0.7.2)
+      actioncable (= 5.0.7.2)
+      actionmailer (= 5.0.7.2)
+      actionpack (= 5.0.7.2)
+      actionview (= 5.0.7.2)
+      activejob (= 5.0.7.2)
+      activemodel (= 5.0.7.2)
+      activerecord (= 5.0.7.2)
+      activesupport (= 5.0.7.2)
+      bundler (>= 1.3.0)
+      railties (= 5.0.7.2)
+      sprockets-rails (>= 2.0.0)
+    rails-controller-testing (1.0.4)
+      actionpack (>= 5.0.1.x)
+      actionview (>= 5.0.1.x)
+      activesupport (>= 5.0.1.x)
+    rails-dom-testing (2.0.3)
+      activesupport (>= 4.2.0)
+      nokogiri (>= 1.6)
     rails-html-sanitizer (1.0.4)
       loofah (~> 2.2, >= 2.2.2)
     rails-observers (0.1.5)
       activemodel (>= 4.0)
-    railties (4.2.11)
-      actionpack (= 4.2.11)
-      activesupport (= 4.2.11)
+    rails-perftest (0.0.7)
+    railties (5.0.7.2)
+      actionpack (= 5.0.7.2)
+      activesupport (= 5.0.7.2)
+      method_source
       rake (>= 0.8.7)
       thor (>= 0.18.1, < 2.0)
     rake (12.3.2)
     ref (2.0.0)
     request_store (1.4.1)
       rack (>= 1.4)
-    responders (2.4.0)
-      actionpack (>= 4.2.0, < 5.3)
-      railties (>= 4.2.0, < 5.3)
+    responders (2.4.1)
+      actionpack (>= 4.2.0, < 6.0)
+      railties (>= 4.2.0, < 6.0)
     retriable (1.4.1)
-    ruby-prof (0.17.0)
+    ruby-prof (0.15.9)
     rvm-capistrano (1.5.6)
       capistrano (~> 2.15.4)
-    safe_yaml (1.0.4)
-    sass (3.2.19)
-    sass-rails (4.0.5)
-      railties (>= 4.0.0, < 5.0)
-      sass (~> 3.2.2)
-      sprockets (~> 2.8, < 3.0)
-      sprockets-rails (~> 2.0)
+    safe_yaml (1.0.5)
     signet (0.11.0)
       addressable (~> 2.3)
       faraday (~> 0.9)
@@ -249,33 +242,27 @@ GEM
     simplecov-html (0.7.1)
     simplecov-rcov (0.2.3)
       simplecov (>= 0.4.1)
-    sprockets (2.12.5)
-      hike (~> 1.2)
-      multi_json (~> 1.0)
-      rack (~> 1.0)
-      tilt (~> 1.1, != 1.3.0)
-    sprockets-rails (2.3.3)
-      actionpack (>= 3.0)
-      activesupport (>= 3.0)
-      sprockets (>= 2.8, < 4.0)
-    sshkey (1.9.0)
-    test-unit (3.2.7)
+    sprockets (3.7.2)
+      concurrent-ruby (~> 1.0)
+      rack (> 1, < 3)
+    sprockets-rails (3.2.1)
+      actionpack (>= 4.0)
+      activesupport (>= 4.0)
+      sprockets (>= 3.0.0)
+    sshkey (2.0.0)
+    test-unit (3.3.1)
       power_assert
-    test_after_commit (1.1.0)
-      activerecord (>= 3.2)
     therubyracer (0.12.3)
       libv8 (~> 3.16.14.15)
       ref
     thor (0.20.3)
     thread_safe (0.3.6)
-    tilt (1.4.1)
-    trollop (2.9.9)
     tzinfo (1.2.5)
       thread_safe (~> 0.1)
     uglifier (2.7.2)
       execjs (>= 0.3.0)
       json (>= 1.8.0)
-    websocket-driver (0.7.0)
+    websocket-driver (0.6.5)
       websocket-extensions (>= 0.1.0)
     websocket-extensions (0.1.3)
 
@@ -283,12 +270,11 @@ PLATFORMS
   ruby
 
 DEPENDENCIES
-  activerecord-deprecated_finders
   acts_as_api
   andand
   arvados (>= 1.3.1.20190301212059)
   arvados-cli
-  coffee-rails (~> 4.0)
+  byebug
   database_cleaner
   factory_bot_rails
   faye-websocket
@@ -296,30 +282,30 @@ DEPENDENCIES
   jquery-rails
   lograge
   logstash-event
+  minitest (= 5.10.3)
   mocha
   multi_json
   oj
   omniauth (~> 1.4.0)
   omniauth-oauth2 (~> 1.1)
+  optimist
   passenger
-  pg (~> 0.18)
-  protected_attributes
-  rails (~> 4.2)
+  pg (~> 1.0)
+  rails (~> 5.0.0)
+  rails-controller-testing
   rails-observers
+  rails-perftest
   responders (~> 2.0)
-  ruby-prof
+  ruby-prof (~> 0.15.0)
   rvm-capistrano
   safe_yaml
-  sass-rails (~> 4.0)
   simplecov (~> 0.7.1)
   simplecov-rcov
   sshkey
   test-unit (~> 3.0)
-  test_after_commit
   themes_for_rails!
   therubyracer
-  trollop
   uglifier (~> 2.0)
 
 BUNDLED WITH
-   1.17.2
+   1.16.6
index 3de2d273bf98f3246cc8745e8f46d9e57ab74723..70ceb653e6f72afc79de5be38c5005486c1d2324 100644 (file)
@@ -7,6 +7,7 @@
 # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
 
 require File.expand_path('../config/application', __FILE__)
+require 'rake/testtask'
 
 Server::Application.load_tasks
 
index 6dbba1a24b088ad036bdd78af93816cdcaca9970..b613e97a10133adf5be8160057d66b31ed3a84a6 100644 (file)
@@ -33,24 +33,24 @@ class ApplicationController < ActionController::Base
 
   ERROR_ACTIONS = [:render_error, :render_not_found]
 
-  around_filter :set_current_request_id
-  before_filter :disable_api_methods
-  before_filter :set_cors_headers
-  before_filter :respond_with_json_by_default
-  before_filter :remote_ip
-  before_filter :load_read_auths
-  before_filter :require_auth_scope, except: ERROR_ACTIONS
-
-  before_filter :catch_redirect_hint
-  before_filter(:find_object_by_uuid,
+  around_action :set_current_request_id
+  before_action :disable_api_methods
+  before_action :set_cors_headers
+  before_action :respond_with_json_by_default
+  before_action :remote_ip
+  before_action :load_read_auths
+  before_action :require_auth_scope, except: ERROR_ACTIONS
+
+  before_action :catch_redirect_hint
+  before_action(:find_object_by_uuid,
                 except: [:index, :create] + ERROR_ACTIONS)
-  before_filter :load_required_parameters
-  before_filter :load_limit_offset_order_params, only: [:index, :contents]
-  before_filter :load_where_param, only: [:index, :contents]
-  before_filter :load_filters_param, only: [:index, :contents]
-  before_filter :find_objects_for_index, :only => :index
-  before_filter :reload_object_before_update, :only => :update
-  before_filter(:render_404_if_no_object,
+  before_action :load_required_parameters
+  before_action :load_limit_offset_order_params, only: [:index, :contents]
+  before_action :load_where_param, only: [:index, :contents]
+  before_action :load_filters_param, only: [:index, :contents]
+  before_action :find_objects_for_index, :only => :index
+  before_action :reload_object_before_update, :only => :update
+  before_action(:render_404_if_no_object,
                 except: [:index, :create] + ERROR_ACTIONS)
 
   theme Rails.configuration.arvados_theme
@@ -187,7 +187,7 @@ class ApplicationController < ActionController::Base
     # The obvious render(json: ...) forces a slow JSON encoder. See
     # #3021 and commit logs. Might be fixed in Rails 4.1.
     render({
-             text: SafeJSON.dump(response).html_safe,
+             plain: SafeJSON.dump(response).html_safe,
              content_type: 'application/json'
            }.merge opts)
   end
@@ -283,7 +283,7 @@ class ApplicationController < ActionController::Base
     @objects = @objects.order(@orders.join ", ") if @orders.any?
     @objects = @objects.limit(@limit)
     @objects = @objects.offset(@offset)
-    @objects = @objects.uniq(@distinct) if not @distinct.nil?
+    @objects = @objects.distinct(@distinct) if not @distinct.nil?
   end
 
   # limit_database_read ensures @objects (which must be an
@@ -323,10 +323,12 @@ class ApplicationController < ActionController::Base
   def resource_attrs
     return @attrs if @attrs
     @attrs = params[resource_name]
-    if @attrs.is_a? String
+    if @attrs.nil?
+      @attrs = {}
+    elsif @attrs.is_a? String
       @attrs = Oj.strict_load @attrs, symbol_keys: true
     end
-    unless @attrs.is_a? Hash
+    unless [Hash, ActionController::Parameters].include? @attrs.class
       message = "No #{resource_name}"
       if resource_name.index('_')
         message << " (or #{resource_name.camelcase(:lower)})"
@@ -431,8 +433,8 @@ class ApplicationController < ActionController::Base
   end
 
   def respond_with_json_by_default
-    html_index = request.accepts.index(Mime::HTML)
-    if html_index.nil? or request.accepts[0...html_index].include?(Mime::JSON)
+    html_index = request.accepts.index(Mime[:html])
+    if html_index.nil? or request.accepts[0...html_index].include?(Mime[:json])
       request.format = :json
     end
   end
@@ -481,7 +483,7 @@ class ApplicationController < ActionController::Base
   end
 
   def self.accept_attribute_as_json(attr, must_be_class=nil)
-    before_filter lambda { accept_attribute_as_json attr, must_be_class }
+    before_action lambda { accept_attribute_as_json attr, must_be_class }
   end
   accept_attribute_as_json :properties, Hash
   accept_attribute_as_json :info, Hash
@@ -499,7 +501,7 @@ class ApplicationController < ActionController::Base
   end
 
   def self.accept_param_as_json(key, must_be_class=nil)
-    prepend_before_filter lambda { load_json_value(params, key, must_be_class) }
+    prepend_before_action lambda { load_json_value(params, key, must_be_class) }
   end
   accept_param_as_json :reader_tokens, Array
 
@@ -523,7 +525,7 @@ class ApplicationController < ActionController::Base
       if @objects.respond_to? :except
         list[:items_available] = @objects.
           except(:limit).except(:offset).
-          count(:id, distinct: true)
+          distinct.count(:id)
       end
     when 'none'
     else
index 826ced1cf8c1c3945503b7d79f4865928fb7beb3..cd466cf1fb2565b79e1f796d9981c0dd20750636 100644 (file)
@@ -6,10 +6,10 @@ require 'safe_json'
 
 class Arvados::V1::ApiClientAuthorizationsController < ApplicationController
   accept_attribute_as_json :scopes, Array
-  before_filter :current_api_client_is_trusted, :except => [:current]
-  before_filter :admin_required, :only => :create_system_auth
-  skip_before_filter :render_404_if_no_object, :only => [:create_system_auth, :current]
-  skip_before_filter :find_object_by_uuid, :only => [:create_system_auth, :current]
+  before_action :current_api_client_is_trusted, :except => [:current]
+  before_action :admin_required, :only => :create_system_auth
+  skip_before_action :render_404_if_no_object, :only => [:create_system_auth, :current]
+  skip_before_action :find_object_by_uuid, :only => [:create_system_auth, :current]
 
   def self._create_system_auth_requires_parameters
     {
index 5a67632fcf5c4fb161192041591127662e4777bf..b459c51915b3668bd3d071736c2d0a35641796ed 100644 (file)
@@ -3,5 +3,5 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class Arvados::V1::ApiClientsController < ApplicationController
-  before_filter :admin_required
+  before_action :admin_required
 end
index 8542096ce1aae27ee4ffe927c7b11f0bc9a4ea11..fc5614d9446e014a9b32fea548d33e53d57a6571 100644 (file)
@@ -10,8 +10,8 @@ class Arvados::V1::ContainersController < ApplicationController
   accept_attribute_as_json :command, Array
   accept_attribute_as_json :scheduling_parameters, Hash
 
-  skip_before_filter :find_object_by_uuid, only: [:current]
-  skip_before_filter :render_404_if_no_object, only: [:current]
+  skip_before_action :find_object_by_uuid, only: [:current]
+  skip_before_action :render_404_if_no_object, only: [:current]
 
   def auth
     if @object.locked_by_uuid != Thread.current[:api_client_authorization].uuid
index 6163f893ce7d3c71040f08f2a66d25731bb1ff85..f7db1ef121f606b597772ce695aadb859f0a3e31 100644 (file)
@@ -7,8 +7,8 @@ require "trashable"
 class Arvados::V1::GroupsController < ApplicationController
   include TrashableController
 
-  skip_before_filter :find_object_by_uuid, only: :shared
-  skip_before_filter :render_404_if_no_object, only: :shared
+  skip_before_action :find_object_by_uuid, only: :shared
+  skip_before_action :render_404_if_no_object, only: :shared
 
   def self._index_requires_parameters
     (super rescue {}).
index 6d55506bb5742cf9be7c183186b60f6479ab5226..c12bc6e90c8f8bf68ce21b99f8bc658df1cf3510 100644 (file)
@@ -3,17 +3,17 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class Arvados::V1::HealthcheckController < ApplicationController
-  skip_before_filter :catch_redirect_hint
-  skip_before_filter :find_objects_for_index
-  skip_before_filter :find_object_by_uuid
-  skip_before_filter :load_filters_param
-  skip_before_filter :load_limit_offset_order_params
-  skip_before_filter :load_read_auths
-  skip_before_filter :load_where_param
-  skip_before_filter :render_404_if_no_object
-  skip_before_filter :require_auth_scope
+  skip_before_action :catch_redirect_hint
+  skip_before_action :find_objects_for_index
+  skip_before_action :find_object_by_uuid
+  skip_before_action :load_filters_param
+  skip_before_action :load_limit_offset_order_params
+  skip_before_action :load_read_auths
+  skip_before_action :load_where_param
+  skip_before_action :render_404_if_no_object
+  skip_before_action :require_auth_scope
 
-  before_filter :check_auth_header
+  before_action :check_auth_header
 
   def check_auth_header
     mgmt_token = Rails.configuration.ManagementToken
index 23c059cfbdae11f98ed40f75e79d33b2102c41be..c3655272ddf69687899012b2da2dd1e293b06a4f 100644 (file)
@@ -7,8 +7,8 @@ class Arvados::V1::JobsController < ApplicationController
   accept_attribute_as_json :script_parameters, Hash
   accept_attribute_as_json :runtime_constraints, Hash
   accept_attribute_as_json :tasks_summary, Hash
-  skip_before_filter :find_object_by_uuid, :only => [:queue, :queue_size]
-  skip_before_filter :render_404_if_no_object, :only => [:queue, :queue_size]
+  skip_before_action :find_object_by_uuid, :only => [:queue, :queue_size]
+  skip_before_action :render_404_if_no_object, :only => [:queue, :queue_size]
 
   include DbCurrentTime
 
index 9b4c342a72a062e2e6a64a64466e5af0dd5ece28..b8aa09650fd872aaa001bc4c3a26ad2ee023d919 100644 (file)
@@ -3,8 +3,8 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class Arvados::V1::KeepDisksController < ApplicationController
-  skip_before_filter :require_auth_scope, only: :ping
-  skip_before_filter :render_404_if_no_object, only: :ping
+  skip_before_action :require_auth_scope, only: :ping
+  skip_before_action :render_404_if_no_object, only: :ping
 
   def self._ping_requires_parameters
     {
index c7c911929b2bc92f675b3b7dec3b3eaa304449e4..90b0a9228b91a1f806d081ba15656bfa016b8ee0 100644 (file)
@@ -4,9 +4,9 @@
 
 class Arvados::V1::KeepServicesController < ApplicationController
 
-  skip_before_filter :find_object_by_uuid, only: :accessible
-  skip_before_filter :render_404_if_no_object, only: :accessible
-  skip_before_filter :require_auth_scope, only: :accessible
+  skip_before_action :find_object_by_uuid, only: :accessible
+  skip_before_action :render_404_if_no_object, only: :accessible
+  skip_before_action :require_auth_scope, only: :accessible
 
   def find_objects_for_index
     # all users can list all keep services
index a2b22ea7f6c55709dff9d745368cbbe46bed5669..eb72b7096de8776b7d930739417d9d50dab789f9 100644 (file)
@@ -3,9 +3,9 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class Arvados::V1::NodesController < ApplicationController
-  skip_before_filter :require_auth_scope, :only => :ping
-  skip_before_filter :find_object_by_uuid, :only => :ping
-  skip_before_filter :render_404_if_no_object, :only => :ping
+  skip_before_action :require_auth_scope, :only => :ping
+  skip_before_action :find_object_by_uuid, :only => :ping
+  skip_before_action :render_404_if_no_object, :only => :ping
 
   include DbCurrentTime
 
index b88e10c080b52e612fc226e778f84c898b735e9f..9dff6227bccdd440fe34783b849a2c24a6eae83b 100644 (file)
@@ -3,9 +3,9 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class Arvados::V1::RepositoriesController < ApplicationController
-  skip_before_filter :find_object_by_uuid, :only => :get_all_permissions
-  skip_before_filter :render_404_if_no_object, :only => :get_all_permissions
-  before_filter :admin_required, :only => :get_all_permissions
+  skip_before_action :find_object_by_uuid, :only => :get_all_permissions
+  skip_before_action :render_404_if_no_object, :only => :get_all_permissions
+  before_action :admin_required, :only => :get_all_permissions
 
   def get_all_permissions
     # user_aks is a map of {user_uuid => array of public keys}
index 771ef2b1fba0c4009630b1e02a1df3d3b33b8247..8ff2a97c467d0f09f867e0992bcb4167c9953e7d 100644 (file)
@@ -3,15 +3,15 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class Arvados::V1::SchemaController < ApplicationController
-  skip_before_filter :catch_redirect_hint
-  skip_before_filter :find_objects_for_index
-  skip_before_filter :find_object_by_uuid
-  skip_before_filter :load_filters_param
-  skip_before_filter :load_limit_offset_order_params
-  skip_before_filter :load_read_auths
-  skip_before_filter :load_where_param
-  skip_before_filter :render_404_if_no_object
-  skip_before_filter :require_auth_scope
+  skip_before_action :catch_redirect_hint
+  skip_before_action :find_objects_for_index
+  skip_before_action :find_object_by_uuid
+  skip_before_action :load_filters_param
+  skip_before_action :load_limit_offset_order_params
+  skip_before_action :load_read_auths
+  skip_before_action :load_where_param
+  skip_before_action :render_404_if_no_object
+  skip_before_action :require_auth_scope
 
   include DbCurrentTime
 
@@ -134,6 +134,14 @@ class Arvados::V1::SchemaController < ApplicationController
             object_properties[col.name] = {
               type: k.serialized_attributes[col.name].object_class.to_s
             }
+          elsif k.attribute_types[col.name].is_a? JsonbType::Hash
+            object_properties[col.name] = {
+              type: Hash.to_s
+            }
+          elsif k.attribute_types[col.name].is_a? JsonbType::Array
+            object_properties[col.name] = {
+              type: Array.to_s
+            }
           else
             object_properties[col.name] = {
               type: col.type
index dc08c6a037ed37ae895e677ebe198c138a1e658d..748eb06f0a0128e86fedf4d04460d29598e56e6c 100644 (file)
@@ -3,9 +3,9 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class Arvados::V1::UserAgreementsController < ApplicationController
-  before_filter :admin_required, except: [:index, :sign, :signatures]
-  skip_before_filter :find_object_by_uuid, only: [:sign, :signatures]
-  skip_before_filter :render_404_if_no_object, only: [:sign, :signatures]
+  before_action :admin_required, except: [:index, :sign, :signatures]
+  skip_before_action :find_object_by_uuid, only: [:sign, :signatures]
+  skip_before_action :render_404_if_no_object, only: [:sign, :signatures]
 
   def model_class
     Link
index d2126ec5f7793ffe6e502d182ea3d852d8c5ceb6..18b6b46d2678df8b8094c5f273d8db55a7f9e2a3 100644 (file)
@@ -5,11 +5,11 @@
 class Arvados::V1::UsersController < ApplicationController
   accept_attribute_as_json :prefs, Hash
 
-  skip_before_filter :find_object_by_uuid, only:
+  skip_before_action :find_object_by_uuid, only:
     [:activate, :current, :system, :setup, :merge]
-  skip_before_filter :render_404_if_no_object, only:
+  skip_before_action :render_404_if_no_object, only:
     [:activate, :current, :system, :setup, :merge]
-  before_filter :admin_required, only: [:setup, :unsetup, :update_uuid]
+  before_action :admin_required, only: [:setup, :unsetup, :update_uuid]
 
   def current
     if current_user
@@ -73,7 +73,7 @@ class Arvados::V1::UsersController < ApplicationController
       if !@object
         return render_404_if_no_object
       end
-    elsif !params[:user]
+    elsif !params[:user] || params[:user].empty?
       raise ArgumentError.new "Required uuid or user"
     elsif !params[:user]['email']
       raise ArgumentError.new "Require user email"
index 7a1c68071786363f367aab3a4121f9bbee29dcbe..cb637c2fdacf8aa859c0107ba5d55bdef6b711f4 100644 (file)
@@ -3,9 +3,9 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class Arvados::V1::VirtualMachinesController < ApplicationController
-  skip_before_filter :find_object_by_uuid, :only => :get_all_logins
-  skip_before_filter :render_404_if_no_object, :only => :get_all_logins
-  before_filter(:admin_required,
+  skip_before_action :find_object_by_uuid, :only => :get_all_logins
+  skip_before_action :render_404_if_no_object, :only => :get_all_logins
+  before_action(:admin_required,
                 :only => [:logins, :get_all_logins])
 
   # Get all login permissons (user uuid, login account, SSH key) for a
index dddc3400b4eee4b0035caec86440b2113c06576a..b618a321e5d7578665141df4876a98a5bf872d59 100644 (file)
@@ -3,9 +3,9 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class DatabaseController < ApplicationController
-  skip_before_filter :find_object_by_uuid
-  skip_before_filter :render_404_if_no_object
-  before_filter :admin_required
+  skip_before_action :find_object_by_uuid
+  skip_before_action :render_404_if_no_object
+  before_action :admin_required
   def reset
     raise ArvadosModel::PermissionDeniedError unless Rails.env == 'test'
 
index f0992c18314ac22bc60034855a204ab3aedce796..b421f54596f9f5274eef4f943fb4ab09a2f96321 100644 (file)
@@ -5,9 +5,9 @@
 class StaticController < ApplicationController
   respond_to :json, :html
 
-  skip_before_filter :find_object_by_uuid
-  skip_before_filter :render_404_if_no_object
-  skip_before_filter :require_auth_scope, only: [:home, :empty, :login_failure]
+  skip_before_action :find_object_by_uuid
+  skip_before_action :render_404_if_no_object
+  skip_before_action :require_auth_scope, only: [:home, :empty, :login_failure]
 
   def home
     respond_to do |f|
@@ -25,7 +25,7 @@ class StaticController < ApplicationController
   end
 
   def empty
-    render text: ""
+    render plain: ""
   end
 
 end
index 1889d74eaa891dc980889cfd00491f54935ee08f..237156f1161ec53d53322cb3c9271c39ab945805 100644 (file)
@@ -3,17 +3,17 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class UserSessionsController < ApplicationController
-  before_filter :require_auth_scope, :only => [ :destroy ]
+  before_action :require_auth_scope, :only => [ :destroy ]
 
-  skip_before_filter :set_cors_headers
-  skip_before_filter :find_object_by_uuid
-  skip_before_filter :render_404_if_no_object
+  skip_before_action :set_cors_headers
+  skip_before_action :find_object_by_uuid
+  skip_before_action :render_404_if_no_object
 
   respond_to :html
 
   # omniauth callback method
   def create
-    omniauth = env['omniauth.auth']
+    omniauth = request.env['omniauth.auth']
 
     identity_url_ok = (omniauth['info']['identity_url'].length > 0) rescue false
     unless identity_url_ok
diff --git a/services/api/app/models/application_record.rb b/services/api/app/models/application_record.rb
new file mode 100644 (file)
index 0000000..759034d
--- /dev/null
@@ -0,0 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class ApplicationRecord < ActiveRecord::Base
+  self.abstract_class = true
+end
\ No newline at end of file
index 2002e90acbde7d0375f36f9a3926bb01fb02b24d..e619abe8c800781b17fc3c2c07f8fa69008ee6cf 100644 (file)
@@ -8,7 +8,7 @@ require 'record_filters'
 require 'serializers'
 require 'request_error'
 
-class ArvadosModel < ActiveRecord::Base
+class ArvadosModel < ApplicationRecord
   self.abstract_class = true
 
   include ArvadosModelUpdates
@@ -46,6 +46,11 @@ class ArvadosModel < ActiveRecord::Base
   # penalty.
   attr_accessor :async_permissions_update
 
+  # Ignore listed attributes on mass assignments
+  def self.protected_attributes
+    []
+  end
+
   class PermissionDeniedError < RequestError
     def http_status
       403
@@ -97,7 +102,11 @@ class ArvadosModel < ActiveRecord::Base
     # The following permit! is necessary even with
     # "ActionController::Parameters.permit_all_parameters = true",
     # because permit_all does not permit nested attributes.
+    raw_params ||= {}
+
     if raw_params
+      raw_params = raw_params.to_hash
+      raw_params.delete_if { |k, _| self.protected_attributes.include? k }
       serialized_attributes.each do |colname, coder|
         param = raw_params[colname.to_sym]
         if param.nil?
@@ -108,6 +117,15 @@ class ArvadosModel < ActiveRecord::Base
           raise ArgumentError.new("#{colname} parameter cannot have non-string hash keys")
         end
       end
+      # Check JSONB columns that aren't listed on serialized_attributes
+      columns.select{|c| c.type == :jsonb}.collect{|j| j.name}.each do |colname|
+        if serialized_attributes.include? colname || raw_params[colname.to_sym].nil?
+          next
+        end
+        if has_nonstring_keys?(raw_params[colname.to_sym])
+          raise ArgumentError.new("#{colname} parameter cannot have non-string hash keys")
+        end
+      end
     end
     ActionController::Parameters.new(raw_params).permit!
   end
@@ -357,7 +375,7 @@ class ArvadosModel < ActiveRecord::Base
         # discover a unique name.  It is necessary to handle name choosing at
         # this level (as opposed to the client) to ensure that record creation
         # never fails due to a race condition.
-        err = rn.original_exception
+        err = rn.cause
         raise unless err.is_a?(PG::UniqueViolation)
 
         # Unfortunately ActiveRecord doesn't abstract out any of the
@@ -404,7 +422,8 @@ class ArvadosModel < ActiveRecord::Base
 
   def self.full_text_tsvector
     parts = full_text_searchable_columns.collect do |column|
-      cast = serialized_attributes[column] ? '::text' : ''
+      is_jsonb = self.columns.select{|x|x.name == column}[0].type == :jsonb
+      cast = (is_jsonb || serialized_attributes[column]) ? '::text' : ''
       "coalesce(#{column}#{cast},'')"
     end
     "to_tsvector('english', substr(#{parts.join(" || ' ' || ")}, 0, 8000))"
@@ -449,7 +468,7 @@ class ArvadosModel < ActiveRecord::Base
           end
         rescue ActiveRecord::RecordNotFound => e
           errors.add :owner_uuid, "is not owned by any user: #{e}"
-          return false
+          throw(:abort)
         end
         if uuid_in_path[x]
           if x == owner_uuid
@@ -457,7 +476,7 @@ class ArvadosModel < ActiveRecord::Base
           else
             errors.add :owner_uuid, "has an ownership cycle"
           end
-          return false
+          throw(:abort)
         end
         uuid_in_path[x] = true
       end
@@ -665,7 +684,8 @@ class ArvadosModel < ActiveRecord::Base
     # we'll convert symbols to strings when loading from the
     # database. (Otherwise, loading and saving an object with existing
     # symbols in a serialized field will crash.)
-    self.class.serialized_attributes.each do |colname, attr|
+    jsonb_cols = self.class.columns.select{|c| c.type == :jsonb}.collect{|j| j.name}
+    (jsonb_cols + self.class.serialized_attributes.keys).uniq.each do |colname|
       if self.class.has_symbols? attributes[colname]
         attributes[colname] = self.class.recursive_stringify attributes[colname]
         send(colname + '=',
index 6147b79f9f5aa16c6b9e24ef5164bab43139373a..590228b1af354f0f10bad06171706f4ed88c05fa 100644 (file)
@@ -14,9 +14,11 @@ class Collection < ArvadosModel
   include CommonApiTemplate
   include Trashable
 
-  serialize :properties, Hash
-  serialize :storage_classes_desired, Array
-  serialize :storage_classes_confirmed, Array
+  # Posgresql JSONB columns should NOT be declared as serialized, Rails 5
+  # already know how to properly treat them.
+  attribute :properties, :jsonbHash, default: {}
+  attribute :storage_classes_desired, :jsonbArray, default: ["default"]
+  attribute :storage_classes_confirmed, :jsonbArray, default: []
 
   before_validation :default_empty_manifest
   before_validation :default_storage_classes, on: :create
@@ -29,6 +31,7 @@ class Collection < ArvadosModel
   validate :ensure_storage_classes_contain_non_empty_strings
   validate :versioning_metadata_updates, on: :update
   validate :past_versions_cannot_be_updated, on: :update
+  after_validation :set_file_count_and_total_size
   before_save :set_file_names
   around_update :manage_versioning
 
@@ -51,6 +54,8 @@ class Collection < ArvadosModel
     t.add :version
     t.add :current_version_uuid
     t.add :preserve_version
+    t.add :file_count
+    t.add :file_size_total
   end
 
   after_initialize do
@@ -83,7 +88,7 @@ class Collection < ArvadosModel
 
   FILE_TOKEN = /^[[:digit:]]+:[[:digit:]]+:/
   def check_signatures
-    return false if self.manifest_text.nil?
+    throw(:abort) if self.manifest_text.nil?
 
     return true if current_user.andand.is_admin
 
@@ -195,6 +200,20 @@ class Collection < ArvadosModel
     true
   end
 
+  def set_file_count_and_total_size
+    # Only update the file stats if the manifest changed
+    if self.manifest_text_changed?
+      m = Keep::Manifest.new(self.manifest_text)
+      self.file_size_total = m.files_size
+      self.file_count = m.files_count
+    # If the manifest didn't change but the attributes did, ignore the changes
+    elsif self.file_count_changed? || self.file_size_total_changed?
+      self.file_count = self.file_count_was
+      self.file_size_total = self.file_size_total_was
+    end
+    true
+  end
+
   def manifest_files
     return '' if !self.manifest_text
 
@@ -316,9 +335,7 @@ class Collection < ArvadosModel
   end
 
   def check_encoding
-    if manifest_text.encoding.name == 'UTF-8' and manifest_text.valid_encoding?
-      true
-    else
+    if !(manifest_text.encoding.name == 'UTF-8' and manifest_text.valid_encoding?)
       begin
         # If Ruby thinks the encoding is something else, like 7-bit
         # ASCII, but its stored bytes are equal to the (valid) UTF-8
@@ -333,7 +350,7 @@ class Collection < ArvadosModel
       rescue
       end
       errors.add :manifest_text, "must use UTF-8 encoding"
-      false
+      throw(:abort)
     end
   end
 
@@ -343,7 +360,7 @@ class Collection < ArvadosModel
       true
     rescue ArgumentError => e
       errors.add :manifest_text, e.message
-      false
+      throw(:abort)
     end
   end
 
index abcfdbd296b3ab71cf7e8466e7c9279076f2c93f..fb900a993d464e809fd93ce0ecdacdae35995027 100644 (file)
@@ -17,13 +17,17 @@ class Container < ArvadosModel
   extend DbCurrentTime
   extend LogReuseInfo
 
+  # Posgresql JSONB columns should NOT be declared as serialized, Rails 5
+  # already know how to properly treat them.
+  attribute :secret_mounts, :jsonbHash, default: {}
+  attribute :runtime_status, :jsonbHash, default: {}
+  attribute :runtime_auth_scopes, :jsonbHash, default: {}
+
   serialize :environment, Hash
   serialize :mounts, Hash
   serialize :runtime_constraints, Hash
   serialize :command, Array
   serialize :scheduling_parameters, Hash
-  serialize :secret_mounts, Hash
-  serialize :runtime_status, Hash
 
   before_validation :fill_field_defaults, :if => :new_record?
   before_validation :set_timestamps
index 921d4bee60f7f5f679b0531d61f259f15b4ff96c..292decafbfb94ad381ab84bcfe01da13c5e9d68d 100644 (file)
@@ -19,13 +19,16 @@ class ContainerRequest < ArvadosModel
                primary_key: :uuid,
              }
 
-  serialize :properties, Hash
+  # Posgresql JSONB columns should NOT be declared as serialized, Rails 5
+  # already know how to properly treat them.
+  attribute :properties, :jsonbHash, default: {}
+  attribute :secret_mounts, :jsonbHash, default: {}
+
   serialize :environment, Hash
   serialize :mounts, Hash
   serialize :runtime_constraints, Hash
   serialize :command, Array
   serialize :scheduling_parameters, Hash
-  serialize :secret_mounts, Hash
 
   before_validation :fill_field_defaults, :if => :new_record?
   before_validation :validate_runtime_constraints
@@ -191,6 +194,7 @@ class ContainerRequest < ArvadosModel
     self.environment ||= {}
     self.runtime_constraints ||= {}
     self.mounts ||= {}
+    self.secret_mounts ||= {}
     self.cwd ||= "."
     self.container_count_max ||= Rails.configuration.container_count_max
     self.scheduling_parameters ||= {}
index 46bb447d10f507b6e4fe03b7983e6cfa25111016..7fb8fef42ba9e4c1b19967174cd30c9991383726 100644 (file)
@@ -12,7 +12,9 @@ class Group < ArvadosModel
   include CanBeAnOwner
   include Trashable
 
-  serialize :properties, Hash
+  # Posgresql JSONB columns should NOT be declared as serialized, Rails 5
+  # already know how to properly treat them.
+  attribute :properties, :jsonbHash, default: {}
 
   after_create :invalidate_permissions_cache
   after_update :maybe_invalidate_permissions_cache
@@ -49,5 +51,4 @@ class Group < ArvadosModel
     end
     true
   end
-
 end
index 7508ead5d5c31bd397d2b0958eac72f4712d2062..420386cdc2ac0b4cfa423bb423e9c6053ec8b4ba 100644 (file)
@@ -12,7 +12,6 @@ class Job < ArvadosModel
   extend CurrentApiClient
   extend LogReuseInfo
   serialize :components, Hash
-  attr_protected :arvados_sdk_version, :docker_image_locator
   serialize :script_parameters, Hash
   serialize :runtime_constraints, Hash
   serialize :tasks_summary, Hash
@@ -83,6 +82,10 @@ class Job < ArvadosModel
     ["components"]
   end
 
+  def self.protected_attributes
+    [:arvados_sdk_version, :docker_image_locator]
+  end
+
   def assert_finished
     update_attributes(finished_at: finished_at || db_current_time,
                       success: success.nil? ? false : success,
diff --git a/services/api/app/models/jsonb_type.rb b/services/api/app/models/jsonb_type.rb
new file mode 100644 (file)
index 0000000..3f296be
--- /dev/null
@@ -0,0 +1,45 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class JsonbType
+  # Emulate pre-rails5.0 behavior by having a interpreting NULL/nil as
+  # some other default value.
+  class WithDefault < ActiveModel::Type::Value
+    include ActiveModel::Type::Helpers::Mutable
+
+    def default_value
+      nil
+    end
+
+    def deserialize(value)
+      if value.nil?
+        self.default_value
+      elsif value.is_a?(::String)
+        SafeJSON.load(value) rescue self.default_value
+      else
+        value
+      end
+    end
+
+    def serialize(value)
+      if value.nil?
+        self.default_value
+      else
+        SafeJSON.dump(value)
+      end
+    end
+  end
+
+  class Hash < JsonbType::WithDefault
+    def default_value
+      {}
+    end
+  end
+
+  class Array < JsonbType::WithDefault
+    def default_value
+      []
+    end
+  end
+end
\ No newline at end of file
index ac3efe310dc6435ae5b4b303991778c84838eb41..ad7800fe679cb91936bde76f00566873cb369419 100644 (file)
@@ -6,7 +6,11 @@ class Link < ArvadosModel
   include HasUuid
   include KindAndEtag
   include CommonApiTemplate
-  serialize :properties, Hash
+
+  # Posgresql JSONB columns should NOT be declared as serialized, Rails 5
+  # already know how to properly treat them.
+  attribute :properties, :jsonbHash, default: {}
+
   before_create :permission_to_attach_to_objects
   before_update :permission_to_attach_to_objects
   after_update :maybe_invalidate_permissions_cache
@@ -98,5 +102,4 @@ class Link < ArvadosModel
       super
     end
   end
-
 end
index 3d8b91b4b62df590edd2c1049a5ea69e17224bef..148dffc23074138af0d70008e2cc49dd8b344ca1 100644 (file)
@@ -8,8 +8,12 @@ class Node < ArvadosModel
   include HasUuid
   include KindAndEtag
   include CommonApiTemplate
-  serialize :info, Hash
-  serialize :properties, Hash
+
+  # Posgresql JSONB columns should NOT be declared as serialized, Rails 5
+  # already know how to properly treat them.
+  attribute :properties, :jsonbHash, default: {}
+  attribute :info, :jsonbHash, default: {}
+
   before_validation :ensure_ping_secret
   after_update :dns_server_update
 
index 55efa0ae85b4e79d8a88d2d5d99ead15abb6b5b7..c0781ef22856a6e181b21b0cb383cd7c8cfa366d 100644 (file)
@@ -158,11 +158,9 @@ class PipelineInstance < ArvadosModel
       end
     end
 
-    if self.state.in?(States)
-      true
-    else
+    if !self.state.in?(States)
       errors.add :state, "'#{state.inspect} must be one of: [#{States.join ', '}]"
-      false
+      throw(:abort)
     end
   end
 
index 8ed97e6b14c7b5ea313c856a4c548cbc591917ac..de85cc5a8e75e32852407f9c8388777df1168119 100644 (file)
@@ -198,32 +198,32 @@ class User < ArvadosModel
   # delete user signatures, login, repo, and vm perms, and mark as inactive
   def unsetup
     # delete oid_login_perms for this user
-    Link.destroy_all(tail_uuid: self.email,
+    Link.where(tail_uuid: self.email,
                      link_class: 'permission',
-                     name: 'can_login')
+                     name: 'can_login').destroy_all
 
     # delete repo_perms for this user
-    Link.destroy_all(tail_uuid: self.uuid,
+    Link.where(tail_uuid: self.uuid,
                      link_class: 'permission',
-                     name: 'can_manage')
+                     name: 'can_manage').destroy_all
 
     # delete vm_login_perms for this user
-    Link.destroy_all(tail_uuid: self.uuid,
+    Link.where(tail_uuid: self.uuid,
                      link_class: 'permission',
-                     name: 'can_login')
+                     name: 'can_login').destroy_all
 
     # delete "All users" group read permissions for this user
     group = Group.where(name: 'All users').select do |g|
       g[:uuid].match(/-f+$/)
     end.first
-    Link.destroy_all(tail_uuid: self.uuid,
+    Link.where(tail_uuid: self.uuid,
                      head_uuid: group[:uuid],
                      link_class: 'permission',
-                     name: 'can_read')
+                     name: 'can_read').destroy_all
 
     # delete any signatures by this user
-    Link.destroy_all(link_class: 'signature',
-                     tail_uuid: self.uuid)
+    Link.where(link_class: 'signature',
+                     tail_uuid: self.uuid).destroy_all
 
     # delete user preferences (including profile)
     self.prefs = {}
@@ -588,7 +588,7 @@ class User < ArvadosModel
   def verify_repositories_empty
     unless repositories.first.nil?
       errors.add(:username, "can't be unset when the user owns repositories")
-      false
+      throw(:abort)
     end
   end
 
diff --git a/services/api/bin/bundle b/services/api/bin/bundle
new file mode 100755 (executable)
index 0000000..044b5ca
--- /dev/null
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+load Gem.bin_path('bundler', 'bundle')
diff --git a/services/api/bin/rails b/services/api/bin/rails
new file mode 100755 (executable)
index 0000000..5f594d1
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+APP_PATH = File.expand_path('../config/application', __dir__)
+require_relative '../config/boot'
+require 'rails/commands'
diff --git a/services/api/bin/rake b/services/api/bin/rake
new file mode 100755 (executable)
index 0000000..87484df
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+require_relative '../config/boot'
+require 'rake'
+Rake.application.run
diff --git a/services/api/bin/setup b/services/api/bin/setup
new file mode 100755 (executable)
index 0000000..2e4d28c
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/env ruby
+
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+  system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+  # This script is a starting point to setup your application.
+  # Add necessary setup steps to this file.
+
+  puts '== Installing dependencies =='
+  system! 'gem install bundler --conservative'
+  system('bundle check') || system!('bundle install')
+
+  # puts "\n== Copying sample files =="
+  # unless File.exist?('config/database.yml')
+  #   cp 'config/database.yml.sample', 'config/database.yml'
+  # end
+
+  puts "\n== Preparing database =="
+  system! 'bin/rails db:setup'
+
+  puts "\n== Removing old logs and tempfiles =="
+  system! 'bin/rails log:clear tmp:clear'
+
+  puts "\n== Restarting application server =="
+  system! 'bin/rails restart'
+end
diff --git a/services/api/bin/update b/services/api/bin/update
new file mode 100755 (executable)
index 0000000..07a3df9
--- /dev/null
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+  system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+  # This script is a way to update your development environment automatically.
+  # Add necessary update steps to this file.
+
+  puts '== Installing dependencies =='
+  system! 'gem install bundler --conservative'
+  system('bundle check') || system!('bundle install')
+
+  puts "\n== Updating database =="
+  system! 'bin/rails db:migrate'
+
+  puts "\n== Removing old logs and tempfiles =="
+  system! 'bin/rails log:clear tmp:clear'
+
+  puts "\n== Restarting application server =="
+  system! 'bin/rails restart'
+end
index 8f0dbf4e496b15e73d37083c5d2ac84dd1e8f61d..98443b428f5313c82c5182cf348eb410c6c99b7d 100644 (file)
@@ -551,7 +551,8 @@ production:
   cache_classes: true
   consider_all_requests_local: false
   action_controller.perform_caching: true
-  serve_static_files: false
+  public_file_server:
+    enabled: false
   assets.compress: true
   assets.compile: false
   assets.digest: true
@@ -559,8 +560,10 @@ production:
 test:
   force_ssl: false
   cache_classes: true
-  serve_static_files: true
-  static_cache_control: public, max-age=3600
+  public_file_server:
+    enabled: true
+    headers:
+      'Cache-Control': public, max-age=3600
   whiny_nils: true
   consider_all_requests_local: true
   action_controller.perform_caching: false
index 24fd61871d26e4c16416d254b3d7e7441e17bb68..d6fcc9ea09be03a321d89318c8b0bf9c442a4abe 100644 (file)
@@ -4,7 +4,19 @@
 
 require File.expand_path('../boot', __FILE__)
 
-require 'rails/all'
+require "rails"
+# Pick only the frameworks we need:
+require "active_model/railtie"
+require "active_job/railtie"
+require "active_record/railtie"
+require "action_controller/railtie"
+require "action_mailer/railtie"
+require "action_view/railtie"
+# Skip ActionCable (new in Rails 5.0) as it adds '/cable' routes that we're not using
+# require "action_cable/engine"
+require "sprockets/railtie"
+require "rails/test_unit/railtie"
+
 require 'digest'
 
 module Kernel
@@ -58,8 +70,6 @@ module Server
     # Load entire application at startup.
     config.eager_load = true
 
-    config.active_record.raise_in_transactional_callbacks = true
-
     config.active_support.test_order = :sorted
 
     config.action_dispatch.perform_deep_munge = false
index c70ab9591fe76ec2a8b19a4d32096e95d473d722..717101c2b2b6ccbacb9e01c587195b38e1bd8bb4 100644 (file)
@@ -2,9 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-require 'rubygems'
-
 # Set up gems listed in the Gemfile.
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
 
-require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
+require 'bundler/setup'
diff --git a/services/api/config/cable.yml b/services/api/config/cable.yml
new file mode 100644 (file)
index 0000000..c906069
--- /dev/null
@@ -0,0 +1,13 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+development:
+  adapter: async
+
+test:
+  adapter: async
+
+production:
+  adapter: redis
+  url: redis://localhost:6379/1
index 80876888cf53eb512085dd88641b3388cfe0c814..2ec90050ae74ee88158d19d8a68581f17e3a9bd9 100644 (file)
@@ -15,6 +15,7 @@ test:
   adapter: postgresql
   template: template0
   encoding: utf8
+  collation: en_US.utf8
   database: arvados_test
   username: arvados
   password: xxxxxxxx
@@ -28,7 +29,4 @@ production:
   username: arvados
   password: xxxxxxxx
   host: localhost
-  # For the websockets server, prefer a larger database connection pool size since it
-  # multithreaded and can serve a large number of long-lived clients.  See also
-  # websocket_max_connections configuration option.
   pool: 50
index e24eee035cd2c8f0d01c5b708c43f9d870a1fc71..b82ba27f9ae1bd390bdb71c0fd4f79c9c1fb4b70 100644 (file)
@@ -3,8 +3,8 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 # Load the rails application
-require File.expand_path('../application', __FILE__)
+require_relative 'application'
 require 'josh_id'
 
 # Initialize the rails application
-Server::Application.initialize!
+Rails.application.initialize!
index affb31d6bdd651b37c38a783efd603b74436704d..6c48dcd0196209f3b16a31f64f48ad93fa06244b 100644 (file)
@@ -13,7 +13,7 @@ Server::Application.configure do
   config.action_controller.perform_caching = true
 
   # Disable Rails's static asset server (Apache or nginx will already do this)
-  config.serve_static_files = false
+  config.public_file_server.enabled = false
 
   # Compress JavaScripts and CSS
   config.assets.compress = true
index 5ceb8f8b5d8bb4c7ad87342c93642c19632f36b7..6b550587cbb28b95d7b07bf1f0841afe6ec5bdc4 100644 (file)
@@ -12,8 +12,8 @@ Server::Application.configure do
   config.cache_classes = true
 
   # Configure static asset server for tests with Cache-Control for performance
-  config.serve_static_files = true
-  config.static_cache_control = "public, max-age=3600"
+  config.public_file_server.enabled = true
+  config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
 
   # Log error messages when you accidentally call methods on nil
   config.whiny_nils = true
diff --git a/services/api/config/initializers/application_controller_renderer.rb b/services/api/config/initializers/application_controller_renderer.rb
new file mode 100644 (file)
index 0000000..525d6ad
--- /dev/null
@@ -0,0 +1,12 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# ActiveSupport::Reloader.to_prepare do
+#   ApplicationController.renderer.defaults.merge!(
+#     http_host: 'example.org',
+#     https: false
+#   )
+# end
diff --git a/services/api/config/initializers/assets.rb b/services/api/config/initializers/assets.rb
new file mode 100644 (file)
index 0000000..f02c87b
--- /dev/null
@@ -0,0 +1,15 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = '1.0'
+
+# Add additional assets to the asset load path
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
+# Rails.application.config.assets.precompile += %w( search.js )
diff --git a/services/api/config/initializers/cookies_serializer.rb b/services/api/config/initializers/cookies_serializer.rb
new file mode 100644 (file)
index 0000000..5409f55
--- /dev/null
@@ -0,0 +1,9 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# Specify a serializer for the signed and encrypted cookie jars.
+# Valid options are :json, :marshal, and :hybrid.
+Rails.application.config.action_dispatch.cookies_serializer = :marshal
diff --git a/services/api/config/initializers/custom_types.rb b/services/api/config/initializers/custom_types.rb
new file mode 100644 (file)
index 0000000..aecd4cf
--- /dev/null
@@ -0,0 +1,8 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# JSONB backed Hash & Array types that default to their empty versions when
+# reading NULL from the database, or get nil passed by parameter.
+ActiveRecord::Type.register(:jsonbHash, JsonbType::Hash)
+ActiveRecord::Type.register(:jsonbArray, JsonbType::Array)
diff --git a/services/api/config/initializers/filter_parameter_logging.rb b/services/api/config/initializers/filter_parameter_logging.rb
new file mode 100644 (file)
index 0000000..f26d0ad
--- /dev/null
@@ -0,0 +1,8 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# Configure sensitive parameters which will be filtered from the log file.
+Rails.application.config.filter_parameters += [:password]
diff --git a/services/api/config/initializers/new_framework_defaults.rb b/services/api/config/initializers/new_framework_defaults.rb
new file mode 100644 (file)
index 0000000..2e2f0b1
--- /dev/null
@@ -0,0 +1,26 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+#
+# This file contains migration options to ease your Rails 5.0 upgrade.
+#
+# Once upgraded flip defaults one by one to migrate to the new default.
+#
+# Read the Guide for Upgrading Ruby on Rails for more info on each option.
+
+Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
+
+# Enable per-form CSRF tokens. Previous versions had false.
+Rails.application.config.action_controller.per_form_csrf_tokens = false
+
+# Enable origin-checking CSRF mitigation. Previous versions had false.
+Rails.application.config.action_controller.forgery_protection_origin_check = false
+
+# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
+# Previous versions had false.
+ActiveSupport.to_time_preserves_timezone = false
+
+# Require `belongs_to` associations by default. Previous versions had false.
+Rails.application.config.active_record.belongs_to_required_by_default = false
index 5e9290c88e30a3d253b48ecff6d5093d4fa812fb..7ed424e6441a19992a31576d8d3b8844c25e307c 100644 (file)
@@ -4,7 +4,7 @@
 
 # Be sure to restart your server when you modify this file.
 
-Server::Application.config.session_store :cookie_store, :key => '_server_session'
+Rails.application.config.session_store :cookie_store, key: '_server_session'
 
 # Use the database for sessions instead of the cookie-based default,
 # which shouldn't be used to store highly confidential information
diff --git a/services/api/config/puma.rb b/services/api/config/puma.rb
new file mode 100644 (file)
index 0000000..e087396
--- /dev/null
@@ -0,0 +1,51 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Puma can serve each request in a thread from an internal thread pool.
+# The `threads` method setting takes two numbers a minimum and maximum.
+# Any libraries that use thread pools should be configured to match
+# the maximum value specified for Puma. Default is set to 5 threads for minimum
+# and maximum, this matches the default thread size of Active Record.
+#
+threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
+threads threads_count, threads_count
+
+# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
+#
+port        ENV.fetch("PORT") { 3000 }
+
+# Specifies the `environment` that Puma will run in.
+#
+environment ENV.fetch("RAILS_ENV") { "development" }
+
+# Specifies the number of `workers` to boot in clustered mode.
+# Workers are forked webserver processes. If using threads and workers together
+# the concurrency of the application would be max `threads` * `workers`.
+# Workers do not work on JRuby or Windows (both of which do not support
+# processes).
+#
+# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
+
+# Use the `preload_app!` method when specifying a `workers` number.
+# This directive tells Puma to first boot the application and load code
+# before forking the application. This takes advantage of Copy On Write
+# process behavior so workers use less memory. If you use this option
+# you need to make sure to reconnect any threads in the `on_worker_boot`
+# block.
+#
+# preload_app!
+
+# The code in the `on_worker_boot` will be called if you are using
+# clustered mode by specifying a number of `workers`. After each worker
+# process is booted this block will be run, if you are using `preload_app!`
+# option you will want to use this block to reconnect to any threads
+# or connections that may have been created at application boot, Ruby
+# cannot share connections between processes.
+#
+# on_worker_boot do
+#   ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
+# end
+
+# Allow puma to be restarted by `rails restart` command.
+plugin :tmp_restart
diff --git a/services/api/config/secrets.yml b/services/api/config/secrets.yml
new file mode 100644 (file)
index 0000000..f21de2d
--- /dev/null
@@ -0,0 +1,26 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# Your secret key is used for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+# You can use `rails secret` to generate a secure secret key.
+
+# Make sure the secrets in this file are kept private
+# if you're sharing your code publicly.
+
+development:
+  secret_key_base: ef8dfe92893202f906d198094f428aaefa75749338e306ed2874938598cad7153ef0dd3cb8036c618cc7c27bb0c6c559728e8cc224da7cdfa2ad1d02874643b0
+
+test:
+  secret_key_base: 0b5454fe8163063950a7124348e2bc780fabbb022fa15f8a074c2fbcfce8eca480ed46b549b87738904f2bae6617ad949c3c3579e272d486c25aaa0ead563355
+
+# Do not keep production secrets in the repository,
+# instead read values from the environment.
+production:
+  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
diff --git a/services/api/config/spring.rb b/services/api/config/spring.rb
new file mode 100644 (file)
index 0000000..101e684
--- /dev/null
@@ -0,0 +1,10 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+%w(
+  .ruby-version
+  .rbenv-vars
+  tmp/restart.txt
+  tmp/caching-dev.txt
+).each { |path| Spring.watch(path) }
index 79d7abefa6cb4e9009a7bd5a66f4a0314b34c5b8..f7d53cf457aa4a5797077dad188705563b698050 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateCollections < ActiveRecord::Migration
+class CreateCollections < ActiveRecord::Migration[4.2]
   def change
     create_table :collections do |t|
       t.string :locator
index 63ddf72b4b64103982d32c0bae91cffc37773527..c1f90a97f80fa0207d32d7fe0384789c4bed2580 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateMetadata < ActiveRecord::Migration
+class CreateMetadata < ActiveRecord::Migration[4.2]
   def change
     create_table :metadata do |t|
       t.string :uuid
index dff192ae741c08eeccf0083990fc1c48641a9a5f..cea5d29a2b6b73010b52790abd2441b645b28dd2 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameMetadataClass < ActiveRecord::Migration
+class RenameMetadataClass < ActiveRecord::Migration[4.2]
   def up
     rename_column :metadata, :metadatum_class, :metadata_class
   end
index 7fba042b67ce94a3611d797d3657199bab337549..7e5450f49ff723cbfc8d5eb82a4cbffe1fe8e431 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameCollectionCreatedByClient < ActiveRecord::Migration
+class RenameCollectionCreatedByClient < ActiveRecord::Migration[4.2]
   def up
     rename_column :collections, :create_by_client, :created_by_client
   end
index 614599bbf85c6519bfccd243b0e66f5f13df06c8..ee226394637740a760217124df556aea40effa1b 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddUuidToCollections < ActiveRecord::Migration
+class AddUuidToCollections < ActiveRecord::Migration[4.2]
   def change
     add_column :collections, :uuid, :string
   end
index dd2ddb30e1e31a85e237ae802b57bb6b01fd0ba1..0bf89ae836a597912088c23e5a35b4cebef1b1b3 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateNodes < ActiveRecord::Migration
+class CreateNodes < ActiveRecord::Migration[4.2]
   def up
     create_table :nodes do |t|
       t.string :uuid
index 5a2d97e59ec918441bb013bb303066cf93dfea61..972712c765e4580f1731df7d4e3c9cf247a9825d 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreatePipelines < ActiveRecord::Migration
+class CreatePipelines < ActiveRecord::Migration[4.2]
   def up
     create_table :pipelines do |t|
       t.string :uuid
index bf65b5023d360f20f6c7910e4e169fefcff982b6..b81884a3541f2a9002b5ebb5e59ae52a233a740e 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreatePipelineInvocations < ActiveRecord::Migration
+class CreatePipelineInvocations < ActiveRecord::Migration[4.2]
   def up
     create_table :pipeline_invocations do |t|
       t.string :uuid
index 99eee7b17459cbbc06ff4ad59b99278809d4948e..23fd6c37f7a93582c0462ae057a43b6e561be4dc 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddIndexToCollectionsAndMetadata < ActiveRecord::Migration
+class AddIndexToCollectionsAndMetadata < ActiveRecord::Migration[4.2]
   def up
     add_index :collections, :uuid, :unique => true
     add_index :metadata, :uuid, :unique => true
index 75a8ded6f61f91130dac35fd7dfcb80f7f5b5f3e..b644b99cf9c1d05ae069e7723ab5daffdd2e24be 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateSpecimens < ActiveRecord::Migration
+class CreateSpecimens < ActiveRecord::Migration[4.2]
   def up
     create_table :specimens do |t|
       t.string :uuid
index 032405aa17806bdeba823ce617507d2905609dd4..bf362274fc3dc1bfb251b67f9d3569e986287415 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateProjects < ActiveRecord::Migration
+class CreateProjects < ActiveRecord::Migration[4.2]
   def up
     create_table :projects do |t|
       t.string :uuid
index dc4305db6966dd4428fe67d5b74e9fc36c5ab464..049b5e2d639baa303ee36f404defb73482402ed4 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameMetadataAttributes < ActiveRecord::Migration
+class RenameMetadataAttributes < ActiveRecord::Migration[4.2]
   def up
     rename_column :metadata, :target_kind, :tail_kind
     rename_column :metadata, :target_uuid, :tail
index 8a95768ff8863ade9c6d5c135a14b4839f03be50..af3457aaa06d3d51a6b2bacbb2085147c60ea6d5 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateUsers < ActiveRecord::Migration
+class CreateUsers < ActiveRecord::Migration[4.2]
   def change
     create_table :users do |t|
       t.string :uuid
index 195becb9bcaed83da444398290e018fe89a55afd..9ebc676e3896f4dfbca7ced39efa0abf70088c6b 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateLogs < ActiveRecord::Migration
+class CreateLogs < ActiveRecord::Migration[4.2]
   def up
     create_table :logs do |t|
       t.string :uuid
index 4e98c7ecbd79e339bd04f2224bb3494a9612b7ba..5b0b76cff713f6a56fd89040e3967888c752313d 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddModifiedAtToLogs < ActiveRecord::Migration
+class AddModifiedAtToLogs < ActiveRecord::Migration[4.2]
   def change
     add_column :logs, :modified_at, :datetime
   end
index 46d87c553deb7375649e44bfb16900f48f95312d..96b1769d1ceafae48f85de91ab24fdc44f5add00 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddUuidIndexToUsers < ActiveRecord::Migration
+class AddUuidIndexToUsers < ActiveRecord::Migration[4.2]
   def change
     add_index :users, :uuid, :unique => true
   end
index 326e09d01a0278d26df28d8de3f1bec9496d5a29..c0f3efc81198e89125d86d78e8685a4ad52be0d6 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateApiClients < ActiveRecord::Migration
+class CreateApiClients < ActiveRecord::Migration[4.2]
   def change
     create_table :api_clients do |t|
       t.string :uuid
index 7a1810971876df18fee3664c032bd5cb283d0918..2385c70ff10d1bcb45433292af742107767577cb 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateApiClientAuthorizations < ActiveRecord::Migration
+class CreateApiClientAuthorizations < ActiveRecord::Migration[4.2]
   def change
     create_table :api_client_authorizations do |t|
       t.string :api_token, :null => false
index 9a31222e2411ca6218c05bd010fa72f05a736c6a..7be89a178e134d26ab79600ec41ec9cae29ffa7a 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameCreatedByToOwner < ActiveRecord::Migration
+class RenameCreatedByToOwner < ActiveRecord::Migration[4.2]
   def tables
     %w{api_clients collections logs metadata nodes pipelines pipeline_invocations projects specimens users}
   end
index f3e6b450df03ba0088c48bfcd46993de3ab51b38..b46a459e53feb62f2e33a172bae1a19edd18a392 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameMetadataToLinks < ActiveRecord::Migration
+class RenameMetadataToLinks < ActiveRecord::Migration[4.2]
   def up
     rename_table :metadata, :links
     rename_column :links, :tail, :tail_uuid
index 78ba71e41ec28ed55ae5e48560139d9301e16980..36ef2f4b0b79e2ab0403cf185bd51c29ab9bfb76 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddPropertiesToSpecimen < ActiveRecord::Migration
+class AddPropertiesToSpecimen < ActiveRecord::Migration[4.2]
   def change
     add_column :specimens, :properties, :text
   end
index ca2441ae85287dbb490d1a0fb3c4a591d02f91c9..cb00d2fe7d65af7d8c05d9b4c142e6f60b276d70 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddManifestTextToCollection < ActiveRecord::Migration
+class AddManifestTextToCollection < ActiveRecord::Migration[4.2]
   def change
     add_column :collections, :manifest_text, :text
   end
index ab069563e9109cbab35ea86219f2ea775cc3d457..cb0c519935d3d140c14f894bcf221ac08071391a 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateJobs < ActiveRecord::Migration
+class CreateJobs < ActiveRecord::Migration[4.2]
   def change
     create_table :jobs do |t|
       t.string :uuid
index 37c821cc903fe7e52f144ac0c1c139131df29dd2..19cc08ba804a000bf182b0dd472c0f3239dc484a 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateJobSteps < ActiveRecord::Migration
+class CreateJobSteps < ActiveRecord::Migration[4.2]
   def change
     create_table :job_steps do |t|
       t.string :uuid
index a92e92b4a211dfb2b6b7c1cdec166238feb01abb..63a2e2e4bbeef60dafa519aca600a21e26ddc1f6 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddPriorityToJobs < ActiveRecord::Migration
+class AddPriorityToJobs < ActiveRecord::Migration[4.2]
   def change
     add_column :jobs, :priority, :string
   end
index 0a0154d46d6c2cd4568c488a7ab6eb037332120c..a009db145955da5c792f4a13e3c6379792a416e3 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddIndexOnTimestamps < ActiveRecord::Migration
+class AddIndexOnTimestamps < ActiveRecord::Migration[4.2]
   def tables
     %w{api_clients collections jobs job_steps links logs nodes pipeline_invocations pipelines projects specimens users}
   end
index 453e13474047419d5b2c73674da411140203a789..fef4a5a5b856c02df72789b794d83af2cbd768ef 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddPropertiesToPipelineInvocations < ActiveRecord::Migration
+class AddPropertiesToPipelineInvocations < ActiveRecord::Migration[4.2]
   def change
     add_column :pipeline_invocations, :properties, :text
   end
index 4cecd0ec0095eb4c2ba26be058b53b3c0b996229..8c8779d4010aef53589d6069fdefa79b8235ddf6 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RemoveNativeTargetFromLinks < ActiveRecord::Migration
+class RemoveNativeTargetFromLinks < ActiveRecord::Migration[4.2]
   def up
     remove_column :links, :native_target_id
     remove_column :links, :native_target_type
index 602c8b4fcb3302f0178f1b29c5ac0e5fbbedc31b..0e916218522927d04c9b46d5d11fe6c4b222a9ca 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameProjectsToGroups < ActiveRecord::Migration
+class RenameProjectsToGroups < ActiveRecord::Migration[4.2]
   def up
     rename_table :projects, :groups
     rename_index :groups, :index_projects_on_created_at, :index_groups_on_created_at
index 8ea3657afe556c2801573a7745fb45d98d385d93..a1047960a1449a2ac47ae64e9946a8d161f1d4ba 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddIsLockedByToJobs < ActiveRecord::Migration
+class AddIsLockedByToJobs < ActiveRecord::Migration[4.2]
   def change
     add_column :jobs, :is_locked_by, :string
   end
index aa30165fd6025b12bcf998e8a1b15c4078e806c3..3003387d6cd42132903585f1c2e364e8385145d8 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddLogToJobs < ActiveRecord::Migration
+class AddLogToJobs < ActiveRecord::Migration[4.2]
   def change
     add_column :jobs, :log, :string
   end
index 9a64feac2d3f7f49606b8a93fdd9eccfc20ddea0..92f240a330d4d431913a8a7e9c5b04c1945881a4 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddTasksSummaryToJobs < ActiveRecord::Migration
+class AddTasksSummaryToJobs < ActiveRecord::Migration[4.2]
   def change
     add_column :jobs, :tasks_summary, :text
   end
index aae3ff2aca44ee3b1aba65c6f0190162ce3a09fa..b3d6e587c5f311468b95c86b7fa81871c6fad3b1 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddResourceLimitsToJobs < ActiveRecord::Migration
+class AddResourceLimitsToJobs < ActiveRecord::Migration[4.2]
   def change
     add_column :jobs, :resource_limits, :text
   end
index 8606698b60545f714d0fe1ecb553cffb5bc4f4c4..0e8ab5ab0bc4a3ff13e4d08023d275114ddc84d5 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameJobCommandToScript < ActiveRecord::Migration
+class RenameJobCommandToScript < ActiveRecord::Migration[4.2]
   def up
     rename_column :jobs, :command, :script
     rename_column :jobs, :command_parameters, :script_parameters
index 61cc2778eb55f62002f654af7b8a42d0e66fbc67..8ad26870bdd85cb2cf8d55b8bb2cbd149d522089 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenamePipelineInvocationToPipelineInstance < ActiveRecord::Migration
+class RenamePipelineInvocationToPipelineInstance < ActiveRecord::Migration[4.2]
   def up
     rename_table :pipeline_invocations, :pipeline_instances
     rename_index :pipeline_instances, :index_pipeline_invocations_on_created_at, :index_pipeline_instances_on_created_at
index 012a86a2b4948c8d8aadd2e58ebb59d7d2bfe07e..eea3444bab68ffd30c258d3a7434169db2bb06a3 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenamePipelinesToPipelineTemplates < ActiveRecord::Migration
+class RenamePipelinesToPipelineTemplates < ActiveRecord::Migration[4.2]
   def up
     rename_column :pipeline_instances, :pipeline_uuid, :pipeline_template_uuid
     rename_table :pipelines, :pipeline_templates
index 05d9ffb2c58ff018cea3b1551b82af8a4982b398..96f3ff28a0b484bb3cabfc87ca95d822f562eb37 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameJobStepsToJobTasks < ActiveRecord::Migration
+class RenameJobStepsToJobTasks < ActiveRecord::Migration[4.2]
   def up
     rename_table :job_steps, :job_tasks
     rename_index :job_tasks, :index_job_steps_on_created_at, :index_job_tasks_on_created_at
index 935ce46d6c7d6cc363d2c48003920864573d6396..feb5b3efebd1e19750746a53e296592faa06a848 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddDefaultOwnerToUsers < ActiveRecord::Migration
+class AddDefaultOwnerToUsers < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :default_owner, :string
   end
index 0f2b18f9c88d8a5e7dff8c33fce6f12abd1cc32b..0ccd301808f524b39772bea169ba5954c51ef01a 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddDefaultOwnerToApiClientAuthorizations < ActiveRecord::Migration
+class AddDefaultOwnerToApiClientAuthorizations < ActiveRecord::Migration[4.2]
   def change
     add_column :api_client_authorizations, :default_owner, :string
   end
index 972a61f52c58f94bef07377746633f1c7f7abfb5..6e42828dc838b82f18bca8875173c500a6e797db 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateCommits < ActiveRecord::Migration
+class CreateCommits < ActiveRecord::Migration[4.2]
   def change
     create_table :commits do |t|
       t.string :repository_name
index d63b2a6ebd1aa6014398cd13e1bf98dfec130a1e..59fc3c253ff4e360225573036974f3ac8ae7a2e6 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateCommitAncestors < ActiveRecord::Migration
+class CreateCommitAncestors < ActiveRecord::Migration[4.2]
   def change
     create_table :commit_ancestors do |t|
       t.string :repository_name
index ed66bc7546a0f622536669d5a593305e1e3c7e1e..46c9e848c42d279a99fb6116db167c71b2799ab1 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameOrvosToArvados < ActiveRecord::Migration
+class RenameOrvosToArvados < ActiveRecord::Migration[4.2]
   def up
     Link.update_all("head_kind=replace(head_kind,'orvos','arvados')")
     Link.update_all("tail_kind=replace(tail_kind,'orvos','arvados')")
index 79c33db20224025b09a79335f4f3cb12c3742375..1e21464c60d5a28b5bca1e152460b7cb0e85b851 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateKeepDisks < ActiveRecord::Migration
+class CreateKeepDisks < ActiveRecord::Migration[4.2]
   def change
     create_table :keep_disks do |t|
       t.string :uuid, :null => false
index 5a815126f323f0987a34e9aaea5c84733045faeb..9f08a3ce1ff74c90ab3a989f76f98a820e4fd9bb 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddServiceHostAndServicePortAndServiceSslFlagToKeepDisks < ActiveRecord::Migration
+class AddServiceHostAndServicePortAndServiceSslFlagToKeepDisks < ActiveRecord::Migration[4.2]
   def change
     add_column :keep_disks, :service_host, :string
     add_column :keep_disks, :service_port, :integer
index 2f10e1cca1ca8982b985e173b9790bfcecead50b..23461b438ac0574984d02d213170cc410dc0cd4d 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddCreatedByJobTaskToJobTasks < ActiveRecord::Migration
+class AddCreatedByJobTaskToJobTasks < ActiveRecord::Migration[4.2]
   def change
     add_column :job_tasks, :created_by_job_task, :string
   end
index 84a2df2930a7e6244d72747261cef616d026ec75..8caa39c33cb708d1df6ef0783e376bbfb6c337c1 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddQsequenceToJobTasks < ActiveRecord::Migration
+class AddQsequenceToJobTasks < ActiveRecord::Migration[4.2]
   def change
     add_column :job_tasks, :qsequence, :integer
   end
index 91652f5af72137220e17f5d6ac7c4c45b7dc6d13..e7bcd656ac4455bf86f7fd7f8eb42c7cd5a1008d 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class FixJobTaskQsequenceType < ActiveRecord::Migration
+class FixJobTaskQsequenceType < ActiveRecord::Migration[4.2]
   def up
     change_column :job_tasks, :qsequence, :integer, :limit => 8
   end
index 94ea67d97cee143a6f96f844f7000cd460ef6405..5873eaa002e32a8d123504de5ea235ec36788cf2 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class UpdateNodesIndex < ActiveRecord::Migration
+class UpdateNodesIndex < ActiveRecord::Migration[4.2]
   def up
     remove_index :nodes, :hostname
     add_index :nodes, :hostname
index daeabb372467c3722cdbf2b19c0717b0a1da00c0..d9e4e542bff1ff3df49d63b682dfacb3981353c5 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateAuthorizedKeys < ActiveRecord::Migration
+class CreateAuthorizedKeys < ActiveRecord::Migration[4.2]
   def change
     create_table :authorized_keys do |t|
       t.string :uuid, :null => false
index 97ecb73e95bce8682be984851b1dd2fff4132d6c..8a9a74002bf36a970c4a2d6dd85ae93bc0490503 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateVirtualMachines < ActiveRecord::Migration
+class CreateVirtualMachines < ActiveRecord::Migration[4.2]
   def change
     create_table :virtual_machines do |t|
       t.string :uuid, :null => false
index 6e8c9472618269a8b84d042f91169a1c9c9ae364..3f6df0527f57118480af16d51aae3abdd34d5a88 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateRepositories < ActiveRecord::Migration
+class CreateRepositories < ActiveRecord::Migration[4.2]
   def change
     create_table :repositories do |t|
       t.string :uuid, :null => false
index 1e5f6cca7b7d626d25b5c4f33feecb183edf48ad..a101480d0bf21857867707c7ec507346ac4a6213 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameAuthorizedKeyAuthorizedUserToAuthorizedUserUuid < ActiveRecord::Migration
+class RenameAuthorizedKeyAuthorizedUserToAuthorizedUserUuid < ActiveRecord::Migration[4.2]
   def up
     remove_index :authorized_keys, [:authorized_user, :expires_at]
     rename_column :authorized_keys, :authorized_user, :authorized_user_uuid
index bb5767d79d2e09e8d7b3831b1d8c9661aebe5d12..fb62439723cfaf28eab75285e2bf8671b887025c 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddNameUniqueIndexToRepositories < ActiveRecord::Migration
+class AddNameUniqueIndexToRepositories < ActiveRecord::Migration[4.2]
   def up
     remove_index :repositories, :name
     add_index :repositories, :name, :unique => true
index e74acbca81051f63d88a08d913e5c1749f624e18..15ea0384854a6d2892dbe280624f68b31f2a33ae 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddIsTrustedToApiClients < ActiveRecord::Migration
+class AddIsTrustedToApiClients < ActiveRecord::Migration[4.2]
   def change
     add_column :api_clients, :is_trusted, :boolean, :default => false
   end
index 754ae6a44ff563c13517cd53f447ac0ffb2ce68d..91a69b3b68816f39445a38d7d81af7e9eff25c95 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddIsActiveToUsers < ActiveRecord::Migration
+class AddIsActiveToUsers < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :is_active, :boolean, :default => false
   end
index 9986a3052d3c020103f1629166f4feb626a38d2a..eb88373121eb01e4ab643e70a2845a46c829ac54 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class ActivateAllAdmins < ActiveRecord::Migration
+class ActivateAllAdmins < ActiveRecord::Migration[4.2]
   def up
     User.update_all({is_active: true}, ['is_admin=?', true])
   end
index 6dc677d26b77ce65290b5f894cf0009ea6fc9984..d1491377d4220b6265e51e22e00223f0f3980cba 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateTraits < ActiveRecord::Migration
+class CreateTraits < ActiveRecord::Migration[4.2]
   def change
     create_table :traits do |t|
       t.string :uuid, :null => false
index 4d8e1d2c5a8f6046c95fe7c0bc002263bbd45028..c316e92d84f6d6cc44063d4b4220acc2643792cd 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateHumans < ActiveRecord::Migration
+class CreateHumans < ActiveRecord::Migration[4.2]
   def change
     create_table :humans do |t|
       t.string :uuid, :null => false
index fa179da8019053b1a82ccb1b3cd3546fbb028710..957aa58e8fd9a32dbb060a0c8dda542f3266a450 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameForeignUuidAttributes < ActiveRecord::Migration
+class RenameForeignUuidAttributes < ActiveRecord::Migration[4.2]
   def change
     rename_column :api_client_authorizations, :default_owner, :default_owner_uuid
     [:api_clients, :authorized_keys, :collections,
index e56f3133ace83623afff7860e677bd7d628978c1..655fff77aa9edfd5aad38b778c01b564dbfe33d4 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameJobForeignUuidAttributes < ActiveRecord::Migration
+class RenameJobForeignUuidAttributes < ActiveRecord::Migration[4.2]
   def change
     rename_column :jobs, :cancelled_by_client, :cancelled_by_client_uuid
     rename_column :jobs, :cancelled_by_user, :cancelled_by_user_uuid
index 10dadc43c736651ff93b614a1bb29baefe10c13a..c40ef46a6a14c634dbf84bc0698b6254c6aba46c 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameUserDefaultOwner < ActiveRecord::Migration
+class RenameUserDefaultOwner < ActiveRecord::Migration[4.2]
   def change
     rename_column :users, :default_owner, :default_owner_uuid
   end
index 43a32716dd857fa0da1176db78704be47c595449..cef3a35da17459d1ff5894ab875309ffcef28c9c 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddScopesToApiClientAuthorizations < ActiveRecord::Migration
+class AddScopesToApiClientAuthorizations < ActiveRecord::Migration[4.2]
   def change
     add_column :api_client_authorizations, :scopes, :text, :null => false, :default => ['all'].to_yaml
   end
index 2fe28c3d1c9e57cea45f563867bea8abc0aa28f5..d77f29a1d658459091f3c7993c102257d3c441fb 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameResourceLimitsToRuntimeConstraints < ActiveRecord::Migration
+class RenameResourceLimitsToRuntimeConstraints < ActiveRecord::Migration[4.2]
   def change
     rename_column :jobs, :resource_limits, :runtime_constraints
   end
index c28c26859f2fe14101960aed7910157156256099..b9e933e2bff83f20f5386071d52a0d9bfa698ec8 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class NormalizeCollectionUuid < ActiveRecord::Migration
+class NormalizeCollectionUuid < ActiveRecord::Migration[4.2]
   def count_orphans
     %w(head tail).each do |ht|
       results = ActiveRecord::Base.connection.execute(<<-EOS)
index 90dbd6ef6a284fa2efad98292c9e2dc78c357762..fb7bff666ec2bb0621acdf471afd8873db6955b9 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class FixLinkKindUnderscores < ActiveRecord::Migration
+class FixLinkKindUnderscores < ActiveRecord::Migration[4.2]
   def up
     update_sql <<-EOS
 UPDATE links
index a54c4cc20debf664929d08f6b67b335f593ee624..9f5ade29ff175f54e7c28d8c0cb491847c3b39d7 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class NormalizeCollectionUuidsInScriptParameters < ActiveRecord::Migration
+class NormalizeCollectionUuidsInScriptParameters < ActiveRecord::Migration[4.2]
   include CurrentApiClient
   def up
     act_as_system_user do
index ccf6210bf8aba006bbcf44d382231635c8f75ae5..e2febf85a9084ca2c3f4dc4b3e9e63b1ee2508e1 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddNondeterministicColumnToJob < ActiveRecord::Migration
+class AddNondeterministicColumnToJob < ActiveRecord::Migration[4.2]
   def up
     add_column :jobs, :nondeterministic, :boolean
   end
index fc09892ec8d472020e1e0477e91bfd15c7a2f41b..38a4a264a3f7785d0384b6b812b049910aeb2b71 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class SeparateRepositoryFromScriptVersion < ActiveRecord::Migration
+class SeparateRepositoryFromScriptVersion < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   def fixup pt
index 5e2b6369234c1cec085adfbb3f354c48bd78ffb8..243df8d15077c40fc7e1d5731b9e26f5960f967c 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddRepositoryColumnToJob < ActiveRecord::Migration
+class AddRepositoryColumnToJob < ActiveRecord::Migration[4.2]
   def up
     add_column :jobs, :repository, :string
   end
index a66d92ece199a1a1eefc3be60bde31cf1a2cca9d..04a94d8e82f92b89cf0dfc1990b02a4f2bc8b3c7 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddOutputIsPersistentToJob < ActiveRecord::Migration
+class AddOutputIsPersistentToJob < ActiveRecord::Migration[4.2]
   def change
     add_column :jobs, :output_is_persistent, :boolean, null: false, default: false
   end
index b4085ba92eb5c0af384abdfc04eff45086fb7340..3303fd9db160bed31df7da47a289879c62d77932 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RemoveKindColumns < ActiveRecord::Migration
+class RemoveKindColumns < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   def up
index 33bdd418ef536c4e85243e9f8996da7061b4b5e4..f356c055134a64fa97b577f41dd2a94b5215a5d7 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddSystemGroup < ActiveRecord::Migration
+class AddSystemGroup < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   def up
index 3d93ce538abfa6d506684be2e203b30d04b7bd5b..35fabeacb5e8ac13987e0f6811eebdbd7c72f276 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameLogInfoToProperties < ActiveRecord::Migration
+class RenameLogInfoToProperties < ActiveRecord::Migration[4.2]
   def change
     rename_column :logs, :info, :properties
   end
index ef6213926ffff25e2baf268a649c3f546a5b28c8..de126a2925583c7af5f69257f682e31ba1077e99 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddGroupClassToGroups < ActiveRecord::Migration
+class AddGroupClassToGroups < ActiveRecord::Migration[4.2]
   def change
     add_column :groups, :group_class, :string
     add_index :groups, :group_class
index fd140745344bca4b7c8ead0cd11756a12cd338a2..4cabfacd29a22160e3cf6f8a5b3fe13e6c66ad52 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameAuthKeysUserIndex < ActiveRecord::Migration
+class RenameAuthKeysUserIndex < ActiveRecord::Migration[4.2]
   # Rails' default name for this index is so long, Rails can't modify
   # the index later, because the autogenerated temporary name exceeds
   # PostgreSQL's 64-character limit.  This migration gives the index
index 4426befef1beb034febdcb6663cfb4f36a474100..6fbd10f1a4756d53cc03bc81ea1bf06e6d5b4982 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class TimestampsNotNull < ActiveRecord::Migration
+class TimestampsNotNull < ActiveRecord::Migration[4.2]
   def up
     ActiveRecord::Base.connection.tables.each do |t|
       next if t == 'schema_migrations'
index db84c2cfab6ca5f5f629d18ace8021ffebc3ca99..89a48d094a14c7d5fe569b607ecc311d3710fd23 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class PipelineInstanceState < ActiveRecord::Migration
+class PipelineInstanceState < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   def up
index 428ea57a6a78236da055b593e8e5b954e59af096..b1b679d6456f5680789b2c2331d34cca6ccf3c83 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddObjectOwnerToLogs < ActiveRecord::Migration
+class AddObjectOwnerToLogs < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   def up
index b706edb7f197a4bd3a5cb9409bf8522486f5ab2c..6c1dc74529f4f94d231b1ff2a1319b1ef901c491 100644 (file)
@@ -7,7 +7,7 @@
 # login list.  This migration converts those VM-specific scopes to the new
 # general format, and back.
 
-class NewScopeFormat < ActiveRecord::Migration
+class NewScopeFormat < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   VM_PATH_REGEX =
index c7f6e7a85d644921697f6701021e8af9d1fe74f3..9c177f788ab2f6d5b340f6a1788d77c8a581f52b 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddUniqueNameIndexToLinks < ActiveRecord::Migration
+class AddUniqueNameIndexToLinks < ActiveRecord::Migration[4.2]
   def change
     # Make sure PgPower is here. Otherwise the "where" will be ignored
     # and we'll end up with a far too restrictive unique
index e6cb967538cbd3a5ed91c43812c81fa701951dff..8ee3b4972ee01ac1193a6be121cefa5b033740da 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateKeepServices < ActiveRecord::Migration
+class CreateKeepServices < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   def change
index 09e2ce13824cd3e5f4938c66e455fb9c194d08d6..bc9b50ea3aef4f96cf9896b16d1ace347f503e27 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddDescriptionToPipelineTemplates < ActiveRecord::Migration
+class AddDescriptionToPipelineTemplates < ActiveRecord::Migration[4.2]
   def change
     add_column :pipeline_templates, :description, :text
   end
index 62b1df08739058ebdc8b0f13bd074b79c63d16eb..a828f7d1779940d14b67a1d75a0b3c8207edcde4 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddSuppliedScriptVersion < ActiveRecord::Migration
+class AddSuppliedScriptVersion < ActiveRecord::Migration[4.2]
   def up
     add_column :jobs, :supplied_script_version, :string
   end
index d76ac930c6e9868c838b5a35e2854efc9898a0b3..3d08e0f5b3529e319e0d153c3690b081ec431efd 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RemoveNameFromCollections < ActiveRecord::Migration
+class RemoveNameFromCollections < ActiveRecord::Migration[4.2]
   def up
     remove_column :collections, :name
   end
index 511138ff5d987df90ada344fba628519a6891d69..46a653d1eab1e6261cf0112985091e0dc744fa95 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RemoveActiveAndSuccessFromPipelineInstances < ActiveRecord::Migration
+class RemoveActiveAndSuccessFromPipelineInstances < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   def up
index f6daa9788baf760817a0ef4f5b89436a72381346..06c7e36220fcb4761963ebb51e0ed08603d46559 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameFolderToProject < ActiveRecord::Migration
+class RenameFolderToProject < ActiveRecord::Migration[4.2]
   def up
     Group.update_all("group_class = 'project'", "group_class = 'folder'")
   end
index 2be03f5fcd0974f79ddf849faa787cf24fe8ed0f..ed55f1320a91f3ba14d057b8c980805f3ffb7a04 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddDockerLocatorToJobs < ActiveRecord::Migration
+class AddDockerLocatorToJobs < ActiveRecord::Migration[4.2]
   def change
     add_column :jobs, :docker_image_locator, :string
   end
index cd49da426b1ac6f9bddd932f755e9d7bface4e06..8be5f666e3a08a95e90e7dad433c2a3a2978deca 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AnonymousGroup < ActiveRecord::Migration
+class AnonymousGroup < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   def up
index 53e087a1f1b233d7167b28923d4827a3425d22b2..2990621413d37a3b70afc2f3fd0ff283baf97162 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class JobTaskSerialQsequence < ActiveRecord::Migration
+class JobTaskSerialQsequence < ActiveRecord::Migration[4.2]
   SEQ_NAME = "job_tasks_qsequence_seq"
 
   def up
index 0c0eba6bdf9281ca209f24b795c6ea9f15a52d59..33921dcdeaeaecd8c9e874152cbd2f22788ac525 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class EmptyCollection < ActiveRecord::Migration
+class EmptyCollection < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   def up
index 003f74b1363653c4627668010afdd31546dfabf3..62ef93f8c5019fdc34bfc7b920f5a0f76aa10623 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CollectionUseRegularUuids < ActiveRecord::Migration
+class CollectionUseRegularUuids < ActiveRecord::Migration[4.2]
   def up
     add_column :collections, :name, :string
     add_column :collections, :description, :string
index a226836b6b6aa29766ec8098a9897acfe0bf9318..8acae9f20345977611a1000d75c63f08099ac5ef 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddUniqueNameConstraints < ActiveRecord::Migration
+class AddUniqueNameConstraints < ActiveRecord::Migration[4.2]
   def change
     # Ensure uniqueness before adding constraints.
     ["collections", "pipeline_templates", "groups"].each do |table|
index 13224205e6df8c904749a3cada55a5c410ba7613..9f003ba8d6ca884116b0a540898659981562f41b 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddNotNullConstraintToGroupName < ActiveRecord::Migration
+class AddNotNullConstraintToGroupName < ActiveRecord::Migration[4.2]
   def change
     ActiveRecord::Base.connection.execute("update groups set name=uuid where name is null or name=''")
     change_column_null :groups, :name, false
index dbb4c06d74958b9c096dddc63d34d7079fa32541..453ce90fdb34e1ba8526cae7fd99ab2d240c921e 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RemoveOutputIsPersistentColumn < ActiveRecord::Migration
+class RemoveOutputIsPersistentColumn < ActiveRecord::Migration[4.2]
   def up
     remove_column :jobs, :output_is_persistent
   end
index 87f29b635b737d0499382588b82bddd747326abd..e780d19fcb56d3d150f39c0060328dc11b52cf3d 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class JobPriorityFixup < ActiveRecord::Migration
+class JobPriorityFixup < ActiveRecord::Migration[4.2]
   def up
     remove_column :jobs, :priority
     add_column :jobs, :priority, :integer, null: false, default: 0
index df64127f90dc4bd19abe9a6a2edbe5e0fc4bbdea..85d639492982526433eb9ccb9750d41cc1210d66 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddStartFinishTimeToTasksAndPipelines < ActiveRecord::Migration
+class AddStartFinishTimeToTasksAndPipelines < ActiveRecord::Migration[4.2]
   def up
     add_column :job_tasks, :started_at, :datetime
     add_column :job_tasks, :finished_at, :datetime
index 1ac030bad3d79f2cdb127d73e300e56a9b0414f5..9a2c49dd6abe6860c129474a6b642ac03636ca55 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddDescriptionToPipelineInstancesAndJobs < ActiveRecord::Migration
+class AddDescriptionToPipelineInstancesAndJobs < ActiveRecord::Migration[4.2]
   def up
     add_column :pipeline_instances, :description, :text, null: true
     add_column :jobs, :description, :text, null: true
index c111708e9b929e6882015ce428a318a1d2948074..96cf00bbce83e841d74418b43ab04615e3378124 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class ChangeUserOwnerUuidNotNull < ActiveRecord::Migration
+class ChangeUserOwnerUuidNotNull < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   def up
index 513ca04cb4ac0c005f96ecd83e9575cc68c8b27f..c7203183734361be05c11f1ce1d7e81309cd4784 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddPropertiesToNode < ActiveRecord::Migration
+class AddPropertiesToNode < ActiveRecord::Migration[4.2]
   def up
     add_column :nodes, :properties, :text
   end
index 77310d3ac95ac315a06134f48834fea267a43313..46a5e84362402d0f4e16086e33a7ffbb7fee7b9c 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddStateToJob < ActiveRecord::Migration
+class AddStateToJob < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   def up
index 55378d7131f283f191f7d90edead688ace4ce3d3..e7876c68b2e5f7ac2563cb8bd483767deb54c00a 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddJobUuidToNodes < ActiveRecord::Migration
+class AddJobUuidToNodes < ActiveRecord::Migration[4.2]
   def up
     change_table :nodes do |t|
       t.column :job_uuid, :string
index c0e3b3ba0766a0128e83266787a9a2132bd1251b..ba89a189a57c8162cf1725a7f2c9c9314773af49 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddArvadosSdkVersionToJobs < ActiveRecord::Migration
+class AddArvadosSdkVersionToJobs < ActiveRecord::Migration[4.2]
   def up
     change_table :jobs do |t|
       t.column :arvados_sdk_version, :string
index a6d4e76404c1c14d4d6452fff4a984ca9eaaba15..a3f68954b23a12d4d9668ab1d19730a6e7795ff7 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class OwnerUuidIndex < ActiveRecord::Migration
+class OwnerUuidIndex < ActiveRecord::Migration[4.2]
   def tables_with_owner_uuid
     %w{api_clients authorized_keys collections groups humans
        job_tasks jobs keep_disks keep_services links logs
index 554474d33ddd2d6a6f64a02d61cddefacdc81582..1cd66291203e717dbd4f3474f4c9f7167e3237f8 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class DescriptionsAreStrings < ActiveRecord::Migration
+class DescriptionsAreStrings < ActiveRecord::Migration[4.2]
   def tables_with_description_column
     %w{collections groups jobs pipeline_instances pipeline_templates}
   end
index 50ab30c39a89b4955f7cc943502211d2ec7112d9..7abd778c045d75f15d5ce41e10d6a027d88c56c4 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CollectionFileNames < ActiveRecord::Migration
+class CollectionFileNames < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   def up
index c8e9fef872d5b0ecaf463624c7b03cc040372240..abea1915facdaa9bde473798773a3a5e0f2bee7c 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class SearchIndex < ActiveRecord::Migration
+class SearchIndex < ActiveRecord::Migration[4.2]
   def tables_with_searchable_columns
     {
       "api_client_authorizations" => ["api_token", "created_by_ip_address", "last_used_by_ip_address", "default_owner_uuid"],
index 7371b0ea53ffaae15f5d6b3409d60977f75b4b73..6a296031460df3650b2e17fc3ef1670ac48e8294 100644 (file)
@@ -8,7 +8,7 @@
 
 require "./db/migrate/20141208185217_search_index.rb"
 
-class NoDescriptionInSearchIndex < ActiveRecord::Migration
+class NoDescriptionInSearchIndex < ActiveRecord::Migration[4.2]
   def up
     all_tables = %w{collections groups jobs pipeline_instances pipeline_templates}
     all_tables.each do |table|
index b9b56a53cbbcc66e268a3b27ed2c632a2a58fb38..39a62fcaffbe1ff96518fbcdcad1ccecdb2b3d6d 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class FullTextSearch < ActiveRecord::Migration
+class FullTextSearch < ActiveRecord::Migration[4.2]
 
   def up
     execute "CREATE INDEX collections_full_text_search_idx ON collections USING gin(#{Collection.full_text_tsvector});"
index 03e7fbba5daad0cfedb0a24c6e2357412998fd62..71f769c157c96ca4ba60d6b94244d99d54c810ad 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class SetGroupClassOnAnonymousGroup < ActiveRecord::Migration
+class SetGroupClassOnAnonymousGroup < ActiveRecord::Migration[4.2]
   include CurrentApiClient
   def up
     act_as_system_user do
index ea9f393540490f93b9692d2cfd085fc175e3ecec..745833003dd4a25a7dec095656bcdf6f3984aa6a 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AllUsersCanReadAnonymousGroup < ActiveRecord::Migration
+class AllUsersCanReadAnonymousGroup < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   def up
index e6e54579a602664310b3fe331159d56055fb71af..b9ab9cd9db78edb4332382198f2ffb25e277cb1e 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameReplicationAttributes < ActiveRecord::Migration
+class RenameReplicationAttributes < ActiveRecord::Migration[4.2]
   RENAME = [[:redundancy, :replication_desired],
             [:redundancy_confirmed_as, :replication_confirmed],
             [:redundancy_confirmed_at, :replication_confirmed_at]]
index 6e581883c5709569ad0bd0411f6c61ca3bd43d77..72ef88c18589f73650c5d0db1950dc3b8371c483 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CollectionNameOwnerUniqueOnlyNonExpired < ActiveRecord::Migration
+class CollectionNameOwnerUniqueOnlyNonExpired < ActiveRecord::Migration[4.2]
   def find_index
     indexes = ActiveRecord::Base.connection.indexes('collections')
     name_owner_index = indexes.select do |index|
index 31fc683e20085966c122f46e046dd3bd70722f3c..8814fc87d330875c14f53ccf9d4e6cd5983c247f 100644 (file)
@@ -5,7 +5,7 @@
 require 'has_uuid'
 require 'kind_and_etag'
 
-class FixCollectionPortableDataHashWithHintedManifest < ActiveRecord::Migration
+class FixCollectionPortableDataHashWithHintedManifest < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   class ArvadosModel < ActiveRecord::Base
index 96988e290782325d5f3c032c6f1bcb1487ffda84..0aca20b27b818b8d29f17ff4c975c25581c1abb8 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class ChangeCollectionExpiresAtToDatetime < ActiveRecord::Migration
+class ChangeCollectionExpiresAtToDatetime < ActiveRecord::Migration[4.2]
   def up
     change_column :collections, :expires_at, :datetime
   end
index 79a076ddc822937e61c1e1171703dbb7556a23fd..cb27515a1708de372d732cf3604bd987ef9e38ad 100644 (file)
@@ -5,7 +5,7 @@
 require 'has_uuid'
 require 'kind_and_etag'
 
-class AddUsernameToUsers < ActiveRecord::Migration
+class AddUsernameToUsers < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   SEARCH_INDEX_COLUMNS =
index dc7c1756c55eb72c168035983fdc091c5a24bb04..51e901c00a91df52768a55d8daca087900fbddab 100644 (file)
@@ -5,7 +5,7 @@
 require 'has_uuid'
 require 'kind_and_etag'
 
-class BackwardCompatibilityForUserRepositories < ActiveRecord::Migration
+class BackwardCompatibilityForUserRepositories < ActiveRecord::Migration[4.2]
   include CurrentApiClient
 
   class ArvadosModel < ActiveRecord::Base
index 4e1379e2aab7f6bfb5c7a7310ffd3db40608f643..1930f1332da09f33767f3cf9b636964e8599e6ec 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class NoFilenamesInCollectionSearchIndex < ActiveRecord::Migration
+class NoFilenamesInCollectionSearchIndex < ActiveRecord::Migration[4.2]
   def up
     remove_index :collections, :name => 'collections_search_index'
     add_index :collections, ["owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "portable_data_hash", "uuid", "name"], name: 'collections_search_index'
index a510c16ccde9bdf4577be7e9949a36b8407d27b1..69e9f7f1f7cb885f410c94b531095db23b8151dd 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class ReadOnlyOnKeepServices < ActiveRecord::Migration
+class ReadOnlyOnKeepServices < ActiveRecord::Migration[4.2]
   def change
     add_column :keep_services, :read_only, :boolean, null: false, default: false
   end
index 843837f7046b8f13e056eec2b112181cdc37f54e..373d7477b307f2a00434fa000b828a2105ad44e0 100644 (file)
@@ -4,7 +4,7 @@
 
 require "./db/migrate/20150123142953_full_text_search.rb"
 
-class LeadingSpaceOnFullTextIndex < ActiveRecord::Migration
+class LeadingSpaceOnFullTextIndex < ActiveRecord::Migration[4.2]
   def up
     # Inspect one of the full-text indexes (chosen arbitrarily) to
     # determine whether this migration is needed.
index 2bda546e9cb6d26200dc305ff753113c969702f4..ee6f5ec64056304cbfe533acc8d5d3e08018e2c2 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateContainersAndRequests < ActiveRecord::Migration
+class CreateContainersAndRequests < ActiveRecord::Migration[4.2]
   def change
     create_table :containers do |t|
       t.string :uuid
index a112bea62840bde9e1eacbeeb1072e36dcbf0e11..ba2602076cb83fd4fb792543a4b0fc9fa1dd619d 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class FixContainersIndex < ActiveRecord::Migration
+class FixContainersIndex < ActiveRecord::Migration[4.2]
   def up
     execute "CREATE INDEX container_requests_full_text_search_idx ON container_requests USING gin(#{ContainerRequest.full_text_tsvector});"
     add_index :container_requests, ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "name", "state", "requesting_container_uuid", "container_uuid", "container_image", "cwd", "output_path"], name: 'container_requests_search_index'
index e28ec2870ee7b6c869e10493e2c42555b84050d4..1049da8df6287179ff9675bb01284f8b1bd6708b 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddExitCodeToContainers < ActiveRecord::Migration
+class AddExitCodeToContainers < ActiveRecord::Migration[4.2]
   def change
     add_column :containers, :exit_code, :integer
   end
index 30f8dd0e20dcd369842e381d31fb33c8952efd99..34ad4e763bc3c3cda8340a7ac31b800789d63d43 100644 (file)
@@ -4,7 +4,7 @@
 
 require 'has_uuid'
 
-class AddUuidToApiClientAuthorization < ActiveRecord::Migration
+class AddUuidToApiClientAuthorization < ActiveRecord::Migration[4.2]
   extend HasUuid::ClassMethods
 
   def up
index d5c7587383938df39293b5097c52ef15f0abe85e..c8a8b5c4457c5011d434f6bc6c2a22991c37802b 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddUuidToApiTokenSearchIndex < ActiveRecord::Migration
+class AddUuidToApiTokenSearchIndex < ActiveRecord::Migration[4.2]
   def up
     begin
       remove_index :api_client_authorizations, :name => 'api_client_authorizations_search_index'
index ea6ca6353eb4caa7d09c1aae63cd1acc278f126d..99b24428f50ef666afa81340c653d4fa324f7029 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddComponentsToJob < ActiveRecord::Migration
+class AddComponentsToJob < ActiveRecord::Migration[4.2]
   def up
     add_column :jobs, :components, :text
   end
index 163289bff228e1f9ff2dd97f7b163231effc3796..392e38a5d04c36f081740c4e687c2500fd922d9a 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddAuthsToContainer < ActiveRecord::Migration
+class AddAuthsToContainer < ActiveRecord::Migration[4.2]
   def change
     add_column :containers, :auth_uuid, :string
     add_column :containers, :locked_by_uuid, :string
index 34759044f6a40c899d1909040b9b7f561bd66321..2fcfc29d81e1f1bdf4f91223a62f2d3c5532ae38 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddAuthAndLockToContainerIndex < ActiveRecord::Migration
+class AddAuthAndLockToContainerIndex < ActiveRecord::Migration[4.2]
   Columns_were = ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "state", "log", "cwd", "output_path", "output", "container_image"]
   Columns = Columns_were + ["auth_uuid", "locked_by_uuid"]
   def up
index b15a8e45e6ad697335ad0b4e953b7a90f1e58dbb..29960abf63c6f0560379fc2bee438b42b5b481ac 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class CreateWorkflows < ActiveRecord::Migration
+class CreateWorkflows < ActiveRecord::Migration[4.2]
   def up
     create_table :workflows do |t|
       t.string :uuid
index 1a480767e577d71982d81f95d020eddded6ce87b..16f7a6b97b1206f58545b48f4ebbd52ba1075435 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddScriptParametersDigestToJobs < ActiveRecord::Migration
+class AddScriptParametersDigestToJobs < ActiveRecord::Migration[4.2]
   def change
     add_column :jobs, :script_parameters_digest, :string
     add_index :jobs, :script_parameters_digest
index 320e0834f7a43f9703efcf53ce518006f1cf6be5..38c8627137e7de644a3bd79494089a7c45916d1a 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class PopulateScriptParametersDigest < ActiveRecord::Migration
+class PopulateScriptParametersDigest < ActiveRecord::Migration[4.2]
   def up
     done = false
     while !done
index 949bccb3f4bf50c566c3eedb09c4b181a06bb737..6afd9bfccac8a0f05be0673c0058f79b6f41e8ac 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RepairScriptParametersDigest < ActiveRecord::Migration
+class RepairScriptParametersDigest < ActiveRecord::Migration[4.2]
   def up
     Job.find_each do |j|
       have = j.script_parameters_digest
index 61d327b2960c201f5d74e6c6d8786c41ee3980d4..63e505db42414066f98865d5f7b711f3af021e7c 100644 (file)
@@ -2,11 +2,11 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RenameWorkflowToDefinition < ActiveRecord::Migration
+class RenameWorkflowToDefinition < ActiveRecord::Migration[4.2]
   def up
     rename_column :workflows, :workflow, :definition
-  end 
-    
+  end
+
   def down
     rename_column :workflows, :definition, :workflow
   end
index 063ce971518457b897731245cfa8719d7f31dfcf..4166cc45e3a6722cd15ab9e2bfc6ff5b92bd79dc 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddContainerCount < ActiveRecord::Migration
+class AddContainerCount < ActiveRecord::Migration[4.2]
   def up
     add_column :container_requests, :container_count, :int, :default => 0
   end
index 0ba04f6ae480354f56d36893be2cbbad609e98fc..62cb0edf638362d24afacb078576953571a659c6 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddUseExistingToContainerRequests < ActiveRecord::Migration
+class AddUseExistingToContainerRequests < ActiveRecord::Migration[4.2]
   def up
     add_column :container_requests, :use_existing, :boolean, :default => true
   end
index 6820dfb4e80cfc3ba9380598a80389d89506d319..8c1e982d862849568a7a4d10ec0c81cc67a3a001 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddSchedulingParametersToContainer < ActiveRecord::Migration
+class AddSchedulingParametersToContainer < ActiveRecord::Migration[4.2]
   def change
     add_column :containers, :scheduling_parameters, :text
     add_column :container_requests, :scheduling_parameters, :text
index 168bd4fd056d22272424c1fd25238b26b9c03666..b5d76d0435b071d8fcb75712f2be85699dc9ef13 100644 (file)
@@ -4,7 +4,7 @@
 
 require 'has_uuid'
 
-class AddOutputAndLogUuidToContainerRequest < ActiveRecord::Migration
+class AddOutputAndLogUuidToContainerRequest < ActiveRecord::Migration[4.2]
   extend HasUuid::ClassMethods
 
   def up
index 9d1e75275ae23e4b57081768ff1c8773686a4157..c5286d6283c3b7bec96c38ab024e2189e8182630 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddOutputAndLogUuidsToContainerRequestSearchIndex < ActiveRecord::Migration
+class AddOutputAndLogUuidsToContainerRequestSearchIndex < ActiveRecord::Migration[4.2]
   def up
     begin
       remove_index :container_requests, :name => 'container_requests_search_index'
index 0ec52124deca9eba478da8f4799d1f2e62c34e59..55ab7115757d6fb3042f9bdd8c85e1ea92bc3049 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class FullTextSearchIndexes < ActiveRecord::Migration
+class FullTextSearchIndexes < ActiveRecord::Migration[4.2]
   def fts_indexes
     {
       "collections" => "collections_full_text_search_idx",
index c3bea69f89fe9651b9cd1383d703761f9943fdb7..02166f3b62b50577c7270ab84704123e3417d09c 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class SplitExpiryToTrashAndDelete < ActiveRecord::Migration
+class SplitExpiryToTrashAndDelete < ActiveRecord::Migration[4.2]
   def up
     Collection.transaction do
       add_column(:collections, :trash_at, :datetime)
index aac8ade5b4806f4c940773c15afe6e3ea9e14a02..426c2b96e409e390c06016a4e898d17f6e83ff0c 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddOutputNameToContainerRequests < ActiveRecord::Migration
+class AddOutputNameToContainerRequests < ActiveRecord::Migration[4.2]
   def up
     add_column :container_requests, :output_name, :string, :default => nil
   end
index 1b846fdbe3704740d0b591f092950adb66e4b920..bf54a2313bac6f3a56cbdecbcf3450ca5b03bfaf 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddOutputNameToContainerRequestSearchIndex < ActiveRecord::Migration
+class AddOutputNameToContainerRequestSearchIndex < ActiveRecord::Migration[4.2]
   def up
     begin
       remove_index :container_requests, :name => 'container_requests_search_index'
index 220323d15eb96cd05c610fb8adb17534355a2df2..704be954e31dca46a7a86a815e295ed047800203 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddOutputNameToCrFtsIndex < ActiveRecord::Migration
+class AddOutputNameToCrFtsIndex < ActiveRecord::Migration[4.2]
   def up
     t = "container_requests"
     i = "container_requests_full_text_search_idx"
index cc56e42aec87f4bf590d67a239aab72d3b9e5d84..928db15299af829e5fa59a6442b317c821142096 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class SetFinishedAtOnFinishedPipelineInstances < ActiveRecord::Migration
+class SetFinishedAtOnFinishedPipelineInstances < ActiveRecord::Migration[4.2]
   def change
     ActiveRecord::Base.connection.execute("update pipeline_instances set finished_at=updated_at where finished_at is null and (state='Failed' or state='Complete')")
   end
index d4e13c9dd8d9e2d680be5b111ed6099dea9e30e9..2d641c1729d11d4416dc171dd5fa57082cecefce 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class NoCrMountsAndWorkflowDefInFullTextSearchIndex < ActiveRecord::Migration
+class NoCrMountsAndWorkflowDefInFullTextSearchIndex < ActiveRecord::Migration[4.2]
   def fts_indexes
     {
       "container_requests" => "container_requests_full_text_search_idx",
index 5b8c6a71d47da487fe4449aa494460f4cde42854..295511d0893973caa0d42c96be92a66e82bd9d11 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class NoDowngradeAfterJson < ActiveRecord::Migration
+class NoDowngradeAfterJson < ActiveRecord::Migration[4.2]
   def up
   end
 
index cc8783134fee6f1194f58804cd9af74fac763cf7..ce241bfb6cbbcfcb6fced9ccd36cda343461dabd 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class SerializedColumnsAcceptNull < ActiveRecord::Migration
+class SerializedColumnsAcceptNull < ActiveRecord::Migration[4.2]
   def change
     change_column :api_client_authorizations, :scopes, :text, null: true, default: '["all"]'
   end
index c9b0a8ea99bbdf52a44f29194efe43de6fe5ad88..c94f33133a41abe352054a59c58108f8cf9a08d6 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddPortableDataHashIndexToCollections < ActiveRecord::Migration
+class AddPortableDataHashIndexToCollections < ActiveRecord::Migration[4.2]
   def change
     add_index :collections, :portable_data_hash
   end
index 99b3629a39de1af6bcbba70ced53f006256225d6..259278dcff02121bb111238dcb2aa150f4ce1bb3 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddOutputTtlToContainerRequests < ActiveRecord::Migration
+class AddOutputTtlToContainerRequests < ActiveRecord::Migration[4.2]
   def change
     add_column :container_requests, :output_ttl, :integer, default: 0, null: false
   end
index e11c86f9e60c674b0f36ab353c9d72a0507ac6d3..1c43656b5eb28b4c62ad1841696630f90f68dfc8 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddCreatedByJobTaskIndexToJobTasks < ActiveRecord::Migration
+class AddCreatedByJobTaskIndexToJobTasks < ActiveRecord::Migration[4.2]
   def change
     add_index :job_tasks, :created_by_job_task_uuid
   end
index 44ae7e5ef9cba044ec238d2b0df4abf9469ef27c..c02b469ef29d0bec60af45f7a8372fa9b45f6030 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddObjectOwnerIndexToLogs < ActiveRecord::Migration
+class AddObjectOwnerIndexToLogs < ActiveRecord::Migration[4.2]
   def change
     add_index :logs, :object_owner_uuid
   end
index 2dd1a0ca1cf4cde3d37b531b61407719c2ab57dd..45106399a9c312100992a1022f944841bfdcaf18 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddRequestingContainerIndexToContainerRequests < ActiveRecord::Migration
+class AddRequestingContainerIndexToContainerRequests < ActiveRecord::Migration[4.2]
   def change
     add_index :container_requests, :requesting_container_uuid
   end
index 2c90c9a04bb53894b922d25d3d2745f99e573db2..31238a1b1a59917bb3c1777da863bae80a661a1e 100644 (file)
@@ -4,7 +4,7 @@
 
 require 'migrate_yaml_to_json'
 
-class JobsYamlToJson < ActiveRecord::Migration
+class JobsYamlToJson < ActiveRecord::Migration[4.2]
   def up
     [
       'components',
index 707c3dd946f377d7ada7513cf12a1ced9d896487..15b72047754b38fb58a405a011e4c8b0a31c99f4 100644 (file)
@@ -4,7 +4,7 @@
 
 require 'migrate_yaml_to_json'
 
-class YamlToJson < ActiveRecord::Migration
+class YamlToJson < ActiveRecord::Migration[4.2]
   def up
     [
       ['collections', 'properties'],
index 921803a2970137c89cf8e19c8fdd329061f09c1c..1c78b53be345d17ae7909a677513132fa33d27ac 100644 (file)
@@ -4,7 +4,7 @@
 
 require './db/migrate/20161213172944_full_text_search_indexes'
 
-class JsonCollectionProperties < ActiveRecord::Migration
+class JsonCollectionProperties < ActiveRecord::Migration[4.2]
   def up
     # Drop the FT index before changing column type to avoid
     # "PG::DatatypeMismatch: ERROR: COALESCE types jsonb and text
index 17fc31ff2d06a652e374875c73a067df44e15f69..81a4722652552a686c90da4921bf9e2ee72098b6 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class TrashableGroups < ActiveRecord::Migration
+class TrashableGroups < ActiveRecord::Migration[4.2]
   def up
     add_column :groups, :trash_at, :datetime
     add_index(:groups, :trash_at)
index b864f75c12a56329155c52114c3e98fd710f6619..6f4a5b971e1cbfd57785c724c77dc014eb627486 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class MaterializedPermissionView < ActiveRecord::Migration
+class MaterializedPermissionView < ActiveRecord::Migration[4.2]
 
   @@idxtables = [:collections, :container_requests, :groups, :jobs, :links, :pipeline_instances, :pipeline_templates, :repositories, :users, :virtual_machines, :workflows, :logs]
 
index aa42423a4dbd7ab9dc2d39ad13ca93e14dba485f..a41e0693f689b9b7761744b3170fe9f6ed4ece2a 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddIndexToContainers < ActiveRecord::Migration
+class AddIndexToContainers < ActiveRecord::Migration[4.2]
   def up
     ActiveRecord::Base.connection.execute("CREATE INDEX index_containers_on_modified_at_uuid ON containers USING btree (modified_at desc, uuid asc)")
     ActiveRecord::Base.connection.execute("CREATE INDEX index_container_requests_on_container_uuid on container_requests (container_uuid)")
index c9e50a64b79e56a64b1d90cfaee7be2c2dbf8900..d071c32f08ff2031fe9824daf9a6114fe484564b 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class FixTrashFlagFollow < ActiveRecord::Migration
+class FixTrashFlagFollow < ActiveRecord::Migration[4.2]
   def change
     ActiveRecord::Base.connection.execute("DROP MATERIALIZED VIEW materialized_permission_view")
     ActiveRecord::Base.connection.execute(
index 0183ef6dc51dc50d81df2999fa8bdd01539f8c14..a68168cac869ae1a64c33b1fbf34fadb11ea09fd 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddGinIndexToCollectionProperties < ActiveRecord::Migration
+class AddGinIndexToCollectionProperties < ActiveRecord::Migration[4.2]
   def up
     ActiveRecord::Base.connection.execute("CREATE INDEX collection_index_on_properties ON collections USING gin (properties);")
   end
index 112c2ba89118ead683daa6bddccbe747cb2179a7..c730e8c9b87192f746733a6e15f4194eff45f4df 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddStorageClassesToCollections < ActiveRecord::Migration
+class AddStorageClassesToCollections < ActiveRecord::Migration[4.2]
   def up
     add_column :collections, :storage_classes_desired, :jsonb, :default => ["default"]
     add_column :collections, :storage_classes_confirmed, :jsonb, :default => []
index a161f633d8f9a7d5d9a2422650931bbb07c10fec..7ea71caf8491bb72ebddab36cb66afffae8891e5 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddSecretMountsToContainers < ActiveRecord::Migration
+class AddSecretMountsToContainers < ActiveRecord::Migration[4.2]
   def change
     add_column :container_requests, :secret_mounts, :jsonb, default: {}
     add_column :containers, :secret_mounts, :jsonb, default: {}
index 529126b299a701617ede80a1ba75fed1b05de280..5359ead349500326b25e7700ebb8f85d469fdae0 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class ChangeContainerPriorityBigint < ActiveRecord::Migration
+class ChangeContainerPriorityBigint < ActiveRecord::Migration[4.2]
   def change
     change_column :containers, :priority, :integer, limit: 8
   end
index 10b35a7aba03f5f5940e0309892567532819b1f2..1d2b92a7570a7b94abecd3edb103874403898015 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddRedirectToUserUuidToUsers < ActiveRecord::Migration
+class AddRedirectToUserUuidToUsers < ActiveRecord::Migration[4.2]
   def up
     add_column :users, :redirect_to_user_uuid, :string
     User.reset_column_information
index 79e777e0a61132808b56cb8eba1dc80e35e233fb..9911be4bf1807c971514949a741bee35aeacb15c 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddContainerAuthUuidIndex < ActiveRecord::Migration
+class AddContainerAuthUuidIndex < ActiveRecord::Migration[4.2]
   def change
     add_index :containers, :auth_uuid
   end
index 988227a622e918efa3b813e9612095c04ccf8bc2..490f65adb4195da3e0f6b7e35a0597123e6a13a3 100644 (file)
@@ -4,7 +4,7 @@
 
 require './db/migrate/20161213172944_full_text_search_indexes'
 
-class PropertiesToJsonb < ActiveRecord::Migration
+class PropertiesToJsonb < ActiveRecord::Migration[4.2]
 
   @@tables_columns = [["nodes", "properties"],
                       ["nodes", "info"],
index 12c6696c609da2bddda5cebe26407b58a7772404..4824a686c92bcd010ed3be0044708cf5b37dff59 100644 (file)
@@ -4,7 +4,7 @@
 
 require './db/migrate/20161213172944_full_text_search_indexes'
 
-class AddPropertiesToGroups < ActiveRecord::Migration
+class AddPropertiesToGroups < ActiveRecord::Migration[4.2]
   def up
     add_column :groups, :properties, :jsonb, default: {}
     ActiveRecord::Base.connection.execute("CREATE INDEX group_index_on_properties ON groups USING gin (properties);")
index 36b155cc2580e823429b2783b0c6542234c7eb0a..6597798b27848eff3a66decd1018da4d4f7052cf 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class IndexAllFilenames < ActiveRecord::Migration
+class IndexAllFilenames < ActiveRecord::Migration[4.2]
   def up
     ActiveRecord::Base.connection.execute 'ALTER TABLE collections ALTER COLUMN file_names TYPE text'
   end
index 8d1cdf39b3b9f96fea08abc05f119de7baf6700e..28bbf5f4872c180fb454e9add4ec493d614f9a0b 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddPdhAndTrashIndexToCollections < ActiveRecord::Migration
+class AddPdhAndTrashIndexToCollections < ActiveRecord::Migration[4.2]
   def change
     add_index :collections, [:portable_data_hash, :trash_at]
   end
index 94ca10061bb113205b933e627e11717d83845ab2..6d22618890d7ec50e2040004f80cefbebbba684c 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddLockIndexToContainers < ActiveRecord::Migration
+class AddLockIndexToContainers < ActiveRecord::Migration[4.2]
   def change
     # For the current code in sdk/go/dispatch:
     add_index :containers, [:locked_by_uuid, :priority]
index 3d757e4114adead081c83feaad5f743db4578731..afa1b62e2a8bf1f596954acc9e48281b56d81353 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class DropPdhIndexFromCollections < ActiveRecord::Migration
+class DropPdhIndexFromCollections < ActiveRecord::Migration[4.2]
   def change
     remove_index :collections, column: :portable_data_hash
   end
index 82b21635176b85092aa27f9b8b5baa37a53b6a04..e6e0597b7a64e5b8c780309ac7f093cd4919bda0 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddMd5IndexToContainers < ActiveRecord::Migration
+class AddMd5IndexToContainers < ActiveRecord::Migration[4.2]
   def up
     ActiveRecord::Base.connection.execute 'CREATE INDEX index_containers_on_reuse_columns on containers (md5(command), cwd, md5(environment), output_path, container_image, md5(mounts), secret_mounts_md5, md5(runtime_constraints))'
   end
index 7245108717ae6a9fbd94054608b18851d61dff06..3c807925073b08bfe95e33b579d89d5e05918850 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddQueueIndexToContainers < ActiveRecord::Migration
+class AddQueueIndexToContainers < ActiveRecord::Migration[4.2]
   def up
     ActiveRecord::Base.connection.execute 'CREATE INDEX index_containers_on_queued_state on containers (state, (priority > 0))'
   end
index 4c963e6fde6f38b9b5d832d955dc4f88491f97f0..66cdc4290710a98469684eaddd6d37f517e661aa 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddRuntimeStatusToContainers < ActiveRecord::Migration
+class AddRuntimeStatusToContainers < ActiveRecord::Migration[4.2]
   def change
     add_column :containers, :runtime_status, :jsonb, default: {}
     add_index :containers, :runtime_status, using: :gin
index a624dd9aff3d25c9479b250a90286660882f70bc..b5a8b7171830742c89b706cceaed858ff36e37a9 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddVersionInfoToCollections < ActiveRecord::Migration
+class AddVersionInfoToCollections < ActiveRecord::Migration[4.2]
   def change
     # Do changes in bulk to save time on huge tables
     change_table :collections, :bulk => true do |t|
index 12a08e07d29abf91be5fb8d15a297ac1d5b49559..4190f9ba8a4a5851e3249dd8ed8ebaf9b1683104 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class SetCurrentVersionUuidOnCollections < ActiveRecord::Migration
+class SetCurrentVersionUuidOnCollections < ActiveRecord::Migration[4.2]
   def up
     # Set the current version uuid as itself
     Collection.where(current_version_uuid: nil).update_all("current_version_uuid=uuid")
index b0eea9e7ae827c55e965daa19336a80b3d49d4bc..bdb51b891c7d567b24b2917861a2aca4ee1306cb 100644 (file)
@@ -4,7 +4,7 @@
 
 require './db/migrate/20161213172944_full_text_search_indexes'
 
-class ReplaceFullTextIndexes < ActiveRecord::Migration
+class ReplaceFullTextIndexes < ActiveRecord::Migration[4.2]
   def up
     FullTextSearchIndexes.new.up
   end
index e6860964bbf6836a8ecdda3d3f91a4b6383ac691..b321422143b9e7df21ed6c7cfb55a3193ba6ca80 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RecomputeFileNamesIndex < ActiveRecord::Migration
+class RecomputeFileNamesIndex < ActiveRecord::Migration[4.2]
   def do_batch(pdhs:)
     ActiveRecord::Base.connection.exec_query('BEGIN')
     Collection.select(:portable_data_hash, :manifest_text).where(portable_data_hash: pdhs).distinct(:portable_data_hash).each do |c|
index 640395618f894a5e5fed3d9c7b19279d758b6413..7b4558dbaaf27024d5317d0083b627a82bb61c38 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class RecreateCollectionUniqueNameIndex < ActiveRecord::Migration
+class RecreateCollectionUniqueNameIndex < ActiveRecord::Migration[4.2]
   def up
     Collection.transaction do
       remove_index(:collections,
index fbdc397fcff8cae4c2fb22fd72a35401f13c497a..4a18f09ea484143971900811fecfd41784ac5f67 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddPreserveVersionToCollections < ActiveRecord::Migration
+class AddPreserveVersionToCollections < ActiveRecord::Migration[4.2]
   def change
     add_column :collections, :preserve_version, :boolean, default: false
   end
index 63e99191a966de18f58120626ef42fb24e03f278..25ddfec0783726c0c9ef6203c30eff78c57ea364 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class AddCurrentVersionUuidToCollectionSearchIndex < ActiveRecord::Migration
+class AddCurrentVersionUuidToCollectionSearchIndex < ActiveRecord::Migration[4.2]
   disable_ddl_transaction!
 
   def up
index 07151cd88508780024a6e5266af541a713e52261..630b9f24ee852574e314eb1c6397b2fec2a09764 100644 (file)
@@ -1,4 +1,8 @@
-class AddContainerRuntimeToken < ActiveRecord::Migration
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class AddContainerRuntimeToken < ActiveRecord::Migration[4.2]
   def change
     add_column :container_requests, :runtime_token, :text, :null => true
     add_column :containers, :runtime_user_uuid, :text, :null => true
index 09201f5146ccccb6b20f3f43f4b3a2680faba140..d48df6173c5ab648a6d11f311e6ece4684567a91 100644 (file)
@@ -1,4 +1,8 @@
-class AddRuntimeTokenToContainer < ActiveRecord::Migration
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class AddRuntimeTokenToContainer < ActiveRecord::Migration[4.2]
   def change
     add_column :containers, :runtime_token, :text, :null => true
   end
index 2fdf830b2ad4b3acd22bf425f0b620e5cea68d89..94aab8bdf5a088a6b78c47a00b68d647fd7aa0a4 100644 (file)
@@ -1,4 +1,8 @@
-class AddExpressionIndexToLinks < ActiveRecord::Migration
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class AddExpressionIndexToLinks < ActiveRecord::Migration[4.2]
   def up
     ActiveRecord::Base.connection.execute 'CREATE INDEX index_links_on_substring_head_uuid on links (substring(head_uuid, 7, 5))'
     ActiveRecord::Base.connection.execute 'CREATE INDEX index_links_on_substring_tail_uuid on links (substring(tail_uuid, 7, 5))'
index a496eb0d1c99f1c66789da22742abe5fec39efe0..34f70dabafb21314108c720a8c429ebf96627a0b 100644 (file)
@@ -1,4 +1,8 @@
-class AddContainerLockCount < ActiveRecord::Migration
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class AddContainerLockCount < ActiveRecord::Migration[4.2]
   def change
     add_column :containers, :lock_count, :int, :null => false, :default => 0
   end
diff --git a/services/api/db/migrate/20190322174136_add_file_info_to_collection.rb b/services/api/db/migrate/20190322174136_add_file_info_to_collection.rb
new file mode 100755 (executable)
index 0000000..61f9b2d
--- /dev/null
@@ -0,0 +1,63 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+require "arvados/keep"
+require "group_pdhs"
+
+class AddFileInfoToCollection < ActiveRecord::Migration[4.2]
+  def do_batch(pdhs)
+    pdhs_str = ''
+    pdhs.each do |pdh|
+      pdhs_str << "'" << pdh << "'" << ","
+    end
+
+    collections = ActiveRecord::Base.connection.exec_query(
+      "SELECT DISTINCT portable_data_hash, manifest_text FROM collections "\
+      "WHERE portable_data_hash IN (#{pdhs_str[0..-2]}) "
+    )
+
+    collections.rows.each do |row|
+      manifest = Keep::Manifest.new(row[1])
+      ActiveRecord::Base.connection.exec_query("BEGIN")
+      ActiveRecord::Base.connection.exec_query("UPDATE collections SET file_count=#{manifest.files_count}, "\
+                                               "file_size_total=#{manifest.files_size} "\
+                                               "WHERE portable_data_hash='#{row[0]}'")
+      ActiveRecord::Base.connection.exec_query("COMMIT")
+    end
+  end
+
+  def up
+    add_column :collections, :file_count, :integer, default: 0, null: false
+    add_column :collections, :file_size_total, :integer, limit: 8, default: 0, null: false
+
+    distinct_pdh_count = ActiveRecord::Base.connection.exec_query(
+      "SELECT DISTINCT portable_data_hash FROM collections"
+    ).rows.count
+
+    # Generator that queries for all the distinct pdhs greater than last_pdh
+    ordered_pdh_query = lambda { |last_pdh, &block|
+      pdhs = ActiveRecord::Base.connection.exec_query(
+        "SELECT DISTINCT portable_data_hash FROM collections "\
+        "WHERE portable_data_hash > '#{last_pdh}' "\
+        "ORDER BY portable_data_hash LIMIT 1000"
+      )
+      pdhs.rows.each do |row|
+        block.call(row[0])
+      end
+    }
+
+    batch_size_max = 1 << 28 # 256 MiB
+    GroupPdhs.group_pdhs_for_multiple_transactions(ordered_pdh_query,
+                                                   distinct_pdh_count,
+                                                   batch_size_max,
+                                                   "AddFileInfoToCollection") do |pdhs|
+      do_batch(pdhs)
+    end
+  end
+
+  def down
+    remove_column :collections, :file_count
+    remove_column :collections, :file_size_total
+  end
+end
index f766f33e1b35e1f85a64aa2c5d87bf85e2bb6d0f..ebe06b34843aec8be5427e624e21db2653aef337 100644 (file)
@@ -105,6 +105,18 @@ CREATE SEQUENCE public.api_clients_id_seq
 ALTER SEQUENCE public.api_clients_id_seq OWNED BY public.api_clients.id;
 
 
+--
+-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.ar_internal_metadata (
+    key character varying NOT NULL,
+    value character varying,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
 --
 -- Name: authorized_keys; Type: TABLE; Schema: public; Owner: -
 --
@@ -175,7 +187,9 @@ CREATE TABLE public.collections (
     storage_classes_confirmed_at timestamp without time zone,
     current_version_uuid character varying,
     version integer DEFAULT 1 NOT NULL,
-    preserve_version boolean DEFAULT false
+    preserve_version boolean DEFAULT false,
+    file_count integer DEFAULT 0 NOT NULL,
+    file_size_total bigint DEFAULT 0 NOT NULL
 );
 
 
@@ -1408,6 +1422,14 @@ ALTER TABLE ONLY public.api_clients
     ADD CONSTRAINT api_clients_pkey PRIMARY KEY (id);
 
 
+--
+-- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.ar_internal_metadata
+    ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
+
+
 --
 -- Name: authorized_keys authorized_keys_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
@@ -2852,371 +2874,190 @@ CREATE INDEX workflows_search_idx ON public.workflows USING btree (uuid, owner_u
 
 SET search_path TO "$user", public;
 
-INSERT INTO schema_migrations (version) VALUES ('20121016005009');
-
-INSERT INTO schema_migrations (version) VALUES ('20130105203021');
-
-INSERT INTO schema_migrations (version) VALUES ('20130105224358');
-
-INSERT INTO schema_migrations (version) VALUES ('20130105224618');
-
-INSERT INTO schema_migrations (version) VALUES ('20130107181109');
-
-INSERT INTO schema_migrations (version) VALUES ('20130107212832');
-
-INSERT INTO schema_migrations (version) VALUES ('20130109175700');
-
-INSERT INTO schema_migrations (version) VALUES ('20130109220548');
-
-INSERT INTO schema_migrations (version) VALUES ('20130113214204');
-
-INSERT INTO schema_migrations (version) VALUES ('20130116024233');
-
-INSERT INTO schema_migrations (version) VALUES ('20130116215213');
-
-INSERT INTO schema_migrations (version) VALUES ('20130118002239');
-
-INSERT INTO schema_migrations (version) VALUES ('20130122020042');
-
-INSERT INTO schema_migrations (version) VALUES ('20130122201442');
-
-INSERT INTO schema_migrations (version) VALUES ('20130122221616');
-
-INSERT INTO schema_migrations (version) VALUES ('20130123174514');
-
-INSERT INTO schema_migrations (version) VALUES ('20130123180224');
-
-INSERT INTO schema_migrations (version) VALUES ('20130123180228');
-
-INSERT INTO schema_migrations (version) VALUES ('20130125220425');
-
-INSERT INTO schema_migrations (version) VALUES ('20130128202518');
-
-INSERT INTO schema_migrations (version) VALUES ('20130128231343');
-
-INSERT INTO schema_migrations (version) VALUES ('20130130205749');
-
-INSERT INTO schema_migrations (version) VALUES ('20130203104818');
-
-INSERT INTO schema_migrations (version) VALUES ('20130203104824');
-
-INSERT INTO schema_migrations (version) VALUES ('20130203115329');
-
-INSERT INTO schema_migrations (version) VALUES ('20130207195855');
-
-INSERT INTO schema_migrations (version) VALUES ('20130218181504');
-
-INSERT INTO schema_migrations (version) VALUES ('20130226170000');
-
-INSERT INTO schema_migrations (version) VALUES ('20130313175417');
-
-INSERT INTO schema_migrations (version) VALUES ('20130315155820');
-
-INSERT INTO schema_migrations (version) VALUES ('20130315183626');
-
-INSERT INTO schema_migrations (version) VALUES ('20130315213205');
-
-INSERT INTO schema_migrations (version) VALUES ('20130318002138');
-
-INSERT INTO schema_migrations (version) VALUES ('20130319165853');
-
-INSERT INTO schema_migrations (version) VALUES ('20130319180730');
-
-INSERT INTO schema_migrations (version) VALUES ('20130319194637');
-
-INSERT INTO schema_migrations (version) VALUES ('20130319201431');
-
-INSERT INTO schema_migrations (version) VALUES ('20130319235957');
-
-INSERT INTO schema_migrations (version) VALUES ('20130320000107');
-
-INSERT INTO schema_migrations (version) VALUES ('20130326173804');
-
-INSERT INTO schema_migrations (version) VALUES ('20130326182917');
-
-INSERT INTO schema_migrations (version) VALUES ('20130415020241');
-
-INSERT INTO schema_migrations (version) VALUES ('20130425024459');
-
-INSERT INTO schema_migrations (version) VALUES ('20130425214427');
-
-INSERT INTO schema_migrations (version) VALUES ('20130523060112');
-
-INSERT INTO schema_migrations (version) VALUES ('20130523060213');
-
-INSERT INTO schema_migrations (version) VALUES ('20130524042319');
-
-INSERT INTO schema_migrations (version) VALUES ('20130528134100');
-
-INSERT INTO schema_migrations (version) VALUES ('20130606183519');
-
-INSERT INTO schema_migrations (version) VALUES ('20130608053730');
-
-INSERT INTO schema_migrations (version) VALUES ('20130610202538');
-
-INSERT INTO schema_migrations (version) VALUES ('20130611163736');
-
-INSERT INTO schema_migrations (version) VALUES ('20130612042554');
-
-INSERT INTO schema_migrations (version) VALUES ('20130617150007');
-
-INSERT INTO schema_migrations (version) VALUES ('20130626002829');
-
-INSERT INTO schema_migrations (version) VALUES ('20130626022810');
-
-INSERT INTO schema_migrations (version) VALUES ('20130627154537');
-
-INSERT INTO schema_migrations (version) VALUES ('20130627184333');
-
-INSERT INTO schema_migrations (version) VALUES ('20130708163414');
-
-INSERT INTO schema_migrations (version) VALUES ('20130708182912');
-
-INSERT INTO schema_migrations (version) VALUES ('20130708185153');
-
-INSERT INTO schema_migrations (version) VALUES ('20130724153034');
-
-INSERT INTO schema_migrations (version) VALUES ('20131007180607');
-
-INSERT INTO schema_migrations (version) VALUES ('20140117231056');
-
-INSERT INTO schema_migrations (version) VALUES ('20140124222114');
-
-INSERT INTO schema_migrations (version) VALUES ('20140129184311');
-
-INSERT INTO schema_migrations (version) VALUES ('20140317135600');
-
-INSERT INTO schema_migrations (version) VALUES ('20140319160547');
-
-INSERT INTO schema_migrations (version) VALUES ('20140321191343');
-
-INSERT INTO schema_migrations (version) VALUES ('20140324024606');
-
-INSERT INTO schema_migrations (version) VALUES ('20140325175653');
-
-INSERT INTO schema_migrations (version) VALUES ('20140402001908');
-
-INSERT INTO schema_migrations (version) VALUES ('20140407184311');
-
-INSERT INTO schema_migrations (version) VALUES ('20140421140924');
-
-INSERT INTO schema_migrations (version) VALUES ('20140421151939');
-
-INSERT INTO schema_migrations (version) VALUES ('20140421151940');
-
-INSERT INTO schema_migrations (version) VALUES ('20140422011506');
-
-INSERT INTO schema_migrations (version) VALUES ('20140423132913');
-
-INSERT INTO schema_migrations (version) VALUES ('20140423133559');
-
-INSERT INTO schema_migrations (version) VALUES ('20140501165548');
-
-INSERT INTO schema_migrations (version) VALUES ('20140519205916');
-
-INSERT INTO schema_migrations (version) VALUES ('20140527152921');
-
-INSERT INTO schema_migrations (version) VALUES ('20140530200539');
-
-INSERT INTO schema_migrations (version) VALUES ('20140601022548');
-
-INSERT INTO schema_migrations (version) VALUES ('20140602143352');
-
-INSERT INTO schema_migrations (version) VALUES ('20140607150616');
-
-INSERT INTO schema_migrations (version) VALUES ('20140611173003');
-
-INSERT INTO schema_migrations (version) VALUES ('20140627210837');
-
-INSERT INTO schema_migrations (version) VALUES ('20140709172343');
-
-INSERT INTO schema_migrations (version) VALUES ('20140714184006');
-
-INSERT INTO schema_migrations (version) VALUES ('20140811184643');
-
-INSERT INTO schema_migrations (version) VALUES ('20140817035914');
-
-INSERT INTO schema_migrations (version) VALUES ('20140818125735');
-
-INSERT INTO schema_migrations (version) VALUES ('20140826180337');
-
-INSERT INTO schema_migrations (version) VALUES ('20140828141043');
-
-INSERT INTO schema_migrations (version) VALUES ('20140909183946');
-
-INSERT INTO schema_migrations (version) VALUES ('20140911221252');
-
-INSERT INTO schema_migrations (version) VALUES ('20140918141529');
-
-INSERT INTO schema_migrations (version) VALUES ('20140918153541');
-
-INSERT INTO schema_migrations (version) VALUES ('20140918153705');
-
-INSERT INTO schema_migrations (version) VALUES ('20140924091559');
-
-INSERT INTO schema_migrations (version) VALUES ('20141111133038');
-
-INSERT INTO schema_migrations (version) VALUES ('20141208164553');
-
-INSERT INTO schema_migrations (version) VALUES ('20141208174553');
-
-INSERT INTO schema_migrations (version) VALUES ('20141208174653');
-
-INSERT INTO schema_migrations (version) VALUES ('20141208185217');
-
-INSERT INTO schema_migrations (version) VALUES ('20150122175935');
-
-INSERT INTO schema_migrations (version) VALUES ('20150123142953');
-
-INSERT INTO schema_migrations (version) VALUES ('20150203180223');
-
-INSERT INTO schema_migrations (version) VALUES ('20150206210804');
-
-INSERT INTO schema_migrations (version) VALUES ('20150206230342');
-
-INSERT INTO schema_migrations (version) VALUES ('20150216193428');
-
-INSERT INTO schema_migrations (version) VALUES ('20150303210106');
-
-INSERT INTO schema_migrations (version) VALUES ('20150312151136');
-
-INSERT INTO schema_migrations (version) VALUES ('20150317132720');
-
-INSERT INTO schema_migrations (version) VALUES ('20150324152204');
-
-INSERT INTO schema_migrations (version) VALUES ('20150423145759');
-
-INSERT INTO schema_migrations (version) VALUES ('20150512193020');
-
-INSERT INTO schema_migrations (version) VALUES ('20150526180251');
-
-INSERT INTO schema_migrations (version) VALUES ('20151202151426');
-
-INSERT INTO schema_migrations (version) VALUES ('20151215134304');
-
-INSERT INTO schema_migrations (version) VALUES ('20151229214707');
-
-INSERT INTO schema_migrations (version) VALUES ('20160208210629');
-
-INSERT INTO schema_migrations (version) VALUES ('20160209155729');
-
-INSERT INTO schema_migrations (version) VALUES ('20160324144017');
-
-INSERT INTO schema_migrations (version) VALUES ('20160506175108');
-
-INSERT INTO schema_migrations (version) VALUES ('20160509143250');
-
-INSERT INTO schema_migrations (version) VALUES ('20160808151559');
-
-INSERT INTO schema_migrations (version) VALUES ('20160819195557');
-
-INSERT INTO schema_migrations (version) VALUES ('20160819195725');
-
-INSERT INTO schema_migrations (version) VALUES ('20160901210110');
-
-INSERT INTO schema_migrations (version) VALUES ('20160909181442');
-
-INSERT INTO schema_migrations (version) VALUES ('20160926194129');
-
-INSERT INTO schema_migrations (version) VALUES ('20161019171346');
-
-INSERT INTO schema_migrations (version) VALUES ('20161111143147');
-
-INSERT INTO schema_migrations (version) VALUES ('20161115171221');
-
-INSERT INTO schema_migrations (version) VALUES ('20161115174218');
-
-INSERT INTO schema_migrations (version) VALUES ('20161213172944');
-
-INSERT INTO schema_migrations (version) VALUES ('20161222153434');
-
-INSERT INTO schema_migrations (version) VALUES ('20161223090712');
-
-INSERT INTO schema_migrations (version) VALUES ('20170102153111');
-
-INSERT INTO schema_migrations (version) VALUES ('20170105160301');
-
-INSERT INTO schema_migrations (version) VALUES ('20170105160302');
-
-INSERT INTO schema_migrations (version) VALUES ('20170216170823');
-
-INSERT INTO schema_migrations (version) VALUES ('20170301225558');
-
-INSERT INTO schema_migrations (version) VALUES ('20170319063406');
-
-INSERT INTO schema_migrations (version) VALUES ('20170328215436');
-
-INSERT INTO schema_migrations (version) VALUES ('20170330012505');
-
-INSERT INTO schema_migrations (version) VALUES ('20170419173031');
-
-INSERT INTO schema_migrations (version) VALUES ('20170419173712');
-
-INSERT INTO schema_migrations (version) VALUES ('20170419175801');
-
-INSERT INTO schema_migrations (version) VALUES ('20170628185847');
-
-INSERT INTO schema_migrations (version) VALUES ('20170704160233');
-
-INSERT INTO schema_migrations (version) VALUES ('20170706141334');
-
-INSERT INTO schema_migrations (version) VALUES ('20170824202826');
-
-INSERT INTO schema_migrations (version) VALUES ('20170906224040');
-
-INSERT INTO schema_migrations (version) VALUES ('20171027183824');
-
-INSERT INTO schema_migrations (version) VALUES ('20171208203841');
-
-INSERT INTO schema_migrations (version) VALUES ('20171212153352');
-
-INSERT INTO schema_migrations (version) VALUES ('20180216203422');
-
-INSERT INTO schema_migrations (version) VALUES ('20180228220311');
-
-INSERT INTO schema_migrations (version) VALUES ('20180313180114');
-
-INSERT INTO schema_migrations (version) VALUES ('20180501182859');
-
-INSERT INTO schema_migrations (version) VALUES ('20180514135529');
-
-INSERT INTO schema_migrations (version) VALUES ('20180607175050');
-
-INSERT INTO schema_migrations (version) VALUES ('20180608123145');
-
-INSERT INTO schema_migrations (version) VALUES ('20180806133039');
-
-INSERT INTO schema_migrations (version) VALUES ('20180820130357');
-
-INSERT INTO schema_migrations (version) VALUES ('20180820132617');
-
-INSERT INTO schema_migrations (version) VALUES ('20180820135808');
-
-INSERT INTO schema_migrations (version) VALUES ('20180824152014');
-
-INSERT INTO schema_migrations (version) VALUES ('20180824155207');
-
-INSERT INTO schema_migrations (version) VALUES ('20180904110712');
-
-INSERT INTO schema_migrations (version) VALUES ('20180913175443');
-
-INSERT INTO schema_migrations (version) VALUES ('20180915155335');
-
-INSERT INTO schema_migrations (version) VALUES ('20180917200000');
-
-INSERT INTO schema_migrations (version) VALUES ('20180917205609');
-
-INSERT INTO schema_migrations (version) VALUES ('20180919001158');
-
-INSERT INTO schema_migrations (version) VALUES ('20181001175023');
-
-INSERT INTO schema_migrations (version) VALUES ('20181004131141');
-
-INSERT INTO schema_migrations (version) VALUES ('20181005192222');
-
-INSERT INTO schema_migrations (version) VALUES ('20181011184200');
-
-INSERT INTO schema_migrations (version) VALUES ('20181213183234');
-
-INSERT INTO schema_migrations (version) VALUES ('20190214214814');
+INSERT INTO "schema_migrations" (version) VALUES
+('20121016005009'),
+('20130105203021'),
+('20130105224358'),
+('20130105224618'),
+('20130107181109'),
+('20130107212832'),
+('20130109175700'),
+('20130109220548'),
+('20130113214204'),
+('20130116024233'),
+('20130116215213'),
+('20130118002239'),
+('20130122020042'),
+('20130122201442'),
+('20130122221616'),
+('20130123174514'),
+('20130123180224'),
+('20130123180228'),
+('20130125220425'),
+('20130128202518'),
+('20130128231343'),
+('20130130205749'),
+('20130203104818'),
+('20130203104824'),
+('20130203115329'),
+('20130207195855'),
+('20130218181504'),
+('20130226170000'),
+('20130313175417'),
+('20130315155820'),
+('20130315183626'),
+('20130315213205'),
+('20130318002138'),
+('20130319165853'),
+('20130319180730'),
+('20130319194637'),
+('20130319201431'),
+('20130319235957'),
+('20130320000107'),
+('20130326173804'),
+('20130326182917'),
+('20130415020241'),
+('20130425024459'),
+('20130425214427'),
+('20130523060112'),
+('20130523060213'),
+('20130524042319'),
+('20130528134100'),
+('20130606183519'),
+('20130608053730'),
+('20130610202538'),
+('20130611163736'),
+('20130612042554'),
+('20130617150007'),
+('20130626002829'),
+('20130626022810'),
+('20130627154537'),
+('20130627184333'),
+('20130708163414'),
+('20130708182912'),
+('20130708185153'),
+('20130724153034'),
+('20131007180607'),
+('20140117231056'),
+('20140124222114'),
+('20140129184311'),
+('20140317135600'),
+('20140319160547'),
+('20140321191343'),
+('20140324024606'),
+('20140325175653'),
+('20140402001908'),
+('20140407184311'),
+('20140421140924'),
+('20140421151939'),
+('20140421151940'),
+('20140422011506'),
+('20140423132913'),
+('20140423133559'),
+('20140501165548'),
+('20140519205916'),
+('20140527152921'),
+('20140530200539'),
+('20140601022548'),
+('20140602143352'),
+('20140607150616'),
+('20140611173003'),
+('20140627210837'),
+('20140709172343'),
+('20140714184006'),
+('20140811184643'),
+('20140817035914'),
+('20140818125735'),
+('20140826180337'),
+('20140828141043'),
+('20140909183946'),
+('20140911221252'),
+('20140918141529'),
+('20140918153541'),
+('20140918153705'),
+('20140924091559'),
+('20141111133038'),
+('20141208164553'),
+('20141208174553'),
+('20141208174653'),
+('20141208185217'),
+('20150122175935'),
+('20150123142953'),
+('20150203180223'),
+('20150206210804'),
+('20150206230342'),
+('20150216193428'),
+('20150303210106'),
+('20150312151136'),
+('20150317132720'),
+('20150324152204'),
+('20150423145759'),
+('20150512193020'),
+('20150526180251'),
+('20151202151426'),
+('20151215134304'),
+('20151229214707'),
+('20160208210629'),
+('20160209155729'),
+('20160324144017'),
+('20160506175108'),
+('20160509143250'),
+('20160808151559'),
+('20160819195557'),
+('20160819195725'),
+('20160901210110'),
+('20160909181442'),
+('20160926194129'),
+('20161019171346'),
+('20161111143147'),
+('20161115171221'),
+('20161115174218'),
+('20161213172944'),
+('20161222153434'),
+('20161223090712'),
+('20170102153111'),
+('20170105160301'),
+('20170105160302'),
+('20170216170823'),
+('20170301225558'),
+('20170319063406'),
+('20170328215436'),
+('20170330012505'),
+('20170419173031'),
+('20170419173712'),
+('20170419175801'),
+('20170628185847'),
+('20170704160233'),
+('20170706141334'),
+('20170824202826'),
+('20170906224040'),
+('20171027183824'),
+('20171208203841'),
+('20171212153352'),
+('20180216203422'),
+('20180228220311'),
+('20180313180114'),
+('20180501182859'),
+('20180514135529'),
+('20180607175050'),
+('20180608123145'),
+('20180806133039'),
+('20180820130357'),
+('20180820132617'),
+('20180820135808'),
+('20180824152014'),
+('20180824155207'),
+('20180904110712'),
+('20180913175443'),
+('20180915155335'),
+('20180917200000'),
+('20180917205609'),
+('20180919001158'),
+('20181001175023'),
+('20181004131141'),
+('20181005192222'),
+('20181011184200'),
+('20181213183234'),
+('20190214214814'),
+('20190322174136');
 
index 1a990e14ea09fa67d6682c9f5baf7b776a0a5c11..a970383b8714653e9621def26a404cc7e10bf48b 100644 (file)
@@ -16,6 +16,7 @@ module CanBeAnOwner
       next if t == base.table_name
       next if t == 'schema_migrations'
       next if t == 'permission_refresh_lock'
+      next if t == 'ar_internal_metadata'
       klass = t.classify.constantize
       next unless klass and 'owner_uuid'.in?(klass.columns.collect(&:name))
       base.has_many(t.to_sym,
index d99edd8018881cbc4406360fe7f460ef6e19490c..63543ab3ad52cef568a464d9c68fba9ee4e177a5 100644 (file)
@@ -33,7 +33,7 @@ Disable_jobs_api_method_list = ["jobs.create",
 def check_enable_legacy_jobs_api
   if Rails.configuration.enable_legacy_jobs_api == false ||
      (Rails.configuration.enable_legacy_jobs_api == "auto" &&
-      ActiveRecord::Base.connection.exec_query("select count(*) from jobs").first["count"] == "0")
-    Rails.configuration.disable_api_methods = Disable_jobs_api_method_list
+      Job.count == 0)
+    Rails.configuration.disable_api_methods += Disable_jobs_api_method_list
   end
 end
diff --git a/services/api/lib/group_pdhs.rb b/services/api/lib/group_pdhs.rb
new file mode 100644 (file)
index 0000000..0630ef8
--- /dev/null
@@ -0,0 +1,39 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+module GroupPdhs
+  # NOTE: Migration 20190322174136_add_file_info_to_collection.rb relies on this function.
+  #
+  # Change with caution!
+  #
+  # Correctly groups pdhs to use for batch database updates. Helps avoid
+  # updating too many database rows in a single transaction.
+  def self.group_pdhs_for_multiple_transactions(distinct_ordered_pdhs, distinct_pdh_count, batch_size_max, log_prefix)
+    batch_size = 0
+    batch_pdhs = {}
+    last_pdh = '0'
+    done = 0
+    any = true
+
+    while any
+      any = false
+      distinct_ordered_pdhs.call(last_pdh) do |pdh|
+        any = true
+        last_pdh = pdh
+        manifest_size = pdh.split('+')[1].to_i
+        if batch_size > 0 && batch_size + manifest_size > batch_size_max
+          yield batch_pdhs.keys
+          done += batch_pdhs.size
+          Rails.logger.info(log_prefix + ": #{done}/#{distinct_pdh_count}")
+          batch_pdhs = {}
+          batch_size = 0
+        end
+        batch_pdhs[pdh] = true
+        batch_size += manifest_size
+      end
+    end
+    yield batch_pdhs.keys
+    Rails.logger.info(log_prefix + ": finished")
+  end
+end
index dc8bdcb6c5ab126cbc9e2a758173c37c8faae7d9..60db53d5e687440f4297b0ea29fc5893e52cf68c 100644 (file)
@@ -79,8 +79,8 @@ module HasUuid
 
   def destroy_permission_links
     if uuid
-      Link.destroy_all(['link_class=? and (head_uuid=? or tail_uuid=?)',
-                        'permission', uuid, uuid])
+      Link.where(['link_class=? and (head_uuid=? or tail_uuid=?)',
+                  'permission', uuid, uuid]).destroy_all
     end
   end
 end
index e7cb21fc77e579dd75bd89543477425f0af1746b..736f270e962700c79c573fed841f5c0bde98b8ff 100644 (file)
@@ -17,7 +17,7 @@ module LoadParam
   def load_where_param
     if params[:where].nil? or params[:where] == ""
       @where = {}
-    elsif params[:where].is_a? Hash
+    elsif [Hash, ActionController::Parameters].include? params[:where].class
       @where = params[:where]
     elsif params[:where].is_a? String
       begin
@@ -151,7 +151,7 @@ module LoadParam
     when String
       begin
         @select = SafeJSON.load(params[:select])
-        raise unless @select.is_a? Array or @select.nil?
+        raise unless @select.is_a? Array or @select.nil? or !@select
       rescue
         raise ArgumentError.new("Could not parse \"select\" param as an array")
       end
index a24b58d3ec569749488f9d0aef9bbacb1d04186b..e52bfc075d89ad20d24a2722901ee4df1a36c00b 100755 (executable)
@@ -3,9 +3,9 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-require 'trollop'
+require 'optimist'
 
-opts = Trollop::options do
+opts = Optimist::options do
   banner 'Fail jobs that have state=="Running".'
   banner 'Options:'
   opt(:before,
index 93c8318f0e53013e3a2e192466094d0905173baf..4bb91e244635d7c6e10dcdff32b72264141ff9de 100755 (executable)
@@ -7,9 +7,9 @@
 # If get option is used, an existing anonymous user token is returned. If none exist, one is created.
 # If the get option is omitted, a new token is created and returned.
 
-require 'trollop'
+require 'optimist'
 
-opts = Trollop::options do
+opts = Optimist::options do
   banner ''
   banner "Usage: get_anonymous_user_token "
   banner ''
index 75b02e5767f78b0ffa3990c8aa6bb602d8560997..c5f798bd2176c8b6038f71b48a3ece49244dd864 100755 (executable)
 #   Append to src_collection.name: " (reason; salvaged data at new_collection.uuid)"
 #   Set portable_data_hash to "d41d8cd98f00b204e9800998ecf8427e+0"
 
-require 'trollop'
+require 'optimist'
 require './lib/salvage_collection'
 include SalvageCollection
 
-opts = Trollop::options do
+opts = Optimist::options do
   banner ''
   banner "Usage: salvage_collection.rb " +
     "{uuid} {reason}"
index 9f0219ec843d81b35f7a6ba53412e150426f8a5f..1e033667dcbc4b78646065b35648c684973ce3eb 100755 (executable)
@@ -6,12 +6,12 @@
 abort 'Error: Ruby >= 1.9.3 required.' if RUBY_VERSION < '1.9.3'
 
 require 'logger'
-require 'trollop'
+require 'optimist'
 
 log = Logger.new STDERR
 log.progname = $0.split('/').last
 
-opts = Trollop::options do
+opts = Optimist::options do
   banner ''
   banner "Usage: #{log.progname} " +
     "{user_uuid_or_email} {user_and_repo_name} {vm_uuid}"
@@ -32,7 +32,7 @@ end
 log.level = (ENV['DEBUG'] || opts.debug) ? Logger::DEBUG : Logger::WARN
 
 if ARGV.count != 3
-  Trollop::die "required arguments are missing"
+  Optimist::die "required arguments are missing"
 end
 
 user_arg, user_repo_name, vm_uuid = ARGV
index 8763f3944471e9a5cad4f4565da2833f988bbdf8..c84e479e48fbe6118a1297a903013addf68e928e 100644 (file)
@@ -29,6 +29,22 @@ collection_owned_by_active:
   name: owned_by_active
   version: 2
 
+collection_owned_by_active_with_file_stats:
+  uuid: zzzzz-4zz18-fjeod4od92kfj5f
+  current_version_uuid: zzzzz-4zz18-fjeod4od92kfj5f
+  portable_data_hash: fa7aeb5140e2848d39b416daeef4ffc5+45
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  created_at: 2014-02-03T17:22:54Z
+  modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+  modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
+  modified_at: 2014-02-03T17:22:54Z
+  updated_at: 2014-02-03T17:22:54Z
+  manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+  file_count: 1
+  file_size_total: 3
+  name: owned_by_active_with_file_stats
+  version: 2
+
 collection_owned_by_active_past_version_1:
   uuid: zzzzz-4zz18-znfnqtbbv4spast
   current_version_uuid: zzzzz-4zz18-bv31uwvy3neko21
index 971132ffe34eb1315cd5fc25303d652f26a3ed68..821a6b5e4221d50edfc5b8de871e7ee31657a070 100644 (file)
@@ -12,6 +12,7 @@ busy:
   last_ping_at: <%= 1.minute.ago.to_s(:db) %>
   first_ping_at: <%= 23.hour.ago.to_s(:db) %>
   job_uuid: zzzzz-8i9sb-2gx6rz0pjl033w3  # nearly_finished_job
+  properties: {}
   info:
     ping_secret: "48dpm3b8ijyj3jkr2yczxw0844dqd2752bhll7klodvgz9bg80"
     slurm_state: "alloc"
@@ -26,6 +27,7 @@ down:
   last_ping_at: <%= 1.hour.ago.to_s(:db) %>
   first_ping_at: <%= 23.hour.ago.to_s(:db) %>
   job_uuid: ~
+  properties: {}
   info:
     ping_secret: "2k3i71depad36ugwmlgzilbi4e8n0illb2r8l4efg9mzkb3a1k"
 
@@ -70,6 +72,7 @@ new_with_no_hostname:
   last_ping_at: ~
   first_ping_at: ~
   job_uuid: ~
+  properties: {}
   info:
     ping_secret: "abcdyi0x4lb5q4gzqqtrnq30oyj08r8dtdimmanbqw49z1anz2"
 
@@ -82,6 +85,7 @@ new_with_custom_hostname:
   last_ping_at: ~
   first_ping_at: ~
   job_uuid: ~
+  properties: {}
   info:
     ping_secret: "abcdyi0x4lb5q4gzqqtrnq30oyj08r8dtdimmanbqw49z1anz2"
 
@@ -93,5 +97,6 @@ node_with_no_ip_address_yet:
   last_ping_at: ~
   first_ping_at: ~
   job_uuid: ~
+  properties: {}
   info:
     ping_secret: "abcdyefg4lb5q4gzqqtrnq30oyj08r8dtdimmanbqw49z1anz2"
index 27b046e3c2dd2c6947123cbf3bb48321eed7c5c2..b5f71acb536aa9bdd2bbf1ba67bbd6aba55560af 100644 (file)
@@ -34,19 +34,19 @@ class ApplicationControllerTest < ActionController::TestCase
 
   test "requesting nonexistent object returns 404 error" do
     authorize_with :admin
-    get(:show, id: BAD_UUID)
+    get(:show, params: {id: BAD_UUID})
     check_404
   end
 
   test "requesting object without read permission returns 404 error" do
     authorize_with :spectator
-    get(:show, id: specimens(:owned_by_active_user).uuid)
+    get(:show, params: {id: specimens(:owned_by_active_user).uuid})
     check_404
   end
 
   test "submitting bad object returns error" do
     authorize_with :spectator
-    post(:create, specimen: {badattr: "badvalue"})
+    post(:create, params: {specimen: {badattr: "badvalue"}})
     assert_response 422
     check_error_token
   end
@@ -77,7 +77,7 @@ class ApplicationControllerTest < ActionController::TestCase
     test "bogus boolean parameter #{bogus.inspect} returns error" do
       @controller = Arvados::V1::GroupsController.new
       authorize_with :active
-      post :create, {
+      post :create, params: {
         group: {},
         ensure_unique_name: bogus
       }
@@ -94,7 +94,7 @@ class ApplicationControllerTest < ActionController::TestCase
       test "boolean parameter #{boolparam.inspect} acceptable" do
         @controller = Arvados::V1::GroupsController.new
         authorize_with :active
-        post :create, {
+        post :create, params: {
           group: {},
           ensure_unique_name: boolparam
         }
@@ -105,7 +105,7 @@ class ApplicationControllerTest < ActionController::TestCase
       test "boolean parameter #{boolparam.inspect} accepted as #{bool.inspect}" do
         @controller = Arvados::V1::GroupsController.new
         authorize_with :active
-        post :create, {
+        post :create, params: {
           group: {
             name: groups(:aproject).name,
             owner_uuid: groups(:aproject).owner_uuid
index 616bd07bfbe28d77dcb659b8442162ccd7ad204e..38938c4695ebf1b42102ceb0f7b9da2f4d516f2b 100644 (file)
@@ -13,7 +13,7 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes
 
   test "should not get index with expired auth" do
     authorize_with :expired
-    get :index, format: :json
+    get :index, params: {format: :json}
     assert_response 401
   end
 
@@ -25,20 +25,20 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes
 
   test "create system auth" do
     authorize_with :admin_trustedclient
-    post :create_system_auth, scopes: '["test"]'
+    post :create_system_auth, params: {scopes: '["test"]'}
     assert_response :success
     assert_not_nil JSON.parse(@response.body)['uuid']
   end
 
   test "prohibit create system auth with token from non-trusted client" do
     authorize_with :admin
-    post :create_system_auth, scopes: '["test"]'
+    post :create_system_auth, params: {scopes: '["test"]'}
     assert_response 403
   end
 
   test "prohibit create system auth by non-admin" do
     authorize_with :active
-    post :create_system_auth, scopes: '["test"]'
+    post :create_system_auth, params: {scopes: '["test"]'}
     assert_response 403
   end
 
@@ -47,7 +47,7 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes
     expected_tokens = expected.map do |name|
       api_client_authorizations(name).api_token
     end
-    get :index, search_params
+    get :index, params: search_params
     assert_response :success
     got_tokens = JSON.parse(@response.body)['items']
       .map { |a| a['api_token'] }
@@ -94,7 +94,7 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes
   ].each do |user, token, expect_get_response, expect_list_response, expect_list_items|
     test "using '#{user}', get '#{token}' by uuid" do
       authorize_with user
-      get :show, {
+      get :show, params: {
         id: api_client_authorizations(token).uuid,
       }
       assert_response expect_get_response
@@ -102,7 +102,7 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes
 
     test "using '#{user}', update '#{token}' by uuid" do
       authorize_with user
-      put :update, {
+      put :update, params: {
         id: api_client_authorizations(token).uuid,
         api_client_authorization: {},
       }
@@ -111,7 +111,7 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes
 
     test "using '#{user}', delete '#{token}' by uuid" do
       authorize_with user
-      post :destroy, {
+      post :destroy, params: {
         id: api_client_authorizations(token).uuid,
       }
       assert_response expect_get_response
@@ -119,7 +119,7 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes
 
     test "using '#{user}', list '#{token}' by uuid" do
       authorize_with user
-      get :index, {
+      get :index, params: {
         filters: [['uuid','=',api_client_authorizations(token).uuid]],
       }
       assert_response expect_list_response
@@ -132,7 +132,7 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes
     if expect_list_items
       test "using '#{user}', list '#{token}' by uuid with offset" do
         authorize_with user
-        get :index, {
+        get :index, params: {
           filters: [['uuid','=',api_client_authorizations(token).uuid]],
           offset: expect_list_items,
         }
@@ -144,7 +144,7 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes
 
     test "using '#{user}', list '#{token}' by token" do
       authorize_with user
-      get :index, {
+      get :index, params: {
         filters: [['api_token','=',api_client_authorizations(token).api_token]],
       }
       assert_response expect_list_response
@@ -157,7 +157,7 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes
 
   test "scoped token cannot change its own scopes" do
     authorize_with :admin_vm
-    put :update, {
+    put :update, params: {
       id: api_client_authorizations(:admin_vm).uuid,
       api_client_authorization: {scopes: ['all']},
     }
@@ -166,7 +166,7 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes
 
   test "token cannot change its own uuid" do
     authorize_with :admin
-    put :update, {
+    put :update, params: {
       id: api_client_authorizations(:admin).uuid,
       api_client_authorization: {uuid: 'zzzzz-gj3su-zzzzzzzzzzzzzzz'},
     }
index 997d89d5cd13d72c97dd3edcaa177bca36e1efed..ee2b016cd53e29a230ca9b7ba5be3ec86022dfde 100644 (file)
@@ -57,7 +57,7 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
 
   test "get index with include_old_versions" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       include_old_versions: true
     }
     assert_response :success
@@ -69,7 +69,7 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
   test "collections.get returns signed locators, and no unsigned_manifest_text" do
     permit_unsigned_manifests
     authorize_with :active
-    get :show, {id: collections(:foo_file).uuid}
+    get :show, params: {id: collections(:foo_file).uuid}
     assert_response :success
     assert_signed_manifest json_response['manifest_text'], 'foo_file'
     refute_includes json_response, 'unsigned_manifest_text'
@@ -79,7 +79,7 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
     test "correct signatures are given for #{token_method}" do
       token = api_client_authorizations(:active).send(token_method)
       authorize_with_token token
-      get :show, {id: collections(:foo_file).uuid}
+      get :show, params: {id: collections(:foo_file).uuid}
       assert_response :success
       assert_signed_manifest json_response['manifest_text'], 'foo_file', token: token
     end
@@ -91,7 +91,7 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
         key: Rails.configuration.blob_signing_key,
         api_token: token)
       authorize_with_token token
-      put :update, {
+      put :update, params: {
             id: collections(:collection_owned_by_active).uuid,
             collection: {
               manifest_text: ". #{signed} 0:3:foo.txt\n",
@@ -105,7 +105,7 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
   test "index with manifest_text selected returns signed locators" do
     columns = %w(uuid owner_uuid manifest_text)
     authorize_with :active
-    get :index, select: columns
+    get :index, params: {select: columns}
     assert_response :success
     assert(assigns(:objects).andand.any?,
            "no Collections returned for index with columns selected")
@@ -118,7 +118,7 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
 
   test "index with unsigned_manifest_text selected returns only unsigned locators" do
     authorize_with :active
-    get :index, select: ['unsigned_manifest_text']
+    get :index, params: {select: ['unsigned_manifest_text']}
     assert_response :success
     assert_operator json_response["items"].count, :>, 0
     locs = 0
@@ -146,7 +146,7 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
   ['', nil, false, 'null'].each do |select|
     test "index with select=#{select.inspect} returns everything except manifest" do
       authorize_with :active
-      get :index, select: select
+      get :index, params: {select: select}
       assert_response :success
       assert json_response['items'].any?
       json_response['items'].each do |coll|
@@ -164,7 +164,7 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
    '["uuid", "manifest_text"]'].each do |select|
     test "index with select=#{select.inspect} returns no name" do
       authorize_with :active
-      get :index, select: select
+      get :index, params: {select: select}
       assert_response :success
       assert json_response['items'].any?
       json_response['items'].each do |coll|
@@ -176,7 +176,7 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
   [0,1,2].each do |limit|
     test "get index with limit=#{limit}" do
       authorize_with :active
-      get :index, limit: limit
+      get :index, params: {limit: limit}
       assert_response :success
       assert_equal limit, assigns(:objects).count
       resp = JSON.parse(@response.body)
@@ -186,7 +186,7 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
 
   test "items.count == items_available" do
     authorize_with :active
-    get :index, limit: 100000
+    get :index, params: {limit: 100000}
     assert_response :success
     resp = JSON.parse(@response.body)
     assert_equal resp['items_available'], assigns(:objects).length
@@ -197,7 +197,7 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
 
   test "items.count == items_available with filters" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       limit: 100,
       filters: [['uuid','=',collections(:foo_file).uuid]]
     }
@@ -210,7 +210,7 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
   test "get index with limit=2 offset=99999" do
     # Assume there are not that many test fixtures.
     authorize_with :active
-    get :index, limit: 2, offset: 99999
+    get :index, params: {limit: 2, offset: 99999}
     assert_response :success
     assert_equal 0, assigns(:objects).count
     resp = JSON.parse(@response.body)
@@ -223,7 +223,7 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
     coll1 = collections(:collection_1_of_201)
     Rails.configuration.max_index_database_read =
       yield(coll1.manifest_text.size)
-    get :index, {
+    get :index, params: {
       select: %w(uuid manifest_text),
       filters: [["owner_uuid", "=", coll1.owner_uuid]],
       limit: 300,
@@ -301,7 +301,7 @@ EOS
     # post :create will modify test_collection in place, so we save a copy first.
     # Hash.deep_dup is not sufficient as it preserves references of strings (??!?)
     post_collection = Marshal.load(Marshal.dump(test_collection))
-    post :create, {
+    post :create, params: {
       collection: post_collection
     }
 
@@ -331,7 +331,7 @@ EOS
       foo_collection = collections(:foo_file)
 
       # Get foo_file using its portable data hash
-      get :show, {
+      get :show, params: {
         id: foo_collection[:portable_data_hash]
       }
       assert_response :success
@@ -351,7 +351,7 @@ EOS
     permit_unsigned_manifests
     authorize_with :active
     manifest_text = ". d41d8cd98f00b204e9800998ecf8427e 0:0:foo.txt\n"
-    post :create, {
+    post :create, params: {
       collection: {
         owner_uuid: 'zzzzz-j7d0g-rew6elm53kancon',
         manifest_text: manifest_text,
@@ -367,7 +367,7 @@ EOS
     permit_unsigned_manifests
     authorize_with :admin
     manifest_text = ". d41d8cd98f00b204e9800998ecf8427e 0:0:foo.txt\n"
-    post :create, {
+    post :create, params: {
       collection: {
         owner_uuid: 'zzzzz-tpzed-000000000000000',
         manifest_text: manifest_text,
@@ -390,7 +390,7 @@ EOS
       if !unsigned
         manifest_text = Collection.sign_manifest manifest_text, api_token(:active)
       end
-      post :create, {
+      post :create, params: {
         collection: {
           owner_uuid: users(:active).uuid,
           manifest_text: manifest_text,
@@ -407,7 +407,7 @@ EOS
     permit_unsigned_manifests
     authorize_with :active
     manifest_text = ". d41d8cd98f00b204e9800998ecf8427e 0:0:foo.txt\n"
-    post :create, {
+    post :create, params: {
       collection: {
         owner_uuid: groups(:active_user_has_can_manage).uuid,
         manifest_text: manifest_text,
@@ -423,7 +423,7 @@ EOS
     permit_unsigned_manifests
     authorize_with :active
     manifest_text = ". d41d8cd98f00b204e9800998ecf8427e 0:0:foo.txt\n"
-    post :create, {
+    post :create, params: {
       collection: {
         owner_uuid: groups(:all_users).uuid,
         manifest_text: manifest_text,
@@ -437,7 +437,7 @@ EOS
     permit_unsigned_manifests
     authorize_with :active
     manifest_text = ". d41d8cd98f00b204e9800998ecf8427e 0:0:foo.txt\n"
-    post :create, {
+    post :create, params: {
       collection: {
         owner_uuid: groups(:public).uuid,
         manifest_text: manifest_text,
@@ -451,7 +451,7 @@ EOS
     permit_unsigned_manifests
     authorize_with :admin
     manifest_text = ". d41d8cd98f00b204e9800998ecf8427e 0:0:foo.txt\n"
-    post :create, {
+    post :create, params: {
       collection: {
         owner_uuid: 'zzzzz-j7d0g-it30l961gq3t0oi',
         manifest_text: manifest_text,
@@ -464,7 +464,7 @@ EOS
   test "should create with collection passed as json" do
     permit_unsigned_manifests
     authorize_with :active
-    post :create, {
+    post :create, params: {
       collection: <<-EOS
       {
         "manifest_text":". d41d8cd98f00b204e9800998ecf8427e 0:0:foo.txt\n",\
@@ -478,7 +478,7 @@ EOS
   test "should fail to create with checksum mismatch" do
     permit_unsigned_manifests
     authorize_with :active
-    post :create, {
+    post :create, params: {
       collection: <<-EOS
       {
         "manifest_text":". d41d8cd98f00b204e9800998ecf8427e 0:0:bar.txt\n",\
@@ -492,7 +492,7 @@ EOS
   test "collection UUID is normalized when created" do
     permit_unsigned_manifests
     authorize_with :active
-    post :create, {
+    post :create, params: {
       collection: {
         manifest_text: ". d41d8cd98f00b204e9800998ecf8427e 0:0:foo.txt\n",
         portable_data_hash: "d30fe8ae534397864cb96c544f4cf102+47+Khint+Xhint+Zhint"
@@ -506,7 +506,7 @@ EOS
 
   test "get full provenance for baz file" do
     authorize_with :active
-    get :provenance, id: 'ea10d51bcf88862dbcc36eb292017dfd+45'
+    get :provenance, params: {id: 'ea10d51bcf88862dbcc36eb292017dfd+45'}
     assert_response :success
     resp = JSON.parse(@response.body)
     assert_not_nil resp['ea10d51bcf88862dbcc36eb292017dfd+45'] # baz
@@ -519,14 +519,14 @@ EOS
   test "get no provenance for foo file" do
     # spectator user cannot even see baz collection
     authorize_with :spectator
-    get :provenance, id: '1f4b0bc7583c2a7f9102c395f4ffc5e3+45'
+    get :provenance, params: {id: '1f4b0bc7583c2a7f9102c395f4ffc5e3+45'}
     assert_response 404
   end
 
   test "get partial provenance for baz file" do
     # spectator user can see bar->baz job, but not foo->bar job
     authorize_with :spectator
-    get :provenance, id: 'ea10d51bcf88862dbcc36eb292017dfd+45'
+    get :provenance, params: {id: 'ea10d51bcf88862dbcc36eb292017dfd+45'}
     assert_response :success
     resp = JSON.parse(@response.body)
     assert_not_nil resp['ea10d51bcf88862dbcc36eb292017dfd+45'] # baz
@@ -539,7 +539,7 @@ EOS
   test "search collections with 'any' operator" do
     expect_pdh = collections(:docker_image).portable_data_hash
     authorize_with :active
-    get :index, {
+    get :index, params: {
       where: { any: ['contains', expect_pdh[5..25]] }
     }
     assert_response :success
@@ -584,7 +584,7 @@ EOS
         ". " + signed_locators[1] + " 0:0:foo.txt\n" +
         ". " + signed_locators[2] + " 0:0:foo.txt\n"
 
-      post :create, {
+      post :create, params: {
         collection: {
           manifest_text: signed_manifest,
           portable_data_hash: manifest_uuid,
@@ -631,7 +631,7 @@ EOS
       ". " + Blob.sign_locator(locators[1], signing_opts) + " 0:0:foo.txt\n" +
       ". " + Blob.sign_locator(locators[2], signing_opts) + " 0:0:foo.txt\n"
 
-    post :create, {
+    post :create, params: {
       collection: {
         manifest_text: signed_manifest,
         portable_data_hash: manifest_uuid,
@@ -670,7 +670,7 @@ EOS
       unsigned_manifest.length.to_s
 
     bad_manifest = ". #{bad_locator} 0:0:foo.txt\n"
-    post :create, {
+    post :create, params: {
       collection: {
         manifest_text: bad_manifest,
         portable_data_hash: manifest_uuid
@@ -694,7 +694,7 @@ EOS
       '+' +
       signed_manifest.length.to_s
 
-    post :create, {
+    post :create, params: {
       collection: {
         manifest_text: signed_manifest,
         portable_data_hash: manifest_uuid
@@ -706,7 +706,7 @@ EOS
 
   test "reject manifest with unsigned block as stream name" do
     authorize_with :active
-    post :create, {
+    post :create, params: {
       collection: {
         manifest_text: "00000000000000000000000000000000+1234 d41d8cd98f00b204e9800998ecf8427e+0 0:0:foo.txt\n"
       }
@@ -732,7 +732,7 @@ EOS
       portable_data_hash: manifest_uuid,
     }
     post_collection = Marshal.load(Marshal.dump(test_collection))
-    post :create, {
+    post :create, params: {
       collection: post_collection
     }
     assert_response :success
@@ -767,7 +767,7 @@ EOS
     signed_locators = locators.map { |loc| Blob.sign_locator loc, signing_opts }
     signed_manifest = [".", *signed_locators, "0:0:foo.txt\n"].join(" ")
 
-    post :create, {
+    post :create, params: {
       collection: {
         manifest_text: signed_manifest,
         portable_data_hash: manifest_uuid,
@@ -795,7 +795,7 @@ EOS
     authorize_with :active
     unsigned_manifest = ". 0cc175b9c0f1b6a831c399e269772661+1 0:1:a.txt\n"
     manifest_uuid = Digest::MD5.hexdigest(unsigned_manifest)
-    post :create, {
+    post :create, params: {
       collection: {
         manifest_text: unsigned_manifest,
         portable_data_hash: manifest_uuid,
@@ -809,7 +809,7 @@ EOS
 
   test 'List expired collection returns empty list' do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       where: {name: 'expired_collection'},
     }
     assert_response :success
@@ -819,7 +819,7 @@ EOS
 
   test 'Show expired collection returns 404' do
     authorize_with :active
-    get :show, {
+    get :show, params: {
       id: 'zzzzz-4zz18-mto52zx1s7sn3ih',
     }
     assert_response 404
@@ -827,7 +827,7 @@ EOS
 
   test 'Update expired collection returns 404' do
     authorize_with :active
-    post :update, {
+    post :update, params: {
       id: 'zzzzz-4zz18-mto52zx1s7sn3ih',
       collection: {
         name: "still expired"
@@ -838,7 +838,7 @@ EOS
 
   test 'List collection with future expiration time succeeds' do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       where: {name: 'collection_expires_in_future'},
     }
     found = assigns(:objects)
@@ -848,7 +848,7 @@ EOS
 
   test 'Show collection with future expiration time succeeds' do
     authorize_with :active
-    get :show, {
+    get :show, params: {
       id: 'zzzzz-4zz18-padkqo7yb8d9i3j',
     }
     assert_response :success
@@ -856,7 +856,7 @@ EOS
 
   test 'Update collection with future expiration time succeeds' do
     authorize_with :active
-    post :update, {
+    post :update, params: {
       id: 'zzzzz-4zz18-padkqo7yb8d9i3j',
       collection: {
         name: "still not expired"
@@ -867,7 +867,7 @@ EOS
 
   test "get collection and verify that file_names is not included" do
     authorize_with :active
-    get :show, {id: collections(:foo_file).uuid}
+    get :show, params: {id: collections(:foo_file).uuid}
     assert_response :success
     assert_equal collections(:foo_file).uuid, json_response['uuid']
     assert_nil json_response['file_names']
@@ -890,9 +890,11 @@ EOS
         description = description + description
       end
 
-      post :create, collection: {
-        manifest_text: ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:foo.txt\n",
-        description: description,
+      post :create, params: {
+        collection: {
+          manifest_text: ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:foo.txt\n",
+          description: description,
+        }
       }
 
       assert_response expected_response
@@ -903,7 +905,7 @@ EOS
     test "Set replication_desired=#{ask.inspect}" do
       Rails.configuration.default_collection_replication = 2
       authorize_with :active
-      put :update, {
+      put :update, params: {
         id: collections(:replication_undesired_unconfirmed).uuid,
         collection: {
           replication_desired: ask,
@@ -916,7 +918,7 @@ EOS
 
   test "get collection with properties" do
     authorize_with :active
-    get :show, {id: collections(:collection_with_one_property).uuid}
+    get :show, params: {id: collections(:collection_with_one_property).uuid}
     assert_response :success
     assert_not_nil json_response['uuid']
     assert_equal 'value1', json_response['properties']['property1']
@@ -925,7 +927,7 @@ EOS
   test "create collection with properties" do
     authorize_with :active
     manifest_text = ". d41d8cd98f00b204e9800998ecf8427e 0:0:foo.txt\n"
-    post :create, {
+    post :create, params: {
       collection: {
         manifest_text: manifest_text,
         portable_data_hash: "d30fe8ae534397864cb96c544f4cf102+47",
@@ -937,6 +939,89 @@ EOS
     assert_equal 'value_1', json_response['properties']['property_1']
   end
 
+  [
+    [". d41d8cd98f00b204e9800998ecf8427e 0:34:foo.txt\n", 1, 34],
+    [". d41d8cd98f00b204e9800998ecf8427e 0:34:foo.txt 0:30:foo.txt 0:30:foo1.txt 0:30:foo2.txt 0:30:foo3.txt 0:30:foo4.txt\n", 5, 184],
+    [". d41d8cd98f00b204e9800998ecf8427e 0:0:.\n", 0, 0]
+  ].each do |manifest, count, size|
+    test "create collection with valid manifest #{manifest} and expect file stats" do
+      authorize_with :active
+      post :create, params: {
+        collection: {
+          manifest_text: manifest
+        }
+      }
+      assert_response 200
+      assert_equal count, json_response['file_count']
+      assert_equal size, json_response['file_size_total']
+    end
+  end
+
+  test "update collection manifest and expect new file stats" do
+    authorize_with :active
+    post :update, params: {
+      id: collections(:collection_owned_by_active_with_file_stats).uuid,
+      collection: {
+        manifest_text: ". d41d8cd98f00b204e9800998ecf8427e 0:34:foo.txt\n"
+      }
+    }
+    assert_response 200
+    assert_equal 1, json_response['file_count']
+    assert_equal 34, json_response['file_size_total']
+  end
+
+  [
+    ['file_count', 1],
+    ['file_size_total', 34]
+  ].each do |attribute, val|
+    test "create collection with #{attribute} and expect overwrite" do
+      authorize_with :active
+      post :create, params: {
+        collection: {
+          manifest_text: ". d41d8cd98f00b204e9800998ecf8427e 0:34:foo.txt\n",
+          "#{attribute}": 10
+        }
+      }
+      assert_response 200
+      assert_equal val, json_response[attribute]
+    end
+  end
+
+  [
+    ['file_count', 1],
+    ['file_size_total', 3]
+  ].each do |attribute, val|
+    test "update collection with #{attribute} and expect ignore" do
+      authorize_with :active
+      post :update, params: {
+        id: collections(:collection_owned_by_active_with_file_stats).uuid,
+        collection: {
+          "#{attribute}": 10
+        }
+      }
+      assert_response 200
+      assert_equal val, json_response[attribute]
+    end
+  end
+
+  [
+    ['file_count', 1],
+    ['file_size_total', 34]
+  ].each do |attribute, val|
+    test "update collection with #{attribute} and manifest and expect manifest values" do
+      authorize_with :active
+      post :update, params: {
+        id: collections(:collection_owned_by_active_with_file_stats).uuid,
+        collection: {
+          manifest_text: ". d41d8cd98f00b204e9800998ecf8427e 0:34:foo.txt\n",
+          "#{attribute}": 10
+        }
+      }
+      assert_response 200
+      assert_equal val, json_response[attribute]
+    end
+  end
+
   [
     ". 0:0:foo.txt",
     ". d41d8cd98f00b204e9800998ecf8427e foo.txt",
@@ -945,7 +1030,7 @@ EOS
   ].each do |manifest_text|
     test "create collection with invalid manifest #{manifest_text} and expect error" do
       authorize_with :active
-      post :create, {
+      post :create, params: {
         collection: {
           manifest_text: manifest_text,
           portable_data_hash: "d41d8cd98f00b204e9800998ecf8427e+0"
@@ -966,7 +1051,7 @@ EOS
   ].each do |manifest_text, pdh|
     test "create collection with valid manifest #{manifest_text.inspect} and expect success" do
       authorize_with :active
-      post :create, {
+      post :create, params: {
         collection: {
           manifest_text: manifest_text,
           portable_data_hash: pdh
@@ -984,7 +1069,7 @@ EOS
   ].each do |manifest_text|
     test "update collection with invalid manifest #{manifest_text} and expect error" do
       authorize_with :active
-      post :update, {
+      post :update, params: {
         id: 'zzzzz-4zz18-bv31uwvy3neko21',
         collection: {
           manifest_text: manifest_text,
@@ -1005,7 +1090,7 @@ EOS
   ].each do |manifest_text|
     test "update collection with valid manifest #{manifest_text.inspect} and expect success" do
       authorize_with :active
-      post :update, {
+      post :update, params: {
         id: 'zzzzz-4zz18-bv31uwvy3neko21',
         collection: {
           manifest_text: manifest_text,
@@ -1018,7 +1103,7 @@ EOS
   test 'get trashed collection with include_trash' do
     uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih' # expired_collection
     authorize_with :active
-    get :show, {
+    get :show, params: {
       id: uuid,
       include_trash: true,
     }
@@ -1029,7 +1114,7 @@ EOS
     test "get trashed collection via filters and #{user} user" do
       uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih' # expired_collection
       authorize_with user
-      get :index, {
+      get :index, params: {
         filters: [["current_version_uuid", "=", uuid]],
         include_trash: true,
       }
@@ -1043,7 +1128,7 @@ EOS
     test "get trashed collection via filters and #{user} user, including its past versions" do
       uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih' # expired_collection
       authorize_with :admin
-      get :index, {
+      get :index, params: {
         filters: [["current_version_uuid", "=", uuid]],
         include_trash: true,
         include_old_versions: true,
@@ -1062,7 +1147,7 @@ EOS
     versions.each do |col|
       refute col.is_trashed
     end
-    post :trash, {
+    post :trash, params: {
       id: uuid,
     }
     assert_response 200
@@ -1076,7 +1161,7 @@ EOS
   test 'get trashed collection without include_trash' do
     uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih' # expired_collection
     authorize_with :active
-    get :show, {
+    get :show, params: {
       id: uuid,
     }
     assert_response 404
@@ -1085,7 +1170,7 @@ EOS
   test 'trash collection using http DELETE verb' do
     uuid = collections(:collection_owned_by_active).uuid
     authorize_with :active
-    delete :destroy, {
+    delete :destroy, params: {
       id: uuid,
     }
     assert_response 200
@@ -1097,7 +1182,7 @@ EOS
   test 'delete long-trashed collection immediately using http DELETE verb' do
     uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih' # expired_collection
     authorize_with :active
-    delete :destroy, {
+    delete :destroy, params: {
       id: uuid,
     }
     assert_response 200
@@ -1117,7 +1202,7 @@ EOS
       end
       authorize_with :active
       time_before_trashing = db_current_time
-      post :trash, {
+      post :trash, params: {
         id: uuid,
       }
       assert_response 200
@@ -1129,7 +1214,7 @@ EOS
 
   test 'untrash a trashed collection' do
     authorize_with :active
-    post :untrash, {
+    post :untrash, params: {
       id: collections(:expired_collection).uuid,
     }
     assert_response 200
@@ -1139,7 +1224,7 @@ EOS
 
   test 'untrash error on not trashed collection' do
     authorize_with :active
-    post :untrash, {
+    post :untrash, params: {
       id: collections(:collection_owned_by_active).uuid,
     }
     assert_response 422
@@ -1148,7 +1233,7 @@ EOS
   [:active, :admin].each do |user|
     test "get trashed collections as #{user}" do
       authorize_with user
-      get :index, {
+      get :index, params: {
         filters: [["is_trashed", "=", true]],
         include_trash: true,
       }
@@ -1170,7 +1255,7 @@ EOS
 
   test 'untrash collection with same name as another with no ensure unique name' do
     authorize_with :active
-    post :untrash, {
+    post :untrash, params: {
       id: collections(:trashed_collection_to_test_name_conflict_on_untrash).uuid,
     }
     assert_response 422
@@ -1178,7 +1263,7 @@ EOS
 
   test 'untrash collection with same name as another with ensure unique name' do
     authorize_with :active
-    post :untrash, {
+    post :untrash, params: {
       id: collections(:trashed_collection_to_test_name_conflict_on_untrash).uuid,
       ensure_unique_name: true
     }
@@ -1191,7 +1276,7 @@ EOS
 
   test 'cannot show collection in trashed subproject' do
     authorize_with :active
-    get :show, {
+    get :show, params: {
       id: collections(:collection_in_trashed_subproject).uuid,
       format: :json
     }
@@ -1201,7 +1286,7 @@ EOS
   test 'can show collection in untrashed subproject' do
     authorize_with :active
     Group.find_by_uuid(groups(:trashed_project).uuid).update! is_trashed: false
-    get :show, {
+    get :show, params: {
       id: collections(:collection_in_trashed_subproject).uuid,
       format: :json,
     }
@@ -1210,7 +1295,7 @@ EOS
 
   test 'cannot index collection in trashed subproject' do
     authorize_with :active
-    get :index, { limit: 1000 }
+    get :index, params: { limit: 1000 }
     assert_response :success
     item_uuids = json_response['items'].map do |item|
       item['uuid']
@@ -1221,7 +1306,7 @@ EOS
   test 'can index collection in untrashed subproject' do
     authorize_with :active
     Group.find_by_uuid(groups(:trashed_project).uuid).update! is_trashed: false
-    get :index, { limit: 1000 }
+    get :index, params: { limit: 1000 }
     assert_response :success
     item_uuids = json_response['items'].map do |item|
       item['uuid']
@@ -1231,7 +1316,7 @@ EOS
 
   test 'can index trashed subproject collection with include_trash' do
     authorize_with :active
-    get :index, {
+    get :index, params: {
           include_trash: true,
           limit: 1000
         }
@@ -1244,7 +1329,7 @@ EOS
 
   test 'can get collection with past versions' do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['current_version_uuid','=',collections(:collection_owned_by_active).uuid]],
       include_old_versions: true
     }
@@ -1261,7 +1346,7 @@ EOS
 
   test 'can get old version collection by uuid' do
     authorize_with :active
-    get :show, {
+    get :show, params: {
       id: collections(:collection_owned_by_active_past_version_1).uuid,
     }
     assert_response :success
@@ -1273,7 +1358,7 @@ EOS
     permit_unsigned_manifests
     authorize_with :active
     manifest_text = ". d41d8cd98f00b204e9800998ecf8427e 0:0:foo.txt\n"
-    post :create, {
+    post :create, params: {
       collection: {
         name: 'Test collection',
         version: 42,
@@ -1301,7 +1386,7 @@ EOS
       key: Rails.configuration.blob_signing_key,
       api_token: token)
     authorize_with_token token
-    put :update, {
+    put :update, params: {
           id: col.uuid,
           collection: {
             manifest_text: ". #{signed} 0:3:foo.txt\n",
index a3252ad7b3fcdaa8fc78294bbb29b794a7107986..e77e2ed3c6bdc11ac7f6fcd3ad54c5869ece2c46 100644 (file)
@@ -17,7 +17,7 @@ class Arvados::V1::ContainerRequestsControllerTest < ActionController::TestCase
     authorize_with :active
 
     sp = {'partitions' => ['test1', 'test2']}
-    post :create, {
+    post :create, params: {
            container_request: minimal_cr.merge(scheduling_parameters: sp.dup)
          }
     assert_response :success
@@ -30,7 +30,7 @@ class Arvados::V1::ContainerRequestsControllerTest < ActionController::TestCase
   test "secret_mounts not in #create responses" do
     authorize_with :active
 
-    post :create, {
+    post :create, params: {
            container_request: minimal_cr.merge(
              secret_mounts: {'/foo' => {'kind' => 'json', 'content' => 'bar'}}),
          }
@@ -47,7 +47,7 @@ class Arvados::V1::ContainerRequestsControllerTest < ActionController::TestCase
     authorize_with :active
     req = container_requests(:uncommitted)
 
-    patch :update, {
+    patch :update, params: {
             id: req.uuid,
             container_request: {
               secret_mounts: {'/foo' => {'kind' => 'json', 'content' => 'bar'}},
@@ -67,7 +67,7 @@ class Arvados::V1::ContainerRequestsControllerTest < ActionController::TestCase
     req = container_requests(:uncommitted)
     req.update_attributes!(secret_mounts: {'/foo' => {'kind' => 'json', 'content' => 'bar'}})
 
-    patch :update, {
+    patch :update, params: {
             id: req.uuid,
             container_request: {
               command: ['echo', 'test'],
@@ -85,7 +85,7 @@ class Arvados::V1::ContainerRequestsControllerTest < ActionController::TestCase
   test "runtime_token not in #create responses" do
     authorize_with :active
 
-    post :create, {
+    post :create, params: {
            container_request: minimal_cr.merge(
              runtime_token: api_client_authorizations(:spectator).token)
          }
index 452533b9e9a13e93b05f4c28be484e5c8ca23f98..588c025cf79e0b1aba6c1b4ac2d37966ca207899 100644 (file)
@@ -7,7 +7,7 @@ require 'test_helper'
 class Arvados::V1::ContainersControllerTest < ActionController::TestCase
   test 'create' do
     authorize_with :system_user
-    post :create, {
+    post :create, params: {
       container: {
         command: ['echo', 'hello'],
         container_image: 'test',
@@ -20,7 +20,7 @@ class Arvados::V1::ContainersControllerTest < ActionController::TestCase
   [Container::Queued, Container::Complete].each do |state|
     test "cannot get auth in #{state} state" do
       authorize_with :dispatch1
-      get :auth, id: containers(:queued).uuid
+      get :auth, params: {id: containers(:queued).uuid}
       assert_response 403
     end
   end
@@ -31,7 +31,7 @@ class Arvados::V1::ContainersControllerTest < ActionController::TestCase
     assert c.lock, show_errors(c)
 
     authorize_with :system_user
-    get :auth, id: c.uuid
+    get :auth, params: {id: c.uuid}
     assert_response 403
   end
 
@@ -39,7 +39,7 @@ class Arvados::V1::ContainersControllerTest < ActionController::TestCase
     authorize_with :dispatch1
     c = containers(:queued)
     assert c.lock, show_errors(c)
-    get :auth, id: c.uuid
+    get :auth, params: {id: c.uuid}
     assert_response :success
     assert_operator 32, :<, json_response['api_token'].length
     assert_equal 'arvados#apiClientAuthorization', json_response['kind']
@@ -49,7 +49,7 @@ class Arvados::V1::ContainersControllerTest < ActionController::TestCase
     authorize_with :dispatch1
     c = containers(:queued)
     assert c.lock, show_errors(c)
-    get :show, id: c.uuid
+    get :show, params: {id: c.uuid}
     assert_response :success
     assert_nil json_response['auth']
     assert_nil json_response['secret_mounts']
@@ -58,7 +58,7 @@ class Arvados::V1::ContainersControllerTest < ActionController::TestCase
   test "lock container" do
     authorize_with :dispatch1
     uuid = containers(:queued).uuid
-    post :lock, {id: uuid}
+    post :lock, params: {id: uuid}
     assert_response :success
     assert_nil json_response['mounts']
     assert_nil json_response['command']
@@ -77,7 +77,7 @@ class Arvados::V1::ContainersControllerTest < ActionController::TestCase
   test "unlock container" do
     authorize_with :dispatch1
     uuid = containers(:locked).uuid
-    post :unlock, {id: uuid}
+    post :unlock, params: {id: uuid}
     assert_response :success
     assert_nil json_response['mounts']
     assert_nil json_response['command']
@@ -96,7 +96,7 @@ class Arvados::V1::ContainersControllerTest < ActionController::TestCase
   test "unlock container locked by different dispatcher" do
     authorize_with :dispatch2
     uuid = containers(:locked).uuid
-    post :unlock, {id: uuid}
+    post :unlock, params: {id: uuid}
     assert_response 422
   end
 
@@ -110,7 +110,7 @@ class Arvados::V1::ContainersControllerTest < ActionController::TestCase
     test "state transitions from #{fixture} to #{action}" do
       authorize_with :dispatch1
       uuid = containers(fixture).uuid
-      post action, {id: uuid}
+      post action, params: {id: uuid}
       assert_response response
       assert_equal state, Container.where(uuid: uuid).first.state
     end
@@ -142,7 +142,7 @@ class Arvados::V1::ContainersControllerTest < ActionController::TestCase
   ].each do |expect_success, auth|
     test "get secret_mounts with #{auth} token" do
       authorize_with auth
-      get :secret_mounts, {id: containers(:running).uuid}
+      get :secret_mounts, params: {id: containers(:running).uuid}
       if expect_success
         assert_response :success
         assert_equal "42\n", json_response["secret_mounts"]["/secret/6x9"]["content"]
@@ -155,10 +155,9 @@ class Arvados::V1::ContainersControllerTest < ActionController::TestCase
   test 'get runtime_token auth' do
     authorize_with :dispatch2
     c = containers(:runtime_token)
-    get :auth, id: c.uuid
+    get :auth, params: {id: c.uuid}
     assert_response :success
     assert_equal "v2/#{json_response['uuid']}/#{json_response['api_token']}", api_client_authorizations(:container_runtime_token).token
     assert_equal 'arvados#apiClientAuthorization', json_response['kind']
   end
-
 end
index c76b94e4823bc7542a100cdfe6895757744c7347..b596baaae49ba5c31ff5bd870bd58fa4a77dcf79 100644 (file)
@@ -8,7 +8,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
   test '"not in" filter passes null values' do
     @controller = Arvados::V1::GroupsController.new
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['group_class', 'not in', ['project']] ],
       controller: 'groups',
     }
@@ -21,7 +21,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
   test 'error message for non-array element in filters array' do
     @controller = Arvados::V1::CollectionsController.new
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [{bogus: 'filter'}],
     }
     assert_response 422
@@ -32,7 +32,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
   test 'error message for full text search on a specific column' do
     @controller = Arvados::V1::CollectionsController.new
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['uuid', '@@', 'abcdef']],
     }
     assert_response 422
@@ -42,7 +42,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
   test 'difficult characters in full text search' do
     @controller = Arvados::V1::CollectionsController.new
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['any', '@@', 'a|b"c']],
     }
     assert_response :success
@@ -52,7 +52,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
   test 'array operand in full text search' do
     @controller = Arvados::V1::CollectionsController.new
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['any', '@@', ['abc', 'def']]],
     }
     assert_response 422
@@ -86,7 +86,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
       timestamp = mine.modified_at.strftime('%Y-%m-%dT%H:%M:%S.%NZ')
       @controller = Arvados::V1::CollectionsController.new
       authorize_with :active
-      get :index, {
+      get :index, params: {
         filters: [['modified_at', operator, timestamp],
                   ['uuid', '=', mine.uuid]],
       }
@@ -104,7 +104,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
     @controller = Arvados::V1::GroupsController.new
     authorize_with :admin
 
-    get :contents, {
+    get :contents, params: {
       format: :json,
       count: 'none',
       limit: 1000,
@@ -131,7 +131,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
 
     @controller = Arvados::V1::GroupsController.new
 
-    get :contents, {
+    get :contents, params: {
       format: :json,
       count: 'none',
       limit: 1000,
@@ -176,7 +176,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
     test "jsonb filter properties.#{prop} #{op} #{opr})" do
       @controller = Arvados::V1::CollectionsController.new
       authorize_with :admin
-      get :index, {
+      get :index, params: {
             filters: SafeJSON.dump([ ["properties.#{prop}", op, opr] ]),
             limit: 1000
           }
@@ -196,7 +196,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
   test "jsonb hash 'exists' and '!=' filter" do
     @controller = Arvados::V1::CollectionsController.new
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['properties.prop1', 'exists', true], ['properties.prop1', '!=', 'value1'] ]
     }
     assert_response :success
@@ -211,7 +211,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
   test "jsonb array 'exists'" do
     @controller = Arvados::V1::CollectionsController.new
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['storage_classes_confirmed.default', 'exists', true] ]
     }
     assert_response :success
@@ -228,7 +228,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
   test "jsonb hash alternate form 'exists' and '!=' filter" do
     @controller = Arvados::V1::CollectionsController.new
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['properties', 'exists', 'prop1'], ['properties.prop1', '!=', 'value1'] ]
     }
     assert_response :success
@@ -243,7 +243,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
   test "jsonb array alternate form 'exists' filter" do
     @controller = Arvados::V1::CollectionsController.new
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['storage_classes_confirmed', 'exists', 'default'] ]
     }
     assert_response :success
@@ -260,7 +260,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
   test "jsonb 'exists' must be boolean" do
     @controller = Arvados::V1::CollectionsController.new
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['properties.prop1', 'exists', nil] ]
     }
     assert_response 422
@@ -271,7 +271,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
   test "jsonb checks column exists" do
     @controller = Arvados::V1::CollectionsController.new
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['puppies.prop1', '=', 'value1'] ]
     }
     assert_response 422
@@ -282,7 +282,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
   test "jsonb checks column is valid" do
     @controller = Arvados::V1::CollectionsController.new
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['name.prop1', '=', 'value1'] ]
     }
     assert_response 422
@@ -293,7 +293,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
   test "jsonb invalid operator" do
     @controller = Arvados::V1::CollectionsController.new
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['properties.prop1', '###', 'value1'] ]
     }
     assert_response 422
@@ -304,7 +304,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
   test "replication_desired = 2" do
     @controller = Arvados::V1::CollectionsController.new
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: SafeJSON.dump([ ['replication_desired', '=', 2] ])
     }
     assert_response :success
@@ -312,5 +312,4 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
     assert_includes(found, collections(:replication_desired_2_unconfirmed).uuid)
     assert_includes(found, collections(:replication_desired_2_confirmed_2).uuid)
   end
-
 end
index 55493046ed5f10fc2744ff911d1a53d683208321..37b606409ec46b89c67914313f19a6d2d827c6a8 100644 (file)
@@ -8,19 +8,19 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test "attempt to delete group without read or write access" do
     authorize_with :active
-    post :destroy, id: groups(:empty_lonely_group).uuid
+    post :destroy, params: {id: groups(:empty_lonely_group).uuid}
     assert_response 404
   end
 
   test "attempt to delete group without write access" do
     authorize_with :active
-    post :destroy, id: groups(:all_users).uuid
+    post :destroy, params: {id: groups(:all_users).uuid}
     assert_response 403
   end
 
   test "get list of projects" do
     authorize_with :active
-    get :index, filters: [['group_class', '=', 'project']], format: :json
+    get :index, params: {filters: [['group_class', '=', 'project']], format: :json}
     assert_response :success
     group_uuids = []
     json_response['items'].each do |group|
@@ -35,7 +35,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test "get list of groups that are not projects" do
     authorize_with :active
-    get :index, filters: [['group_class', '!=', 'project']], format: :json
+    get :index, params: {filters: [['group_class', '!=', 'project']], format: :json}
     assert_response :success
     group_uuids = []
     json_response['items'].each do |group|
@@ -50,7 +50,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test "get list of groups with bogus group_class" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['group_class', '=', 'nogrouphasthislittleclass']],
       format: :json,
     }
@@ -81,7 +81,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test 'get group-owned objects' do
     authorize_with :active
-    get :contents, {
+    get :contents, params: {
       id: groups(:aproject).uuid,
       format: :json,
     }
@@ -90,7 +90,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test "user with project read permission can see project objects" do
     authorize_with :project_viewer
-    get :contents, {
+    get :contents, params: {
       id: groups(:aproject).uuid,
       format: :json,
     }
@@ -99,7 +99,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test "list objects across projects" do
     authorize_with :project_viewer
-    get :contents, {
+    get :contents, params: {
       format: :json,
       filters: [['uuid', 'is_a', 'arvados#specimen']]
     }
@@ -118,7 +118,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test "list trashed collections and projects" do
     authorize_with :active
-    get(:contents, {
+    get(:contents, params: {
           format: :json,
           include_trash: true,
           filters: [
@@ -137,7 +137,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test "list objects in home project" do
     authorize_with :active
-    get :contents, {
+    get :contents, params: {
       format: :json,
       limit: 200,
       id: users(:active).uuid
@@ -150,7 +150,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test "user with project read permission can see project collections" do
     authorize_with :project_viewer
-    get :contents, {
+    get :contents, params: {
       id: groups(:asubproject).uuid,
       format: :json,
     }
@@ -170,7 +170,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
   ].each do |column, order, operator, field|
     test "user with project read permission can sort projects on #{column} #{order}" do
       authorize_with :project_viewer
-      get :contents, {
+      get :contents, params: {
         id: groups(:asubproject).uuid,
         format: :json,
         filters: [['uuid', 'is_a', "arvados#collection"]],
@@ -218,11 +218,13 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
   # project tests.
   def check_new_project_link_fails(link_attrs)
     @controller = Arvados::V1::LinksController.new
-    post :create, link: {
-      link_class: "permission",
-      name: "can_read",
-      head_uuid: groups(:aproject).uuid,
-    }.merge(link_attrs)
+    post :create, params: {
+      link: {
+        link_class: "permission",
+        name: "can_read",
+        head_uuid: groups(:aproject).uuid,
+      }.merge(link_attrs)
+    }
     assert_includes(403..422, response.status)
   end
 
@@ -239,7 +241,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
   test "user with project read permission can't rename items in it" do
     authorize_with :project_viewer
     @controller = Arvados::V1::LinksController.new
-    post :update, {
+    post :update, params: {
       id: jobs(:running).uuid,
       name: "Denied test name",
     }
@@ -249,7 +251,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
   test "user with project read permission can't remove items from it" do
     @controller = Arvados::V1::PipelineTemplatesController.new
     authorize_with :project_viewer
-    post :update, {
+    post :update, params: {
       id: pipeline_templates(:two_part).uuid,
       pipeline_template: {
         owner_uuid: users(:project_viewer).uuid,
@@ -260,13 +262,13 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test "user with project read permission can't delete it" do
     authorize_with :project_viewer
-    post :destroy, {id: groups(:aproject).uuid}
+    post :destroy, params: {id: groups(:aproject).uuid}
     assert_response 403
   end
 
   test 'get group-owned objects with limit' do
     authorize_with :active
-    get :contents, {
+    get :contents, params: {
       id: groups(:aproject).uuid,
       limit: 1,
       format: :json,
@@ -278,7 +280,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test 'get group-owned objects with limit and offset' do
     authorize_with :active
-    get :contents, {
+    get :contents, params: {
       id: groups(:aproject).uuid,
       limit: 1,
       offset: 12345,
@@ -291,7 +293,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test 'get group-owned objects with additional filter matching nothing' do
     authorize_with :active
-    get :contents, {
+    get :contents, params: {
       id: groups(:aproject).uuid,
       filters: [['uuid', 'in', ['foo_not_a_uuid','bar_not_a_uuid']]],
       format: :json,
@@ -305,7 +307,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
     ['foo', '', '1234five', '0x10', '-8'].each do |val|
       test "Raise error on bogus #{arg} parameter #{val.inspect}" do
         authorize_with :active
-        get :contents, {
+        get :contents, params: {
           :id => groups(:aproject).uuid,
           :format => :json,
           arg => val,
@@ -317,7 +319,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test "Collection contents don't include manifest_text" do
     authorize_with :active
-    get :contents, {
+    get :contents, params: {
       id: groups(:aproject).uuid,
       filters: [["uuid", "is_a", "arvados#collection"]],
       format: :json,
@@ -331,7 +333,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test 'get writable_by list for owned group' do
     authorize_with :active
-    get :show, {
+    get :show, params: {
       id: groups(:aproject).uuid,
       format: :json
     }
@@ -344,7 +346,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test 'no writable_by list for group with read-only access' do
     authorize_with :rominiadmin
-    get :show, {
+    get :show, params: {
       id: groups(:testusergroup_admins).uuid,
       format: :json
     }
@@ -356,7 +358,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test 'get writable_by list by admin user' do
     authorize_with :admin
-    get :show, {
+    get :show, params: {
       id: groups(:testusergroup_admins).uuid,
       format: :json
     }
@@ -370,7 +372,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test 'creating subproject with duplicate name fails' do
     authorize_with :active
-    post :create, {
+    post :create, params: {
       group: {
         name: 'A Project',
         owner_uuid: users(:active).uuid,
@@ -386,7 +388,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test 'creating duplicate named subproject succeeds with ensure_unique_name' do
     authorize_with :active
-    post :create, {
+    post :create, params: {
       group: {
         name: 'A Project',
         owner_uuid: users(:active).uuid,
@@ -403,49 +405,6 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
                  new_project['name'])
   end
 
-  test "unsharing a project results in hiding it from previously shared user" do
-    # remove sharing link for project
-    @controller = Arvados::V1::LinksController.new
-    authorize_with :admin
-    post :destroy, id: links(:share_starred_project_with_project_viewer).uuid
-    assert_response :success
-
-    # verify that the user can no longer see the project
-    @test_counter = 0  # Reset executed action counter
-    @controller = Arvados::V1::GroupsController.new
-    authorize_with :project_viewer
-    get :index, filters: [['group_class', '=', 'project']], format: :json
-    assert_response :success
-    found_projects = {}
-    json_response['items'].each do |g|
-      found_projects[g['uuid']] = g
-    end
-    assert_equal false, found_projects.include?(groups(:starred_and_shared_active_user_project).uuid)
-
-    # share the project
-    @test_counter = 0
-    @controller = Arvados::V1::LinksController.new
-    authorize_with :system_user
-    post :create, link: {
-      link_class: "permission",
-      name: "can_read",
-      head_uuid: groups(:starred_and_shared_active_user_project).uuid,
-      tail_uuid: users(:project_viewer).uuid,
-    }
-
-    # verify that project_viewer user can now see shared project again
-    @test_counter = 0
-    @controller = Arvados::V1::GroupsController.new
-    authorize_with :project_viewer
-    get :index, filters: [['group_class', '=', 'project']], format: :json
-    assert_response :success
-    found_projects = {}
-    json_response['items'].each do |g|
-      found_projects[g['uuid']] = g
-    end
-    assert_equal true, found_projects.include?(groups(:starred_and_shared_active_user_project).uuid)
-  end
-
   [
     [['owner_uuid', '!=', 'zzzzz-tpzed-xurymjxw79nv3jz'], 200,
         'zzzzz-d1hrv-subprojpipeline', 'zzzzz-d1hrv-1xfj6xkicf2muk2'],
@@ -460,7 +419,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
   ].each do |filter, expect_code, expect_uuid, not_expect_uuid|
     test "get contents with '#{filter}' filter" do
       authorize_with :active
-      get :contents, filters: [filter], format: :json
+      get :contents, params: {filters: [filter], format: :json}
       assert_response expect_code
       if expect_code == 200
         assert_not_empty json_response['items']
@@ -475,7 +434,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
     Rails.configuration.disable_api_methods = ['jobs.index', 'pipeline_instances.index']
 
     authorize_with :active
-    get :contents, {
+    get :contents, params: {
       id: groups(:aproject).uuid,
       format: :json,
     }
@@ -487,7 +446,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
     # restricted column
     Rails.configuration.max_index_database_read = 12
     authorize_with :active
-    get :contents, {
+    get :contents, params: {
           id: groups(:aproject).uuid,
           format: :json,
         }
@@ -504,7 +463,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
       recursive: true,
       format: :json,
     }
-    get :contents, params
+    get :contents, params: params
     owners = json_response['items'].map do |item|
       item['owner_uuid']
     end
@@ -520,7 +479,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
         format: :json,
       }
       params[:recursive] = false if recursive == false
-      get :contents, params
+      get :contents, params: params
       owners = json_response['items'].map do |item|
         item['owner_uuid']
       end
@@ -531,7 +490,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test 'get home project contents, recursive=true' do
     authorize_with :active
-    get :contents, {
+    get :contents, params: {
           id: users(:active).uuid,
           recursive: true,
           format: :json,
@@ -562,7 +521,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
         untrash.each do |pr|
           Group.find_by_uuid(groups(pr).uuid).update! is_trashed: false
         end
-        get :contents, {
+        get :contents, params: {
               id: groups(project).owner_uuid,
               format: :json
             }
@@ -586,7 +545,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
         untrash.each do |pr|
           Group.find_by_uuid(groups(pr).uuid).update! is_trashed: false
         end
-        get :contents, {
+        get :contents, params: {
               id: groups(project).uuid,
               format: :json
             }
@@ -602,7 +561,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
         untrash.each do |pr|
           Group.find_by_uuid(groups(pr).uuid).update! is_trashed: false
         end
-        get :index, {
+        get :index, params: {
               format: :json,
             }
         assert_response :success
@@ -621,7 +580,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
         untrash.each do |pr|
           Group.find_by_uuid(groups(pr).uuid).update! is_trashed: false
         end
-        get :show, {
+        get :show, params: {
               id: groups(project).uuid,
               format: :json
             }
@@ -637,7 +596,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
         untrash.each do |pr|
           Group.find_by_uuid(groups(pr).uuid).update! is_trashed: false
         end
-        get :show, {
+        get :show, params: {
               id: groups(project).uuid,
               format: :json,
               include_trash: true
@@ -650,7 +609,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
         untrash.each do |pr|
           Group.find_by_uuid(groups(pr).uuid).update! is_trashed: false
         end
-        get :index, {
+        get :index, params: {
               format: :json,
               include_trash: true
             }
@@ -668,7 +627,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
         Group.find_by_uuid(groups(pr).uuid).update! is_trashed: false
       end
       assert !Group.find_by_uuid(groups(:trashed_project).uuid).is_trashed
-      post :destroy, {
+      post :destroy, params: {
             id: groups(:trashed_project).uuid,
             format: :json,
           }
@@ -679,7 +638,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
     test "untrash project #{auth}" do
       authorize_with auth
       assert Group.find_by_uuid(groups(:trashed_project).uuid).is_trashed
-      post :untrash, {
+      post :untrash, params: {
             id: groups(:trashed_project).uuid,
             format: :json,
           }
@@ -695,7 +654,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
       gc = Group.create!({owner_uuid: "zzzzz-j7d0g-trashedproject1",
                          name: "trashed subproject 3",
                          group_class: "project"})
-      post :untrash, {
+      post :untrash, params: {
             id: groups(:trashed_subproject3).uuid,
             format: :json,
             ensure_unique_name: true
@@ -707,7 +666,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
     test "move trashed subproject to new owner #{auth}" do
       authorize_with auth
       assert_nil Group.readable_by(users(auth)).where(uuid: groups(:trashed_subproject).uuid).first
-      put :update, {
+      put :update, params: {
             id: groups(:trashed_subproject).uuid,
             group: {
               owner_uuid: users(:active).uuid
@@ -731,7 +690,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
         head_uuid: groups(:project_owned_by_foo).uuid)
     end
 
-    get :shared, {:filters => [["group_class", "=", "project"]], :include => "owner_uuid"}
+    get :shared, params: {:filters => [["group_class", "=", "project"]], :include => "owner_uuid"}
 
     assert_equal 1, json_response['items'].length
     assert_equal json_response['items'][0]["uuid"], groups(:project_owned_by_foo).uuid
@@ -752,7 +711,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
         head_uuid: groups(:project_owned_by_foo).uuid)
     end
 
-    get :shared, {:filters => [["group_class", "=", "project"]], :include => "owner_uuid"}
+    get :shared, params: {:filters => [["group_class", "=", "project"]], :include => "owner_uuid"}
 
     assert_equal 1, json_response['items'].length
     assert_equal json_response['items'][0]["uuid"], groups(:project_owned_by_foo).uuid
@@ -767,7 +726,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
       Group.find_by_uuid(groups(:project_owned_by_foo).uuid).update!(owner_uuid: groups(:group_for_sharing_tests).uuid)
     end
 
-    get :shared, {:filters => [["group_class", "=", "project"]], :include => "owner_uuid"}
+    get :shared, params: {:filters => [["group_class", "=", "project"]], :include => "owner_uuid"}
 
     assert_equal 1, json_response['items'].length
     assert_equal json_response['items'][0]["uuid"], groups(:project_owned_by_foo).uuid
@@ -794,7 +753,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
         head_uuid: collections(:collection_owned_by_foo).uuid)
     end
 
-    get :contents, {:include => "owner_uuid", :exclude_home_project => true}
+    get :contents, params: {:include => "owner_uuid", :exclude_home_project => true}
 
     assert_equal 2, json_response['items'].length
     assert_equal json_response['items'][0]["uuid"], groups(:project_owned_by_foo).uuid
@@ -816,7 +775,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
         head_uuid: groups(:project_owned_by_foo).uuid)
     end
 
-    get :contents, {:include => "owner_uuid", :exclude_home_project => true}
+    get :contents, params: {:include => "owner_uuid", :exclude_home_project => true}
 
     assert_equal 1, json_response['items'].length
     assert_equal json_response['items'][0]["uuid"], groups(:project_owned_by_foo).uuid
@@ -831,7 +790,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
       Group.find_by_uuid(groups(:project_owned_by_foo).uuid).update!(owner_uuid: groups(:group_for_sharing_tests).uuid)
     end
 
-    get :contents, {:include => "owner_uuid", :exclude_home_project => true}
+    get :contents, params: {:include => "owner_uuid", :exclude_home_project => true}
 
     assert_equal 1, json_response['items'].length
     assert_equal json_response['items'][0]["uuid"], groups(:project_owned_by_foo).uuid
@@ -840,13 +799,11 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
     assert_equal json_response['included'][0]["uuid"], groups(:group_for_sharing_tests).uuid
   end
 
-
   test 'contents, exclude home, with parent specified' do
     authorize_with :active
 
-    get :contents, {id: groups(:aproject).uuid, :include => "owner_uuid", :exclude_home_project => true}
+    get :contents, params: {id: groups(:aproject).uuid, :include => "owner_uuid", :exclude_home_project => true}
 
     assert_response 422
   end
-
 end
index f4abf4dab2e20301be7677d77d6f67b3f4dfddaa..d10ab6a71b41b330f2d653ee0372d1b88679cf7a 100644 (file)
@@ -17,14 +17,16 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "reuse job with no_reuse=false" do
-    post :create, job: {
-      no_reuse: false,
-      script: "hash",
-      script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
-      repository: "active/foo",
-      script_parameters: {
-        an_integer: '1',
-        input: 'fa7aeb5140e2848d39b416daeef4ffc5+45'
+    post :create, params: {
+      job: {
+        no_reuse: false,
+        script: "hash",
+        script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
+        repository: "active/foo",
+        script_parameters: {
+          an_integer: '1',
+          input: 'fa7aeb5140e2848d39b416daeef4ffc5+45'
+        }
       }
     }
     assert_response :success
@@ -35,7 +37,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "reuse job with find_or_create=true" do
-    post :create, {
+    post :create, params: {
       job: {
         script: "hash",
         script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
@@ -55,7 +57,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "no reuse job with null log" do
-    post :create, {
+    post :create, params: {
       job: {
         script: "hash",
         script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
@@ -75,7 +77,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "reuse job with symbolic script_version" do
-    post :create, {
+    post :create, params: {
       job: {
         script: "hash",
         script_version: "tag1",
@@ -95,7 +97,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "do not reuse job because no_reuse=true" do
-    post :create, {
+    post :create, params: {
       job: {
         no_reuse: true,
         script: "hash",
@@ -116,7 +118,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
 
   [false, "false"].each do |whichfalse|
     test "do not reuse job because find_or_create=#{whichfalse.inspect}" do
-      post :create, {
+      post :create, params: {
         job: {
           script: "hash",
           script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
@@ -138,7 +140,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
 
   test "do not reuse job because output is not readable by user" do
     authorize_with :job_reader
-    post :create, {
+    post :create, params: {
       job: {
         script: "hash",
         script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
@@ -158,14 +160,16 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "test_cannot_reuse_job_no_output" do
-    post :create, job: {
-      no_reuse: false,
-      script: "hash",
-      script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
-      repository: "active/foo",
-      script_parameters: {
-        input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
-        an_integer: '2'
+    post :create, params: {
+      job: {
+        no_reuse: false,
+        script: "hash",
+        script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
+        repository: "active/foo",
+        script_parameters: {
+          input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
+          an_integer: '2'
+        }
       }
     }
     assert_response :success
@@ -175,15 +179,17 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "test_reuse_job_range" do
-    post :create, job: {
-      no_reuse: false,
-      script: "hash",
-      minimum_script_version: "tag1",
-      script_version: "master",
-      repository: "active/foo",
-      script_parameters: {
-        input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
-        an_integer: '1'
+    post :create, params: {
+      job: {
+        no_reuse: false,
+        script: "hash",
+        minimum_script_version: "tag1",
+        script_version: "master",
+        repository: "active/foo",
+        script_parameters: {
+          input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
+          an_integer: '1'
+        }
       }
     }
     assert_response :success
@@ -194,14 +200,16 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "cannot_reuse_job_no_minimum_given_so_must_use_specified_commit" do
-    post :create, job: {
-      no_reuse: false,
-      script: "hash",
-      script_version: "master",
-      repository: "active/foo",
-      script_parameters: {
-        input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
-        an_integer: '1'
+    post :create, params: {
+      job: {
+        no_reuse: false,
+        script: "hash",
+        script_version: "master",
+        repository: "active/foo",
+        script_parameters: {
+          input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
+          an_integer: '1'
+        }
       }
     }
     assert_response :success
@@ -212,14 +220,16 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "test_cannot_reuse_job_different_input" do
-    post :create, job: {
-      no_reuse: false,
-      script: "hash",
-      script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
-      repository: "active/foo",
-      script_parameters: {
-        input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
-        an_integer: '2'
+    post :create, params: {
+      job: {
+        no_reuse: false,
+        script: "hash",
+        script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
+        repository: "active/foo",
+        script_parameters: {
+          input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
+          an_integer: '2'
+        }
       }
     }
     assert_response :success
@@ -230,14 +240,16 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "test_cannot_reuse_job_different_version" do
-    post :create, job: {
-      no_reuse: false,
-      script: "hash",
-      script_version: "master",
-      repository: "active/foo",
-      script_parameters: {
-        input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
-        an_integer: '2'
+    post :create, params: {
+      job: {
+        no_reuse: false,
+        script: "hash",
+        script_version: "master",
+        repository: "active/foo",
+        script_parameters: {
+          input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
+          an_integer: '2'
+        }
       }
     }
     assert_response :success
@@ -248,16 +260,18 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "test_can_reuse_job_submitted_nondeterministic" do
-    post :create, job: {
-      no_reuse: false,
-      script: "hash",
-      script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
-      repository: "active/foo",
-      script_parameters: {
-        input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
-        an_integer: '1'
-      },
-      nondeterministic: true
+    post :create, params: {
+      job: {
+        no_reuse: false,
+        script: "hash",
+        script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
+        repository: "active/foo",
+        script_parameters: {
+          input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
+          an_integer: '1'
+        },
+        nondeterministic: true
+      }
     }
     assert_response :success
     assert_not_nil assigns(:object)
@@ -267,14 +281,16 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "test_cannot_reuse_job_past_nondeterministic" do
-    post :create, job: {
-      no_reuse: false,
-      script: "hash2",
-      script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
-      repository: "active/foo",
-      script_parameters: {
-        input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
-        an_integer: '1'
+    post :create, params: {
+      job: {
+        no_reuse: false,
+        script: "hash2",
+        script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
+        repository: "active/foo",
+        script_parameters: {
+          input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
+          an_integer: '1'
+        }
       }
     }
     assert_response :success
@@ -286,14 +302,16 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
 
   test "test_cannot_reuse_job_no_permission" do
     authorize_with :spectator
-    post :create, job: {
-      no_reuse: false,
-      script: "hash",
-      script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
-      repository: "active/foo",
-      script_parameters: {
-        input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
-        an_integer: '1'
+    post :create, params: {
+      job: {
+        no_reuse: false,
+        script: "hash",
+        script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
+        repository: "active/foo",
+        script_parameters: {
+          input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
+          an_integer: '1'
+        }
       }
     }
     assert_response :success
@@ -304,16 +322,18 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "test_cannot_reuse_job_excluded" do
-    post :create, job: {
-      no_reuse: false,
-      script: "hash",
-      minimum_script_version: "31ce37fe365b3dc204300a3e4c396ad333ed0556",
-      script_version: "master",
-      repository: "active/foo",
-      exclude_script_versions: ["tag1"],
-      script_parameters: {
-        input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
-        an_integer: '1'
+    post :create, params: {
+      job: {
+        no_reuse: false,
+        script: "hash",
+        minimum_script_version: "31ce37fe365b3dc204300a3e4c396ad333ed0556",
+        script_version: "master",
+        repository: "active/foo",
+        exclude_script_versions: ["tag1"],
+        script_parameters: {
+          input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
+          an_integer: '1'
+        }
       }
     }
     assert_response :success
@@ -325,7 +345,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "cannot reuse job with find_or_create but excluded version" do
-    post :create, {
+    post :create, params: {
       job: {
         script: "hash",
         script_version: "master",
@@ -367,7 +387,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   test "can reuse a Job based on filters" do
     filters_hash = BASE_FILTERS.
       merge('script_version' => ['in git', 'tag1'])
-    post(:create, {
+    post(:create, params: {
            job: {
              script: "hash",
              script_version: "master",
@@ -393,7 +413,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
     filters += [["script_version", "in git",
                  "31ce37fe365b3dc204300a3e4c396ad333ed0556"],
                 ["script_version", "not in git", ["tag1"]]]
-    post(:create, {
+    post(:create, params: {
            job: {
              script: "hash",
              script_version: "master",
@@ -416,7 +436,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   test "can not reuse a Job based on arbitrary filters" do
     filters_hash = BASE_FILTERS.
       merge("created_at" => ["<", "2010-01-01T00:00:00Z"])
-    post(:create, {
+    post(:create, params: {
            job: {
              script: "hash",
              script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
@@ -437,7 +457,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "can reuse a Job with a Docker image" do
-    post(:create, {
+    post(:create, params: {
            job: {
              script: "hash",
              script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
@@ -467,7 +487,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
               ["=", "4fe459abe02d9b365932b8f5dc419439ab4e2577"],
             "docker_image_locator" =>
               ["in docker", links(:docker_image_collection_hash).name])
-    post(:create, {
+    post(:create, params: {
            job: {
              script: "hash",
              script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
@@ -495,7 +515,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
               ["=", "4fe459abe02d9b365932b8f5dc419439ab4e2577"],
             "docker_image_locator" =>
               ["in docker", links(:docker_image_collection_tag2).name])
-    post(:create, {
+    post(:create, params: {
            job: {
              script: "hash",
              script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
@@ -520,7 +540,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   test "new job with unknown Docker image filter" do
     filters_hash = BASE_FILTERS.
       merge("docker_image_locator" => ["in docker", "_nonesuchname_"])
-    post(:create, {
+    post(:create, params: {
            job: {
              script: "hash",
              script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
@@ -557,7 +577,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   ["repository", "script"].each do |skip_key|
     test "missing #{skip_key} filter raises an error" do
       filters = filters_from_hash(BASE_FILTERS.reject { |k| k == skip_key })
-      post(:create, {
+      post(:create, params: {
              job: {
                script: "hash",
                script_version: "master",
@@ -576,9 +596,11 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "find Job with script version range" do
-    get :index, filters: [["repository", "=", "active/foo"],
-                          ["script", "=", "hash"],
-                          ["script_version", "in git", "tag1"]]
+    get :index, params: {
+      filters: [["repository", "=", "active/foo"],
+                ["script", "=", "hash"],
+                ["script_version", "in git", "tag1"]]
+    }
     assert_response :success
     assert_not_nil assigns(:objects)
     assert_includes(assigns(:objects).map { |job| job.uuid },
@@ -586,9 +608,11 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "find Job with script version range exclusions" do
-    get :index, filters: [["repository", "=", "active/foo"],
-                          ["script", "=", "hash"],
-                          ["script_version", "not in git", "tag1"]]
+    get :index, params: {
+      filters: [["repository", "=", "active/foo"],
+                ["script", "=", "hash"],
+                ["script_version", "not in git", "tag1"]]
+    }
     assert_response :success
     assert_not_nil assigns(:objects)
     refute_includes(assigns(:objects).map { |job| job.uuid },
@@ -596,8 +620,10 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "find Job with Docker image range" do
-    get :index, filters: [["docker_image_locator", "in docker",
-                           "arvados/apitestfixture"]]
+    get :index, params: {
+      filters: [["docker_image_locator", "in docker",
+                 "arvados/apitestfixture"]]
+    }
     assert_response :success
     assert_not_nil assigns(:objects)
     assert_includes(assigns(:objects).map { |job| job.uuid },
@@ -608,7 +634,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
 
   test "find Job with Docker image using reader tokens" do
     authorize_with :inactive
-    get(:index, {
+    get(:index, params: {
           filters: [["docker_image_locator", "in docker",
                      "arvados/apitestfixture"]],
           reader_tokens: [api_token(:active)],
@@ -622,8 +648,10 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "'in docker' filter accepts arrays" do
-    get :index, filters: [["docker_image_locator", "in docker",
-                           ["_nonesuchname_", "arvados/apitestfixture"]]]
+    get :index, params: {
+      filters: [["docker_image_locator", "in docker",
+                ["_nonesuchname_", "arvados/apitestfixture"]]]
+    }
     assert_response :success
     assert_not_nil assigns(:objects)
     assert_includes(assigns(:objects).map { |job| job.uuid },
@@ -633,8 +661,10 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   test "'not in docker' filter accepts arrays" do
-    get :index, filters: [["docker_image_locator", "not in docker",
-                           ["_nonesuchname_", "arvados/apitestfixture"]]]
+    get :index, params: {
+      filters: [["docker_image_locator", "not in docker",
+                ["_nonesuchname_", "arvados/apitestfixture"]]]
+    }
     assert_response :success
     assert_not_nil assigns(:objects)
     assert_includes(assigns(:objects).map { |job| job.uuid },
@@ -668,7 +698,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   def create_job_from(params, start_from)
-    post(:create, create_job_params(params, start_from))
+    post(:create, params: create_job_params(params, start_from))
     assert_response :success
     new_job = assigns(:object)
     assert_not_nil new_job
@@ -688,7 +718,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
   end
 
   def check_errors_from(params, start_from=DEFAULT_START_JOB)
-    post(:create, create_job_params(params, start_from))
+    post(:create, params: create_job_params(params, start_from))
     assert_includes(405..499, @response.code.to_i)
     errors = json_response.fetch("errors", [])
     assert(errors.any?, "no errors assigned from #{params}")
@@ -762,7 +792,7 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
             "docker_image_locator" => ["=", prev_job.docker_image_locator])
     filters_hash.delete("script_version")
     params = create_job_params(filters: filters_from_hash(filters_hash))
-    post(:create, params)
+    post(:create, params: params)
     assert_response :success
     assert_equal(prev_job.uuid, assigns(:object).uuid)
   end
index 5e3d8e1975b35f682d0799a2156c619c4cd4d1c7..fb81f23636c84f79086a88a3a4e00733745b8572 100644 (file)
@@ -11,11 +11,13 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "submit a job" do
     authorize_with :active
-    post :create, job: {
-      script: "hash",
-      script_version: "master",
-      repository: "active/foo",
-      script_parameters: {}
+    post :create, params: {
+      job: {
+        script: "hash",
+        script_version: "master",
+        repository: "active/foo",
+        script_parameters: {}
+      }
     }
     assert_response :success
     assert_not_nil assigns(:object)
@@ -27,17 +29,19 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "normalize output and log uuids when creating job" do
     authorize_with :active
-    post :create, job: {
-      script: "hash",
-      script_version: "master",
-      script_parameters: {},
-      repository: "active/foo",
-      started_at: Time.now,
-      finished_at: Time.now,
-      running: false,
-      success: true,
-      output: 'd41d8cd98f00b204e9800998ecf8427e+0+K@xyzzy',
-      log: 'd41d8cd98f00b204e9800998ecf8427e+0+K@xyzzy'
+    post :create, params: {
+      job: {
+        script: "hash",
+        script_version: "master",
+        script_parameters: {},
+        repository: "active/foo",
+        started_at: Time.now,
+        finished_at: Time.now,
+        running: false,
+        success: true,
+        output: 'd41d8cd98f00b204e9800998ecf8427e+0+K@xyzzy',
+        log: 'd41d8cd98f00b204e9800998ecf8427e+0+K@xyzzy'
+      }
     }
     assert_response :success
     assert_not_nil assigns(:object)
@@ -58,7 +62,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
     new_output = 'd41d8cd98f00b204e9800998ecf8427e+0+K@xyzzy'
     new_log = 'd41d8cd98f00b204e9800998ecf8427e+0+K@xyzzy'
-    put :update, {
+    put :update, params: {
       id: foobar_job['uuid'],
       job: {
         output: new_output,
@@ -84,7 +88,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
     end
 
     authorize_with :active
-    put :update, {
+    put :update, params: {
       id: jobs(:running).uuid,
       job: {
         cancelled_at: 4.day.ago
@@ -124,7 +128,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
       end
 
       authorize_with :active
-      self.send http_method, action, { id: jobs(:cancelled).uuid }.merge(params)
+      self.send http_method, action, params: { id: jobs(:cancelled).uuid }.merge(params)
       assert_response expected_response
       if expected_response == :success
         job = json_response
@@ -145,7 +149,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
     end
 
     authorize_with :active
-    put :update, {
+    put :update, params: {
       id: jobs(:running_cancelled).uuid,
       job: {
         cancelled_at: nil
@@ -157,7 +161,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
   ['abc.py', 'hash.py'].each do |script|
     test "update job script attribute to #{script} without failing script_version check" do
       authorize_with :admin
-      put :update, {
+      put :update, params: {
         id: jobs(:uses_nonexistent_script_version).uuid,
         job: {
           script: script
@@ -171,7 +175,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "search jobs by uuid with >= query" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['uuid', '>=', 'zzzzz-8i9sb-pshmckwoma9plh7']]
     }
     assert_response :success
@@ -182,7 +186,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "search jobs by uuid with <= query" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['uuid', '<=', 'zzzzz-8i9sb-pshmckwoma9plh7']]
     }
     assert_response :success
@@ -193,7 +197,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "search jobs by uuid with >= and <= query" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['uuid', '>=', 'zzzzz-8i9sb-pshmckwoma9plh7'],
               ['uuid', '<=', 'zzzzz-8i9sb-pshmckwoma9plh7']]
     }
@@ -204,7 +208,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "search jobs by uuid with < query" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['uuid', '<', 'zzzzz-8i9sb-pshmckwoma9plh7']]
     }
     assert_response :success
@@ -215,7 +219,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "search jobs by uuid with like query" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['uuid', 'like', '%hmckwoma9pl%']]
     }
     assert_response :success
@@ -225,7 +229,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "search jobs by uuid with 'in' query" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['uuid', 'in', ['zzzzz-8i9sb-4cf0nhn6xte809j',
                                 'zzzzz-8i9sb-pshmckwoma9plh7']]]
     }
@@ -239,7 +243,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
     exclude_uuids = [jobs(:running).uuid,
                      jobs(:running_cancelled).uuid]
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['uuid', 'not in', exclude_uuids]]
     }
     assert_response :success
@@ -254,7 +258,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
      ['output', nil]].each do |attr, operand|
       test "search jobs with #{attr} #{operator} #{operand.inspect} query" do
         authorize_with :active
-        get :index, {
+        get :index, params: {
           filters: [[attr, operator, operand]]
         }
         assert_response :success
@@ -271,7 +275,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "search jobs by started_at with < query" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['started_at', '<', Time.now.to_s]]
     }
     assert_response :success
@@ -281,7 +285,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "search jobs by started_at with > query" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['started_at', '>', Time.now.to_s]]
     }
     assert_response :success
@@ -290,7 +294,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "search jobs by started_at with >= query on metric date" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['started_at', '>=', '2014-01-01']]
     }
     assert_response :success
@@ -300,7 +304,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "search jobs by started_at with >= query on metric date and time" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['started_at', '>=', '2014-01-01 01:23:45']]
     }
     assert_response :success
@@ -310,7 +314,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "search jobs with 'any' operator" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       where: { any: ['contains', 'pshmckw'] }
     }
     assert_response :success
@@ -321,7 +325,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "search jobs by nonexistent column with < query" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['is_borked', '<', 'fizzbuzz']]
     }
     assert_response 422
@@ -329,7 +333,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "finish a job" do
     authorize_with :active
-    put :update, {
+    put :update, params: {
       id: jobs(:nearly_finished_job).uuid,
       job: {
         output: '551392cc37a317abf865b95f66f4ef94+101',
@@ -354,7 +358,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "get job queue as with a = filter" do
     authorize_with :admin
-    get :queue, { filters: [['script','=','foo']] }
+    get :queue, params: { filters: [['script','=','foo']] }
     assert_response :success
     assert_equal ['foo'], assigns(:objects).collect(&:script).uniq
     assert_equal 0, assigns(:objects)[0].queue_position
@@ -362,7 +366,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "get job queue as with a != filter" do
     authorize_with :admin
-    get :queue, { filters: [['script','!=','foo']] }
+    get :queue, params: { filters: [['script','!=','foo']] }
     assert_response :success
     assert_equal 0, assigns(:objects).count
   end
@@ -378,14 +382,14 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "job includes assigned nodes" do
     authorize_with :active
-    get :show, {id: jobs(:nearly_finished_job).uuid}
+    get :show, params: {id: jobs(:nearly_finished_job).uuid}
     assert_response :success
     assert_equal([nodes(:busy).uuid], json_response["node_uuids"])
   end
 
   test "job lock success" do
     authorize_with :active
-    post :lock, {id: jobs(:queued).uuid}
+    post :lock, params: {id: jobs(:queued).uuid}
     assert_response :success
     job = Job.where(uuid: jobs(:queued).uuid).first
     assert_equal "Running", job.state
@@ -393,7 +397,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test "job lock conflict" do
     authorize_with :active
-    post :lock, {id: jobs(:running).uuid}
+    post :lock, params: {id: jobs(:running).uuid}
     assert_response 422 # invalid state transition
   end
 
@@ -401,11 +405,13 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
     authorize_with :active
     url = "http://localhost:1/fake/fake.git"
     fetch_remote_from_local_repo url, :foo
-    post :create, job: {
-      script: "hash",
-      script_version: "abc123",
-      repository: url,
-      script_parameters: {}
+    post :create, params: {
+      job: {
+        script: "hash",
+        script_version: "abc123",
+        repository: url,
+        script_parameters: {}
+      }
     }
     assert_response 422
   end
@@ -414,11 +420,13 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
     authorize_with :active
     url = "http://localhost:1/fake/fake.git"
     fetch_remote_from_local_repo url, :foo
-    post :create, job: {
-      script: "hash",
-      script_version: "master",
-      repository: url,
-      script_parameters: {}
+    post :create, params: {
+      job: {
+        script: "hash",
+        script_version: "master",
+        repository: url,
+        script_parameters: {}
+      }
     }
     assert_response :success
     assert_equal('077ba2ad3ea24a929091a9e6ce545c93199b8e57',
@@ -427,11 +435,13 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test 'tag local commit in internal repository' do
     authorize_with :active
-    post :create, job: {
-      script: "hash",
-      script_version: "master",
-      repository: "active/foo",
-      script_parameters: {}
+    post :create, params: {
+      job: {
+        script: "hash",
+        script_version: "master",
+        repository: "active/foo",
+        script_parameters: {}
+      }
     }
     assert_response :success
     assert_equal('077ba2ad3ea24a929091a9e6ce545c93199b8e57',
@@ -440,7 +450,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
 
   test 'get job with components' do
     authorize_with :active
-    get :show, {id: jobs(:running_job_with_components).uuid}
+    get :show, params: {id: jobs(:running_job_with_components).uuid}
     assert_response :success
     assert_not_nil json_response["components"]
     assert_equal ["component1", "component2"], json_response["components"].keys
@@ -453,7 +463,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
   ].each do |user, expected|
     test "add components to job locked by active user as #{user} user and expect #{expected}" do
       authorize_with user
-      put :update, {
+      put :update, params: {
         id: jobs(:running).uuid,
         job: {
           components: {"component1" => "value1", "component2" => "value2"}
@@ -469,59 +479,17 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
     end
   end
 
-  test 'get_delete components_get again for job with components' do
-    authorize_with :active
-    get :show, {id: jobs(:running_job_with_components).uuid}
-    assert_response :success
-    assert_not_nil json_response["components"]
-    assert_equal ["component1", "component2"], json_response["components"].keys
-
-    # delete second component
-    @test_counter = 0  # Reset executed action counter
-    @controller = Arvados::V1::JobsController.new
-    put :update, {
-      id: jobs(:running_job_with_components).uuid,
-      job: {
-        components: {"component1" => "zzzzz-8i9sb-jobuuid00000001"}
-      }
-    }
-    assert_response :success
-
-    @test_counter = 0  # Reset executed action counter
-    @controller = Arvados::V1::JobsController.new
-    get :show, {id: jobs(:running_job_with_components).uuid}
-    assert_response :success
-    assert_not_nil json_response["components"]
-    assert_equal ["component1"], json_response["components"].keys
-
-    # delete all components
-    @test_counter = 0  # Reset executed action counter
-    @controller = Arvados::V1::JobsController.new
-    put :update, {
-      id: jobs(:running_job_with_components).uuid,
-      job: {
-        components: {}
-      }
-    }
-    assert_response :success
-
-    @test_counter = 0  # Reset executed action counter
-    @controller = Arvados::V1::JobsController.new
-    get :show, {id: jobs(:running_job_with_components).uuid}
-    assert_response :success
-    assert_not_nil json_response["components"]
-    assert_equal [], json_response["components"].keys
-  end
-
   test 'jobs.create disabled in config' do
     Rails.configuration.disable_api_methods = ["jobs.create",
                                                "pipeline_instances.create"]
     authorize_with :active
-    post :create, job: {
-      script: "hash",
-      script_version: "master",
-      repository: "active/foo",
-      script_parameters: {}
+    post :create, params: {
+      job: {
+        script: "hash",
+        script_version: "master",
+        repository: "active/foo",
+        script_parameters: {}
+      }
     }
     assert_response 404
   end
index c5bff7b0ccc6597055f00591a7f9323d60fc0e7f..9da9d01631b820517caabf5bda2229b7666e3d6e 100644 (file)
@@ -12,7 +12,7 @@ class Arvados::V1::KeepDisksControllerTest < ActionController::TestCase
 
   test "add keep disk with admin token" do
     authorize_with :admin
-    post :ping, default_ping_opts.
+    post :ping, params: default_ping_opts.
       merge(filesystem_uuid: 'eb1e77a1-db84-4193-b6e6-ca2894f67d5f')
     assert_response :success
     assert_not_nil assigns(:object)
@@ -28,19 +28,19 @@ class Arvados::V1::KeepDisksControllerTest < ActionController::TestCase
   ].each do |opts|
     test "add keep disk with[out] filesystem_uuid #{opts}" do
       authorize_with :admin
-      post :ping, default_ping_opts.merge(opts)
+      post :ping, params: default_ping_opts.merge(opts)
       assert_response :success
       assert_not_nil JSON.parse(@response.body)['uuid']
     end
   end
 
   test "refuse to add keep disk without admin token" do
-    post :ping, default_ping_opts
+    post :ping, params: default_ping_opts
     assert_response 404
   end
 
   test "ping keep disk" do
-    post :ping, default_ping_opts.
+    post :ping, params: default_ping_opts.
       merge(id: keep_disks(:nonfull).uuid,
             ping_secret: keep_disks(:nonfull).ping_secret,
             filesystem_uuid: keep_disks(:nonfull).filesystem_uuid)
@@ -92,13 +92,11 @@ class Arvados::V1::KeepDisksControllerTest < ActionController::TestCase
 
   test "search keep_services with 'any' operator" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       where: { any: ['contains', 'o2t1q5w'] }
     }
     assert_response :success
     found = assigns(:objects).collect(&:uuid)
     assert_equal true, !!found.index('zzzzz-penuu-5w2o2t1q5wy7fhn')
   end
-
-
 end
index d571610fc2a9b246626ece2a0ba92aa99a396cb4..41554be87507ba19d9ed8edc40a8a1e2db6f0bad 100644 (file)
@@ -8,7 +8,7 @@ class Arvados::V1::KeepServicesControllerTest < ActionController::TestCase
 
   test "search by service_port with < query" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['service_port', '<', 25107]]
     }
     assert_response :success
@@ -17,7 +17,7 @@ class Arvados::V1::KeepServicesControllerTest < ActionController::TestCase
 
   test "search by service_port with >= query" do
     authorize_with :active
-    get :index, {
+    get :index, params: {
       filters: [['service_port', '>=', 25107]]
     }
     assert_response :success
index 47e46fe8378410f0804b21b9ca0d079788928e6c..8f1d37224f7e25c689a071274652b2a7e12db8e4 100644 (file)
@@ -17,9 +17,9 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
       }
       authorize_with :admin
       if formatted_link == 'link_json'
-        post :create, link: link.to_json
+        post :create, params: {link: link.to_json}
       else
-        post :create, link: link
+        post :create, params: {link: link}
       end
       assert_response :success
       assert_not_nil assigns(:object)
@@ -32,7 +32,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
     {nil: nil, bogus: 2.days.ago}.each do |bogustype, bogusvalue|
       test "cannot set #{bogustype} #{attr} in create" do
         authorize_with :active
-        post :create, {
+        post :create, params: {
           link: {
             properties: {},
             link_class: 'test',
@@ -46,7 +46,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
       test "cannot set #{bogustype} #{attr} in update" do
         really_created_at = links(:test_timestamps).created_at
         authorize_with :active
-        put :update, {
+        put :update, params: {
           id: links(:test_timestamps).uuid,
           link: {
             :properties => {test: 'test'},
@@ -73,7 +73,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
       head_uuid: 'zzzzz-tpzed-xyzxyzxerrrorxx'
     }
     authorize_with :admin
-    post :create, link: link
+    post :create, params: {link: link}
     assert_response 422
   end
 
@@ -85,7 +85,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
       tail_uuid: 'zzzzz-tpzed-xyzxyzxerrrorxx'
     }
     authorize_with :admin
-    post :create, link: link
+    post :create, params: {link: link}
     assert_response 422
   end
 
@@ -97,7 +97,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
       tail_uuid: users(:spectator).uuid,
     }
     authorize_with :admin
-    post :create, link: link
+    post :create, params: {link: link}
     assert_response :success
     l = JSON.parse(@response.body)
     assert 'arvados#user', l['head_kind']
@@ -114,7 +114,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
       tail_kind: "arvados#user",
     }
     authorize_with :admin
-    post :create, link: link
+    post :create, params: {link: link}
     assert_response :success
     l = JSON.parse(@response.body)
     assert 'arvados#user', l['head_kind']
@@ -129,13 +129,13 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
       tail_uuid: authorized_keys(:admin).uuid,
     }
     authorize_with :active
-    post :create, link: link
+    post :create, params: {link: link}
     assert_response 422
   end
 
   test "filter links with 'is_a' operator" do
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['tail_uuid', 'is_a', 'arvados#user'] ]
     }
     assert_response :success
@@ -146,7 +146,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
 
   test "filter links with 'is_a' operator includes remote objects" do
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [
         ['tail_uuid', 'is_a', 'arvados#user'],
         ['link_class', '=', 'permission'],
@@ -163,7 +163,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
 
   test "filter links with 'is_a' operator with more than one" do
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['tail_uuid', 'is_a', ['arvados#user', 'arvados#group'] ] ],
     }
     assert_response :success
@@ -177,7 +177,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
 
   test "filter links with 'is_a' operator with bogus type" do
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['tail_uuid', 'is_a', ['arvados#bogus'] ] ],
     }
     assert_response :success
@@ -187,7 +187,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
 
   test "filter links with 'is_a' operator with collection" do
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['head_uuid', 'is_a', ['arvados#collection'] ] ],
     }
     assert_response :success
@@ -198,7 +198,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
 
   test "test can still use where tail_kind" do
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       where: { tail_kind: 'arvados#user' }
     }
     assert_response :success
@@ -209,7 +209,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
 
   test "test can still use where head_kind" do
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       where: { head_kind: 'arvados#user' }
     }
     assert_response :success
@@ -220,7 +220,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
 
   test "test can still use filter tail_kind" do
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['tail_kind', '=', 'arvados#user'] ]
     }
     assert_response :success
@@ -231,7 +231,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
 
   test "test can still use filter head_kind" do
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['head_kind', '=', 'arvados#user'] ]
     }
     assert_response :success
@@ -250,7 +250,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
       tail_kind: "arvados#user",
     }
     authorize_with :admin
-    post :create, link: link
+    post :create, params: {link: link}
     assert_response 422
   end
 
@@ -264,7 +264,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
       tail_kind: "arvados#user",
     }
     authorize_with :admin
-    post :create, link: link
+    post :create, params: {link: link}
     assert_response 422
   end
 
@@ -279,7 +279,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
       properties: {username: "repo_and_user_name"}
     }
     authorize_with :admin
-    post :create, link: link
+    post :create, params: {link: link}
     assert_response 422
   end
 
@@ -294,14 +294,14 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
       properties: {username: "repo_and_user_name"}
     }
     authorize_with :admin
-    post :create, link: link
+    post :create, params: {link: link}
     assert_response :success
   end
 
   test "project owner can show a project permission" do
     uuid = links(:project_viewer_can_read_project).uuid
     authorize_with :active
-    get :show, id: uuid
+    get :show, params: {id: uuid}
     assert_response :success
     assert_equal(uuid, assigns(:object).andand.uuid)
   end
@@ -309,20 +309,20 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
   test "admin can show a project permission" do
     uuid = links(:project_viewer_can_read_project).uuid
     authorize_with :admin
-    get :show, id: uuid
+    get :show, params: {id: uuid}
     assert_response :success
     assert_equal(uuid, assigns(:object).andand.uuid)
   end
 
   test "project viewer can't show others' project permissions" do
     authorize_with :project_viewer
-    get :show, id: links(:admin_can_write_aproject).uuid
+    get :show, params: {id: links(:admin_can_write_aproject).uuid}
     assert_response 404
   end
 
   test "requesting a nonexistent link returns 404" do
     authorize_with :active
-    get :show, id: 'zzzzz-zzzzz-zzzzzzzzzzzzzzz'
+    get :show, params: {id: 'zzzzz-zzzzz-zzzzzzzzzzzzzzz'}
     assert_response 404
   end
 
@@ -337,8 +337,10 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
     # It is possible to retrieve the full set of permissions for a
     # single object via /arvados/v1/permissions.
     authorize_with :active
-    get :index, filters: [['link_class', '=', 'permission'],
-                          ['head_uuid', '=', groups(:aproject).uuid]]
+    get :index, params: {
+      filters: [['link_class', '=', 'permission'],
+                ['head_uuid', '=', groups(:aproject).uuid]]
+    }
     assert_response :success
     assert_not_nil assigns(:objects)
     assert_includes(assigns(:objects).map(&:uuid),
@@ -347,8 +349,10 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
 
   test "admin can index project permissions" do
     authorize_with :admin
-    get :index, filters: [['link_class', '=', 'permission'],
-                          ['head_uuid', '=', groups(:aproject).uuid]]
+    get :index, params: {
+      filters: [['link_class', '=', 'permission'],
+                ['head_uuid', '=', groups(:aproject).uuid]]
+    }
     assert_response :success
     assert_not_nil assigns(:objects)
     assert_includes(assigns(:objects).map(&:uuid),
@@ -357,9 +361,11 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
 
   test "project viewer can't index others' project permissions" do
     authorize_with :project_viewer
-    get :index, filters: [['link_class', '=', 'permission'],
-                          ['head_uuid', '=', groups(:aproject).uuid],
-                          ['tail_uuid', '!=', users(:project_viewer).uuid]]
+    get :index, params: {
+      filters: [['link_class', '=', 'permission'],
+                ['head_uuid', '=', groups(:aproject).uuid],
+                ['tail_uuid', '!=', users(:project_viewer).uuid]]
+    }
     assert_response :success
     assert_not_nil assigns(:objects)
     assert_empty assigns(:objects)
@@ -371,7 +377,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
 
     refute users(:user_bar_in_sharing_group).can?(read: collections(:collection_owned_by_foo).uuid)
 
-    post :create, {
+    post :create, params: {
       link: {
         tail_uuid: users(:user_bar_in_sharing_group).uuid,
         link_class: 'permission',
index 49fda474d8f6b78e8bcb452c4b34b162eb1bdb55..4d4d4dabb82f9d94659627db7a362f9d5e58415f 100644 (file)
@@ -9,7 +9,7 @@ class Arvados::V1::LogsControllerTest < ActionController::TestCase
 
   test "non-admins can create their own logs" do
     authorize_with :active
-    post :create, log: {summary: 'test log'}
+    post :create, params: {log: {summary: 'test log'}}
     assert_response :success
     resp = assigns(:object)
     assert_not_nil resp.uuid
@@ -19,7 +19,7 @@ class Arvados::V1::LogsControllerTest < ActionController::TestCase
   test "non-admins can read their own logs" do
     authorize_with :active
     my_log = logs(:log_owned_by_active)
-    get :show, {id: my_log[:uuid]}
+    get :show, params: {id: my_log[:uuid]}
     assert_response(:success, "failed to get log")
     resp = assigns(:object)
     assert_equal(my_log[:summary], resp.summary, "got wrong log")
@@ -27,7 +27,7 @@ class Arvados::V1::LogsControllerTest < ActionController::TestCase
 
   test "test can still use where object_kind" do
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       where: { object_kind: 'arvados#user' }
     }
     assert_response :success
@@ -40,7 +40,7 @@ class Arvados::V1::LogsControllerTest < ActionController::TestCase
 
   test "test can still use filter object_kind" do
     authorize_with :admin
-    get :index, {
+    get :index, params: {
       filters: [ ['object_kind', '=', 'arvados#user'] ]
     }
     assert_response :success
index dc8b3acdd7de02c83f0a668426bcf63a078c5111..0beff6882acc1b688614097891ef1f655efa1948 100644 (file)
@@ -46,7 +46,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
   end
 
   test "node should ping with ping_secret and no token" do
-    post :ping, {
+    post :ping, params: {
       id: 'zzzzz-7ekkf-2z3mc76g2q73aio',
       instance_id: 'i-0000000',
       local_ipv4: '172.17.2.174',
@@ -62,7 +62,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
   end
 
   test "node should fail ping with invalid ping_secret" do
-    post :ping, {
+    post :ping, params: {
       id: 'zzzzz-7ekkf-2z3mc76g2q73aio',
       instance_id: 'i-0000000',
       local_ipv4: '172.17.2.174',
@@ -73,7 +73,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
 
   test "create node" do
     authorize_with :admin
-    post :create, {node: {}}
+    post :create, params: {node: {}}
     assert_response :success
     assert_not_nil json_response['uuid']
     assert_not_nil json_response['info'].is_a? Hash
@@ -84,7 +84,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
 
   test "create node and assign slot" do
     authorize_with :admin
-    post :create, {node: {}, assign_slot: true}
+    post :create, params: {node: {}, assign_slot: true}
     assert_response :success
     assert_not_nil json_response['uuid']
     assert_not_nil json_response['info'].is_a? Hash
@@ -101,7 +101,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
   test "update node and assign slot" do
     authorize_with :admin
     node = nodes(:new_with_no_hostname)
-    post :update, {id: node.uuid, node: {}, assign_slot: true}
+    post :update, params: {id: node.uuid, node: {}, assign_slot: true}
     assert_response :success
     assert_operator 0, :<, json_response['slot_number']
     n = json_response['slot_number']
@@ -115,7 +115,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
   test "update node and assign slot, don't clobber hostname" do
     authorize_with :admin
     node = nodes(:new_with_custom_hostname)
-    post :update, {id: node.uuid, node: {}, assign_slot: true}
+    post :update, params: {id: node.uuid, node: {}, assign_slot: true}
     assert_response :success
     assert_operator 0, :<, json_response['slot_number']
     n = json_response['slot_number']
@@ -125,7 +125,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
   test "ping adds node stats to info" do
     authorize_with :admin
     node = nodes(:idle)
-    post :ping, {
+    post :ping, params: {
       id: node.uuid,
       ping_secret: node.info['ping_secret'],
       total_cpu_cores: 32,
@@ -143,14 +143,14 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
 
   test "active user can see their assigned job" do
     authorize_with :active
-    get :show, {id: nodes(:busy).uuid}
+    get :show, params: {id: nodes(:busy).uuid}
     assert_response :success
     assert_equal(jobs(:nearly_finished_job).uuid, json_response["job_uuid"])
   end
 
   test "user without job read permission can't see job" do
     authorize_with :spectator
-    get :show, {id: nodes(:busy).uuid}
+    get :show, params: {id: nodes(:busy).uuid}
     assert_response :success
     assert_nil(json_response["job"], "spectator can see node's assigned job")
   end
@@ -158,7 +158,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
   [:admin, :spectator].each do |user|
     test "select param does not break node list for #{user}" do
       authorize_with user
-      get :index, {select: ['domain']}
+      get :index, params: {select: ['domain']}
       assert_response :success
       assert_operator 0, :<, json_response['items_available']
     end
@@ -168,7 +168,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
     changed_node = nodes(:idle)
     assigned_job = jobs(:queued)
     authorize_with :admin
-    post :update, {
+    post :update, params: {
       id: changed_node.uuid,
       node: {job_uuid: assigned_job.uuid},
     }
@@ -181,7 +181,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
 
   test "non-admin can't associate a job with a node" do
     authorize_with :active
-    post :update, {
+    post :update, params: {
       id: nodes(:idle).uuid,
       node: {job_uuid: jobs(:queued).uuid},
     }
@@ -191,7 +191,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
   test "admin can unassign a job from a node" do
     changed_node = nodes(:busy)
     authorize_with :admin
-    post :update, {
+    post :update, params: {
       id: changed_node.uuid,
       node: {job_uuid: nil},
     }
@@ -204,7 +204,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
 
   test "non-admin can't unassign a job from a node" do
     authorize_with :project_viewer
-    post :update, {
+    post :update, params: {
       id: nodes(:busy).uuid,
       node: {job_uuid: nil},
     }
@@ -213,7 +213,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
 
   test "job readable after updating other attributes" do
     authorize_with :admin
-    post :update, {
+    post :update, params: {
       id: nodes(:busy).uuid,
       node: {last_ping_at: 1.second.ago},
     }
@@ -224,7 +224,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
 
   test "node should fail ping with invalid hostname config format" do
     Rails.configuration.assign_node_hostname = 'compute%<slot_number>04'  # should end with "04d"
-    post :ping, {
+    post :ping, params: {
       id: nodes(:new_with_no_hostname).uuid,
       ping_secret: nodes(:new_with_no_hostname).info['ping_secret'],
     }
@@ -232,7 +232,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
   end
 
   test "first ping should set ip addr using local_ipv4 when provided" do
-    post :ping, {
+    post :ping, params: {
       id: 'zzzzz-7ekkf-nodenoipaddryet',
       instance_id: 'i-0000000',
       local_ipv4: '172.17.2.172',
@@ -245,7 +245,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
   end
 
   test "first ping should set ip addr using remote_ip when local_ipv4 is not provided" do
-    post :ping, {
+    post :ping, params: {
       id: 'zzzzz-7ekkf-nodenoipaddryet',
       instance_id: 'i-0000000',
       ping_secret: 'abcdyefg4lb5q4gzqqtrnq30oyj08r8dtdimmanbqw49z1anz2'
@@ -257,7 +257,7 @@ class Arvados::V1::NodesControllerTest < ActionController::TestCase
   end
 
   test "future pings should not change previous ip address" do
-    post :ping, {
+    post :ping, params: {
       id: 'zzzzz-7ekkf-2z3mc76g2q73aio',
       instance_id: 'i-0000000',
       local_ipv4: '172.17.2.175',
index e6b4bfea78ad3c0092453777d594f489dbcb99c7..a76151150fe873b950aaaf72bcd1ac403c1cbc54 100644 (file)
@@ -8,7 +8,7 @@ class Arvados::V1::PipelineInstancesControllerTest < ActionController::TestCase
 
   test 'create pipeline with components copied from template' do
     authorize_with :active
-    post :create, {
+    post :create, params: {
       pipeline_instance: {
         pipeline_template_uuid: pipeline_templates(:two_part).uuid
       }
@@ -20,7 +20,7 @@ class Arvados::V1::PipelineInstancesControllerTest < ActionController::TestCase
 
   test 'create pipeline with no template' do
     authorize_with :active
-    post :create, {
+    post :create, params: {
       pipeline_instance: {
         components: {}
       }
@@ -37,7 +37,7 @@ class Arvados::V1::PipelineInstancesControllerTest < ActionController::TestCase
       authorize_with :active
       pi_uuid = pipeline_instances(:job_child_pipeline_with_components_at_level_2).uuid
 
-      post :cancel, {id: pi_uuid, cascade: cascade}
+      post :cancel, params: {id: pi_uuid, cascade: cascade}
       assert_response :success
 
       pi = PipelineInstance.where(uuid: pi_uuid).first
index 2931a380927a22da94a8a01da30f7a36bf57e392..dfa3b7fe778f4c56c897fd4d60e9816e579751ae 100644 (file)
@@ -8,7 +8,7 @@ class Arvados::V1::QueryTest < ActionController::TestCase
   test 'no fallback orders when order is unambiguous' do
     @controller = Arvados::V1::LogsController.new
     authorize_with :active
-    get :index, {
+    get :index, params: {
       order: ['id asc'],
       controller: 'logs',
     }
@@ -19,7 +19,7 @@ class Arvados::V1::QueryTest < ActionController::TestCase
   test 'fallback orders when order is ambiguous' do
     @controller = Arvados::V1::LogsController.new
     authorize_with :active
-    get :index, {
+    get :index, params: {
       order: ['event_type asc'],
       controller: 'logs',
     }
@@ -31,7 +31,7 @@ class Arvados::V1::QueryTest < ActionController::TestCase
   test 'skip fallback orders already given by client' do
     @controller = Arvados::V1::LogsController.new
     authorize_with :active
-    get :index, {
+    get :index, params: {
       order: ['modified_at asc'],
       controller: 'logs',
     }
@@ -43,7 +43,7 @@ class Arvados::V1::QueryTest < ActionController::TestCase
   test 'eliminate superfluous orders' do
     @controller = Arvados::V1::LogsController.new
     authorize_with :active
-    get :index, {
+    get :index, params: {
       order: ['logs.modified_at asc',
               'modified_at desc',
               'event_type desc',
@@ -58,7 +58,7 @@ class Arvados::V1::QueryTest < ActionController::TestCase
   test 'eliminate orders after the first unique column' do
     @controller = Arvados::V1::LogsController.new
     authorize_with :active
-    get :index, {
+    get :index, params: {
       order: ['event_type asc',
               'id asc',
               'uuid asc',
@@ -73,7 +73,7 @@ class Arvados::V1::QueryTest < ActionController::TestCase
   test 'do not count items_available if count=none' do
     @controller = Arvados::V1::LinksController.new
     authorize_with :active
-    get :index, {
+    get :index, params: {
       count: 'none',
     }
     assert_response(:success)
@@ -84,7 +84,7 @@ class Arvados::V1::QueryTest < ActionController::TestCase
     test "count items_available if params=#{params.inspect}" do
       @controller = Arvados::V1::LinksController.new
       authorize_with :active
-      get :index, params
+      get :index, params: params
       assert_response(:success)
       assert_operator(json_response['items_available'], :>, 0)
     end
@@ -93,7 +93,7 @@ class Arvados::V1::QueryTest < ActionController::TestCase
   test 'error if count=bogus' do
     @controller = Arvados::V1::LinksController.new
     authorize_with :active
-    get :index, {
+    get :index, params: {
       count: 'bogus',
     }
     assert_response(422)
index 22548b6d8c285817fe8d6c2df1a6962b96edc170..b810d69939b30208a1f944981e53bd6ad995fbe3 100644 (file)
@@ -230,7 +230,7 @@ class Arvados::V1::RepositoriesControllerTest < ActionController::TestCase
 
   test "select push_url in index" do
     authorize_with :active
-    get(:index, {select: ["uuid", "push_url"]})
+    get(:index, params: {select: ["uuid", "push_url"]})
     assert_response :success
     assert_includes(json_response["items"].map { |r| r["push_url"] },
                     "git@git.zzzzz.arvadosapi.com:active/foo.git")
@@ -238,7 +238,7 @@ class Arvados::V1::RepositoriesControllerTest < ActionController::TestCase
 
   test "select clone_urls in index" do
     authorize_with :active
-    get(:index, {select: ["uuid", "clone_urls"]})
+    get(:index, params: {select: ["uuid", "clone_urls"]})
     assert_response :success
     assert_includes(json_response["items"].map { |r| r["clone_urls"] }.flatten,
                     "git@git.zzzzz.arvadosapi.com:active/foo.git")
index 728a2a1fa2abc9c1261c64a7fddf077dc6747446..22a44a97ab1bd33ee27da724e1a01665ae8fa06d 100644 (file)
@@ -17,7 +17,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
   test "activate a user after signing UA" do
     authorize_with :inactive_but_signed_user_agreement
-    post :activate, id: users(:inactive_but_signed_user_agreement).uuid
+    post :activate, params: {id: users(:inactive_but_signed_user_agreement).uuid}
     assert_response :success
     assert_not_nil assigns(:object)
     me = JSON.parse(@response.body)
@@ -49,7 +49,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     authorize_with :inactive
     assert_equal false, users(:inactive).is_active
 
-    post :activate, id: users(:inactive).uuid
+    post :activate, params: {id: users(:inactive).uuid}
     assert_response 403
 
     resp = json_response
@@ -59,7 +59,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
   test "activate an already-active user" do
     authorize_with :active
-    post :activate, id: users(:active).uuid
+    post :activate, params: {id: users(:active).uuid}
     assert_response :success
     me = JSON.parse(@response.body)
     assert_equal true, me['is_active']
@@ -73,10 +73,12 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
   test "create new user with user as input" do
     authorize_with :admin
-    post :create, user: {
-      first_name: "test_first_name",
-      last_name: "test_last_name",
-      email: "foo@example.com"
+    post :create, params: {
+      user: {
+        first_name: "test_first_name",
+        last_name: "test_last_name",
+        email: "foo@example.com"
+      }
     }
     assert_response :success
     created = JSON.parse(@response.body)
@@ -90,7 +92,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     authorize_with :admin
     repo_name = 'usertestrepo'
 
-    post :setup, {
+    post :setup, params: {
       repo_name: repo_name,
       openid_prefix: 'https://www.google.com/accounts/o8/id',
       user: {
@@ -132,7 +134,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "setup user with bogus uuid and expect error" do
     authorize_with :admin
 
-    post :setup, {
+    post :setup, params: {
       uuid: 'bogus_uuid',
       repo_name: 'usertestrepo',
       vm_uuid: @vm_uuid
@@ -146,7 +148,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "setup user with bogus uuid in user and expect error" do
     authorize_with :admin
 
-    post :setup, {
+    post :setup, params: {
       user: {uuid: 'bogus_uuid'},
       repo_name: 'usertestrepo',
       vm_uuid: @vm_uuid,
@@ -162,7 +164,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "setup user with no uuid and user, expect error" do
     authorize_with :admin
 
-    post :setup, {
+    post :setup, params: {
       repo_name: 'usertestrepo',
       vm_uuid: @vm_uuid,
       openid_prefix: 'https://www.google.com/accounts/o8/id'
@@ -177,7 +179,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "setup user with no uuid and email, expect error" do
     authorize_with :admin
 
-    post :setup, {
+    post :setup, params: {
       user: {},
       repo_name: 'usertestrepo',
       vm_uuid: @vm_uuid,
@@ -194,7 +196,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     authorize_with :admin
     inactive_user = users(:inactive)
 
-    post :setup, {
+    post :setup, params: {
       uuid: users(:inactive).uuid,
       repo_name: 'usertestrepo',
       vm_uuid: @vm_uuid
@@ -222,7 +224,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     authorize_with :admin
     inactive_user = users(:inactive)
 
-    post :setup, {
+    post :setup, params: {
       uuid: inactive_user['uuid'],
       user: {email: 'junk_email'}
     }
@@ -241,7 +243,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "setup user with valid email and repo as input" do
     authorize_with :admin
 
-    post :setup, {
+    post :setup, params: {
       repo_name: 'usertestrepo',
       user: {email: 'foo@example.com'},
       openid_prefix: 'https://www.google.com/accounts/o8/id'
@@ -260,7 +262,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "setup user with fake vm and expect error" do
     authorize_with :admin
 
-    post :setup, {
+    post :setup, params: {
       repo_name: 'usertestrepo',
       vm_uuid: 'no_such_vm',
       user: {email: 'foo@example.com'},
@@ -277,7 +279,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "setup user with valid email, repo and real vm as input" do
     authorize_with :admin
 
-    post :setup, {
+    post :setup, params: {
       repo_name: 'usertestrepo',
       openid_prefix: 'https://www.google.com/accounts/o8/id',
       vm_uuid: @vm_uuid,
@@ -297,7 +299,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "setup user with valid email, no vm and no repo as input" do
     authorize_with :admin
 
-    post :setup, {
+    post :setup, params: {
       user: {email: 'foo@example.com'},
       openid_prefix: 'https://www.google.com/accounts/o8/id'
     }
@@ -327,7 +329,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "setup user with email, first name, repo name and vm uuid" do
     authorize_with :admin
 
-    post :setup, {
+    post :setup, params: {
       openid_prefix: 'https://www.google.com/accounts/o8/id',
       repo_name: 'usertestrepo',
       vm_uuid: @vm_uuid,
@@ -353,7 +355,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     authorize_with :admin
     inactive_user = users(:inactive)
 
-    post :setup, {
+    post :setup, params: {
       openid_prefix: 'https://www.google.com/accounts/o8/id',
       repo_name: 'usertestrepo',
       user: {
@@ -375,7 +377,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "setup user with openid prefix" do
     authorize_with :admin
 
-    post :setup, {
+    post :setup, params: {
       repo_name: 'usertestrepo',
       openid_prefix: 'http://www.example.com/account',
       user: {
@@ -415,7 +417,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "invoke setup with no openid prefix, expect error" do
     authorize_with :admin
 
-    post :setup, {
+    post :setup, params: {
       repo_name: 'usertestrepo',
       user: {
         first_name: "in_create_test_first_name",
@@ -434,7 +436,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "setup user with user, vm and repo and verify links" do
     authorize_with :admin
 
-    post :setup, {
+    post :setup, params: {
       user: {
         first_name: "in_create_test_first_name",
         last_name: "test_last_name",
@@ -475,7 +477,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "create user as non admin user and expect error" do
     authorize_with :active
 
-    post :create, {
+    post :create, params: {
       user: {email: 'foo@example.com'}
     }
 
@@ -489,7 +491,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "setup user as non admin user and expect error" do
     authorize_with :active
 
-    post :setup, {
+    post :setup, params: {
       openid_prefix: 'https://www.google.com/accounts/o8/id',
       user: {email: 'foo@example.com'}
     }
@@ -506,7 +508,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     active_user = users(:active)
 
     # invoke setup with a repository
-    post :setup, {
+    post :setup, params: {
       repo_name: 'usertestrepo',
       uuid: active_user['uuid']
     }
@@ -539,7 +541,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     repo_link_count = repo_link_query.count
 
     # invoke setup with a repository
-    post :setup, {
+    post :setup, params: {
       vm_uuid: @vm_uuid,
       uuid: active_user['uuid'],
       email: 'junk_email'
@@ -574,7 +576,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     authorize_with :admin
 
     # now unsetup this user
-    post :unsetup, id: active_user['uuid']
+    post :unsetup, params: {id: active_user['uuid']}
     assert_response :success
 
     response_user = JSON.parse(@response.body)
@@ -598,7 +600,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "setup user with send notification param false and verify no email" do
     authorize_with :admin
 
-    post :setup, {
+    post :setup, params: {
       openid_prefix: 'http://www.example.com/account',
       send_notification_email: 'false',
       user: {
@@ -619,7 +621,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "setup user with send notification param true and verify email" do
     authorize_with :admin
 
-    post :setup, {
+    post :setup, params: {
       openid_prefix: 'http://www.example.com/account',
       send_notification_email: 'true',
       user: {
@@ -649,7 +651,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     active_user = users(:active)
 
     # invoke setup with a repository
-    put :update, {
+    put :update, params: {
           id: active_user['uuid'],
           user: {
             is_active: true,
@@ -676,7 +678,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     users = create_list :active_user, 2, join_groups: [g]
     token = create :token, user: users[0]
     authorize_with_token token
-    get :show, id: users[1].uuid
+    get :show, params: {id: users[1].uuid}
     check_non_admin_show
   end
 
@@ -689,7 +691,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
       token = create :token, user: users[0]
 
       authorize_with_token token
-      get(:index, limit: limit)
+      get(:index, params: {limit: limit})
       check_non_admin_index
       assert_equal(limit, json_response["items"].size,
                    "non-admin index limit was ineffective")
@@ -708,14 +710,14 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
   test "admin can filter on user.is_active" do
     authorize_with :admin
-    get(:index, filters: [["is_active", "=", "true"]])
+    get(:index, params: {filters: [["is_active", "=", "true"]]})
     assert_response :success
     check_readable_users_index [:active, :spectator], [:inactive]
   end
 
   test "admin can search where user.is_active" do
     authorize_with :admin
-    get(:index, where: {is_active: true})
+    get(:index, params: {where: {is_active: true}})
     assert_response :success
     check_readable_users_index [:active, :spectator], [:inactive]
   end
@@ -723,7 +725,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "update active_no_prefs user profile and expect notification email" do
     authorize_with :admin
 
-    put :update, {
+    put :update, params: {
       id: users(:active_no_prefs).uuid,
       user: {
         prefs: {:profile => {'organization' => 'example.com'}}
@@ -747,7 +749,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     user = {}
     user[:prefs] = users(:active_no_prefs_profile_no_getting_started_shown).prefs
     user[:prefs][:profile] = {:profile => {'organization' => 'example.com'}}
-    put :update, {
+    put :update, params: {
       id: users(:active_no_prefs_profile_no_getting_started_shown).uuid,
       user: user
     }
@@ -766,7 +768,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
   test "update active user profile and expect no notification email" do
     authorize_with :admin
 
-    put :update, {
+    put :update, params: {
       id: users(:active).uuid,
       user: {
         prefs: {:profile => {'organization' => 'anotherexample.com'}}
@@ -801,7 +803,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     test "update_uuid as #{auth_user}" do
       authorize_with auth_user
       orig_uuid = users(:active).uuid
-      post :update_uuid, {
+      post :update_uuid, params: {
              id: orig_uuid,
              new_uuid: 'zbbbb-tpzed-abcde12345abcde',
            }
@@ -817,7 +819,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
   test "refuse to merge with redirect_to_user_uuid=false (not yet supported)" do
     authorize_with :project_viewer_trustedclient
-    post :merge, {
+    post :merge, params: {
            new_user_token: api_client_authorizations(:active_trustedclient).api_token,
            new_owner_uuid: users(:active).uuid,
            redirect_to_new_user: false,
@@ -827,7 +829,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
   test "refuse to merge user into self" do
     authorize_with(:active_trustedclient)
-    post(:merge, {
+    post(:merge, params: {
            new_user_token: api_client_authorizations(:active_trustedclient).api_token,
            new_owner_uuid: users(:active).uuid,
            redirect_to_new_user: true,
@@ -839,7 +841,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
    [:active_trustedclient, :project_viewer]].each do |src, dst|
     test "refuse to merge with untrusted token (#{src} -> #{dst})" do
       authorize_with(src)
-      post(:merge, {
+      post(:merge, params: {
              new_user_token: api_client_authorizations(dst).api_token,
              new_owner_uuid: api_client_authorizations(dst).user.uuid,
              redirect_to_new_user: true,
@@ -852,7 +854,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
    [:project_viewer_trustedclient, :expired_trustedclient]].each do |src, dst|
     test "refuse to merge with expired token (#{src} -> #{dst})" do
       authorize_with(src)
-      post(:merge, {
+      post(:merge, params: {
              new_user_token: api_client_authorizations(dst).api_token,
              new_owner_uuid: api_client_authorizations(dst).user.uuid,
              redirect_to_new_user: true,
@@ -868,7 +870,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
         api_client_authorizations(auth).update_attributes(scopes: ["GET /", "POST /", "PUT /"])
       end
       authorize_with(:active_trustedclient)
-      post(:merge, {
+      post(:merge, params: {
              new_user_token: api_client_authorizations(:project_viewer_trustedclient).api_token,
              new_owner_uuid: users(:project_viewer).uuid,
              redirect_to_new_user: true,
@@ -879,7 +881,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
   test "refuse to merge if new_owner_uuid is not writable" do
     authorize_with(:project_viewer_trustedclient)
-    post(:merge, {
+    post(:merge, params: {
            new_user_token: api_client_authorizations(:active_trustedclient).api_token,
            new_owner_uuid: groups(:anonymously_accessible_project).uuid,
            redirect_to_new_user: true,
@@ -889,7 +891,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
   test "refuse to merge if new_owner_uuid is empty" do
     authorize_with(:project_viewer_trustedclient)
-    post(:merge, {
+    post(:merge, params: {
            new_user_token: api_client_authorizations(:active_trustedclient).api_token,
            new_owner_uuid: "",
            redirect_to_new_user: true,
@@ -899,7 +901,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
   test "refuse to merge if new_owner_uuid is not provided" do
     authorize_with(:project_viewer_trustedclient)
-    post(:merge, {
+    post(:merge, params: {
            new_user_token: api_client_authorizations(:active_trustedclient).api_token,
            redirect_to_new_user: true,
          })
@@ -908,7 +910,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
   test "refuse to update redirect_to_user_uuid directly" do
     authorize_with(:active_trustedclient)
-    patch(:update, {
+    patch(:update, params: {
             id: users(:active).uuid,
             user: {
               redirect_to_user_uuid: users(:active).uuid,
@@ -919,7 +921,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
   test "merge 'project_viewer' account into 'active' account" do
     authorize_with(:project_viewer_trustedclient)
-    post(:merge, {
+    post(:merge, params: {
            new_user_token: api_client_authorizations(:active_trustedclient).api_token,
            new_owner_uuid: users(:active).uuid,
            redirect_to_new_user: true,
@@ -972,7 +974,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
   def check_inactive_user_findable(params={})
     inactive_user = users(:inactive)
-    get(:index, params.merge(filters: [["email", "=", inactive_user.email]]))
+    get(:index, params: params.merge(filters: [["email", "=", inactive_user.email]]))
     assert_response :success
     user_list = json_response["items"]
     assert_equal(1, user_list.andand.count)
index 02191ecae9cf29343a4ded8c05567810318f6f67..9367775ec581e76ee6c24844861df8b6d451bf14 100644 (file)
@@ -7,7 +7,7 @@ require 'test_helper'
 class Arvados::V1::VirtualMachinesControllerTest < ActionController::TestCase
   def get_logins_for(vm_sym)
     authorize_with :admin
-    get(:logins, id: virtual_machines(vm_sym).uuid)
+    get(:logins, params: {id: virtual_machines(vm_sym).uuid})
   end
 
   def find_login(sshkey_sym)
@@ -60,7 +60,7 @@ class Arvados::V1::VirtualMachinesControllerTest < ActionController::TestCase
                    properties: {'username' => 'bobblogin'})
     end
     authorize_with :admin
-    get :logins, id: vm.uuid
+    get :logins, params: {id: vm.uuid}
     assert_response :success
     assert_equal 1, json_response['items'].length
     assert_nil json_response['items'][0]['public_key']
index e3048159f4e7a99f025fca9153f2f09cf4d07863..cee8245b25120192bd198115cba374a2232ab4b6 100644 (file)
@@ -9,7 +9,7 @@ class UserSessionsControllerTest < ActionController::TestCase
   test "new user from new api client" do
     authorize_with :inactive
     api_client_page = 'http://client.example.com/home'
-    get :login, return_to: api_client_page
+    get :login, params: {return_to: api_client_page}
     assert_response :redirect
     assert_equal(0, @response.redirect_url.index(api_client_page + '?'),
                  'Redirect url ' + @response.redirect_url +
@@ -21,7 +21,7 @@ class UserSessionsControllerTest < ActionController::TestCase
     authorize_with :inactive
     api_client_page = 'http://client.example.com/home'
     remote_prefix = 'zbbbb'
-    get :login, return_to: api_client_page, remote: remote_prefix
+    get :login, params: {return_to: api_client_page, remote: remote_prefix}
     assert_response :redirect
     api_client_auth = assigns(:api_client_auth)
     assert_not_nil api_client_auth
@@ -32,7 +32,7 @@ class UserSessionsControllerTest < ActionController::TestCase
     authorize_with :inactive
     api_client_page = 'http://client.example.com/home'
     remote_prefix = 'invalid_cluster_id'
-    get :login, return_to: api_client_page, remote: remote_prefix
+    get :login, params: {return_to: api_client_page, remote: remote_prefix}
     assert_response 400
   end
 end
index e42a4ef1055deffd27d4cffc6eb67b370fbae470..b9bfd3a39537e765af505861cc5d9b0b826cfdb9 100644 (file)
@@ -8,43 +8,51 @@ class ApiClientAuthorizationsApiTest < ActionDispatch::IntegrationTest
   fixtures :all
 
   test "create system auth" do
-    post "/arvados/v1/api_client_authorizations/create_system_auth", {:format => :json, :scopes => ['test'].to_json}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin_trustedclient).api_token}"}
+    post "/arvados/v1/api_client_authorizations/create_system_auth",
+      params: {:format => :json, :scopes => ['test'].to_json},
+      headers: {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin_trustedclient).api_token}"}
     assert_response :success
   end
 
   test "create token for different user" do
-    post "/arvados/v1/api_client_authorizations", {
-      :format => :json,
-      :api_client_authorization => {
-        :owner_uuid => users(:spectator).uuid
-      }
-    }, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin_trustedclient).api_token}"}
+    post "/arvados/v1/api_client_authorizations",
+      params: {
+        :format => :json,
+        :api_client_authorization => {
+          :owner_uuid => users(:spectator).uuid
+        }
+      },
+      headers: {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin_trustedclient).api_token}"}
     assert_response :success
 
-    get "/arvados/v1/users/current", {
-      :format => :json
-    }, {'HTTP_AUTHORIZATION' => "OAuth2 #{json_response['api_token']}"}
+    get "/arvados/v1/users/current",
+      params: {:format => :json},
+      headers: {'HTTP_AUTHORIZATION' => "OAuth2 #{json_response['api_token']}"}
     @json_response = nil
     assert_equal users(:spectator).uuid, json_response['uuid']
   end
 
   test "refuse to create token for different user if not trusted client" do
-    post "/arvados/v1/api_client_authorizations", {
-      :format => :json,
-      :api_client_authorization => {
-        :owner_uuid => users(:spectator).uuid
-      }
-    }, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin).api_token}"}
+    post "/arvados/v1/api_client_authorizations",
+      params: {
+        :format => :json,
+        :api_client_authorization => {
+          :owner_uuid => users(:spectator).uuid
+        }
+      },
+      headers: {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin).api_token}"}
     assert_response 403
   end
 
   test "refuse to create token for different user if not admin" do
-    post "/arvados/v1/api_client_authorizations", {
-      :format => :json,
-      :api_client_authorization => {
-        :owner_uuid => users(:spectator).uuid
-      }
-    }, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active_trustedclient).api_token}"}
+    post "/arvados/v1/api_client_authorizations",
+      params: {
+        :format => :json,
+        :api_client_authorization => {
+          :owner_uuid => users(:spectator).uuid
+        }
+      },
+      headers: {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active_trustedclient).api_token}"}
     assert_response 403
   end
 
index dfb57496a7704f7d0094f960fd3ec425ff3e55c1..d015e450a610df0cbcddefe138393a598eca4296 100644 (file)
@@ -16,7 +16,7 @@ class ApiTokensScopeTest < ActionDispatch::IntegrationTest
   end
 
   test "user list token can only list users" do
-    get_args = [{}, auth(:active_userlist)]
+    get_args = [params: {}, headers: auth(:active_userlist)]
     get(v1_url('users'), *get_args)
     assert_response :success
     get(v1_url('users', ''), *get_args)  # Add trailing slash.
@@ -28,9 +28,9 @@ class ApiTokensScopeTest < ActionDispatch::IntegrationTest
   end
 
   test "narrow + wide scoped tokens for different users" do
-    get_args = [{
+    get_args = [params: {
                   reader_tokens: [api_client_authorizations(:anonymous).api_token]
-                }, auth(:active_userlist)]
+                }, headers: auth(:active_userlist)]
     get(v1_url('users'), *get_args)
     assert_response :success
     get(v1_url('users', ''), *get_args)  # Add trailing slash.
@@ -42,7 +42,7 @@ class ApiTokensScopeTest < ActionDispatch::IntegrationTest
    end
 
   test "specimens token can see exactly owned specimens" do
-    get_args = [{}, auth(:active_specimens)]
+    get_args = [params: {}, headers: auth(:active_specimens)]
     get(v1_url('specimens'), *get_args)
     assert_response 403
     get(v1_url('specimens', specimens(:owned_by_active_user).uuid), *get_args)
@@ -55,7 +55,9 @@ class ApiTokensScopeTest < ActionDispatch::IntegrationTest
 
   test "token with multiple scopes can use them all" do
     def get_token_count
-      get(v1_url('api_client_authorizations'), {}, auth(:active_apitokens))
+      get(v1_url('api_client_authorizations'),
+        params: {},
+        headers: auth(:active_apitokens))
       assert_response :success
       token_count = JSON.parse(@response.body)['items_available']
       assert_not_nil(token_count, "could not find token count")
@@ -65,22 +67,22 @@ class ApiTokensScopeTest < ActionDispatch::IntegrationTest
     token_count = get_token_count
     # Test the POST scope.
     post(v1_url('api_client_authorizations'),
-         {api_client_authorization: {user_id: users(:active).id}},
-         auth(:active_apitokens))
+      params: {api_client_authorization: {user_id: users(:active).id}},
+      headers: auth(:active_apitokens))
     assert_response :success
     assert_equal(token_count + 1, get_token_count,
                  "token count suggests POST was not accepted")
     # Test other requests are denied.
     get(v1_url('api_client_authorizations',
                api_client_authorizations(:active_apitokens).uuid),
-        {}, auth(:active_apitokens))
+        params: {}, headers: auth(:active_apitokens))
     assert_response 403
   end
 
   test "token without scope has no access" do
     # Logs are good for this test, because logs have relatively
     # few access controls enforced at the model level.
-    req_args = [{}, auth(:admin_noscope)]
+    req_args = [params: {}, headers: auth(:admin_noscope)]
     get(v1_url('logs'), *req_args)
     assert_response 403
     get(v1_url('logs', logs(:noop).uuid), *req_args)
@@ -95,7 +97,7 @@ class ApiTokensScopeTest < ActionDispatch::IntegrationTest
     def vm_logins_url(name)
       v1_url('virtual_machines', virtual_machines(name).uuid, 'logins')
     end
-    get_args = [{}, auth(:admin_vm)]
+    get_args = [params: {}, headers: auth(:admin_vm)]
     get(vm_logins_url(:testvm), *get_args)
     assert_response :success
     get(vm_logins_url(:testvm2), *get_args)
index ac1ca66376b8b993630ba7b1c0bc14c63976a2f7..70965753425c8103963dd534fb3768dae85964e5 100644 (file)
@@ -8,96 +8,120 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
   fixtures :all
 
   test "should get index" do
-    get "/arvados/v1/collections", {:format => :json}, auth(:active)
+    get "/arvados/v1/collections",
+      params: {:format => :json},
+      headers: auth(:active)
     assert_response :success
     assert_equal "arvados#collectionList", json_response['kind']
   end
 
   test "get index with filters= (empty string)" do
-    get "/arvados/v1/collections", {:format => :json, :filters => ''}, auth(:active)
+    get "/arvados/v1/collections",
+      params: {:format => :json, :filters => ''},
+      headers: auth(:active)
     assert_response :success
     assert_equal "arvados#collectionList", json_response['kind']
   end
 
   test "get index with invalid filters (array of strings) responds 422" do
-    get "/arvados/v1/collections", {
-      :format => :json,
-      :filters => ['uuid', '=', 'ad02e37b6a7f45bbe2ead3c29a109b8a+54'].to_json
-    }, auth(:active)
+    get "/arvados/v1/collections",
+      params: {
+        :format => :json,
+        :filters => ['uuid', '=', 'ad02e37b6a7f45bbe2ead3c29a109b8a+54'].to_json
+      },
+      headers: auth(:active)
     assert_response 422
     assert_match(/nvalid element.*not an array/, json_response['errors'].join(' '))
   end
 
   test "get index with invalid filters (unsearchable column) responds 422" do
-    get "/arvados/v1/collections", {
-      :format => :json,
-      :filters => [['this_column_does_not_exist', '=', 'bogus']].to_json
-    }, auth(:active)
+    get "/arvados/v1/collections",
+      params: {
+        :format => :json,
+        :filters => [['this_column_does_not_exist', '=', 'bogus']].to_json
+      },
+      headers: auth(:active)
     assert_response 422
     assert_match(/nvalid attribute/, json_response['errors'].join(' '))
   end
 
   test "get index with invalid filters (invalid operator) responds 422" do
-    get "/arvados/v1/collections", {
-      :format => :json,
-      :filters => [['uuid', ':-(', 'displeased']].to_json
-    }, auth(:active)
+    get "/arvados/v1/collections",
+      params: {
+        :format => :json,
+        :filters => [['uuid', ':-(', 'displeased']].to_json
+      },
+      headers: auth(:active)
     assert_response 422
     assert_match(/nvalid operator/, json_response['errors'].join(' '))
   end
 
   test "get index with invalid filters (invalid operand type) responds 422" do
-    get "/arvados/v1/collections", {
-      :format => :json,
-      :filters => [['uuid', '=', {foo: 'bar'}]].to_json
-    }, auth(:active)
+    get "/arvados/v1/collections",
+      params: {
+        :format => :json,
+        :filters => [['uuid', '=', {foo: 'bar'}]].to_json
+      },
+      headers: auth(:active)
     assert_response 422
     assert_match(/nvalid operand type/, json_response['errors'].join(' '))
   end
 
   test "get index with where= (empty string)" do
-    get "/arvados/v1/collections", {:format => :json, :where => ''}, auth(:active)
+    get "/arvados/v1/collections",
+      params: {:format => :json, :where => ''},
+      headers: auth(:active)
     assert_response :success
     assert_equal "arvados#collectionList", json_response['kind']
   end
 
   test "get index with select= (valid attribute)" do
-    get "/arvados/v1/collections", {
-          :format => :json,
-          :select => ['portable_data_hash'].to_json
-        }, auth(:active)
+    get "/arvados/v1/collections",
+      params: {
+        :format => :json,
+        :select => ['portable_data_hash'].to_json
+      },
+      headers: auth(:active)
     assert_response :success
     assert json_response['items'][0].keys.include?('portable_data_hash')
     assert not(json_response['items'][0].keys.include?('uuid'))
   end
 
   test "get index with select= (invalid attribute) responds 422" do
-    get "/arvados/v1/collections", {
-          :format => :json,
-          :select => ['bogus'].to_json
-        }, auth(:active)
+    get "/arvados/v1/collections",
+      params: {
+        :format => :json,
+        :select => ['bogus'].to_json
+      },
+      headers: auth(:active)
     assert_response 422
     assert_match(/Invalid attribute.*bogus/, json_response['errors'].join(' '))
   end
 
   test "get index with select= (invalid attribute type) responds 422" do
-    get "/arvados/v1/collections", {
-          :format => :json,
-          :select => [['bogus']].to_json
-        }, auth(:active)
+    get "/arvados/v1/collections",
+      params: {
+        :format => :json,
+        :select => [['bogus']].to_json
+      },
+      headers: auth(:active)
     assert_response 422
     assert_match(/Invalid attribute.*bogus/, json_response['errors'].join(' '))
   end
 
   test "controller 404 response is json" do
-    get "/arvados/v1/thingsthatdonotexist", {:format => :xml}, auth(:active)
+    get "/arvados/v1/thingsthatdonotexist",
+      params: {:format => :xml},
+      headers: auth(:active)
     assert_response 404
     assert_equal 1, json_response['errors'].length
     assert_equal true, json_response['errors'][0].is_a?(String)
   end
 
   test "object 404 response is json" do
-    get "/arvados/v1/groups/zzzzz-j7d0g-o5ba971173cup4f", {}, auth(:active)
+    get "/arvados/v1/groups/zzzzz-j7d0g-o5ba971173cup4f",
+      params: {},
+      headers: auth(:active)
     assert_response 404
     assert_equal 1, json_response['errors'].length
     assert_equal true, json_response['errors'][0].is_a?(String)
@@ -110,10 +134,12 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
     }
     signed_locator = Blob.sign_locator('bad42fa702ae3ea7d888fef11b46f450+44',
                                        signing_opts)
-    post "/arvados/v1/collections", {
-      format: :json,
-      collection: "{\"manifest_text\":\". #{signed_locator} 0:44:md5sum.txt\\n\",\"portable_data_hash\":\"ad02e37b6a7f45bbe2ead3c29a109b8a+54\"}"
-    }, auth(:active)
+    post "/arvados/v1/collections",
+      params: {
+        format: :json,
+        collection: "{\"manifest_text\":\". #{signed_locator} 0:44:md5sum.txt\\n\",\"portable_data_hash\":\"ad02e37b6a7f45bbe2ead3c29a109b8a+54\"}"
+      },
+      headers: auth(:active)
     assert_response 200
     assert_equal 'ad02e37b6a7f45bbe2ead3c29a109b8a+54', json_response['portable_data_hash']
   end
@@ -125,10 +151,12 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
     }
     signed_locator = Blob.sign_locator('bad42fa702ae3ea7d888fef11b46f450+44',
                                        signing_opts)
-    post "/arvados/v1/collections", {
-      format: :json,
-      collection: "{\"manifest_text\":\". #{signed_locator} 0:44:md5sum.txt\\n\"}"
-    }, auth(:active)
+    post "/arvados/v1/collections",
+      params: {
+        format: :json,
+        collection: "{\"manifest_text\":\". #{signed_locator} 0:44:md5sum.txt\\n\"}"
+      },
+      headers: auth(:active)
     assert_response 200
     assert_equal 'ad02e37b6a7f45bbe2ead3c29a109b8a+54', json_response['portable_data_hash']
   end
@@ -140,25 +168,29 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
     }
     signed_locator = Blob.sign_locator('bad42fa702ae3ea7d888fef11b46f450+44',
                                        signing_opts)
-    post "/arvados/v1/collections", {
-      format: :json,
-      collection: "{\"manifest_text\":\". #{signed_locator} 0:44:md5sum.txt\\n\",\"portable_data_hash\":\"ad02e37b6a7f45bbe2ead3c29a109b8a+54\"}"
-    }, auth(:active)
+    post "/arvados/v1/collections",
+      params: {
+        format: :json,
+        collection: "{\"manifest_text\":\". #{signed_locator} 0:44:md5sum.txt\\n\",\"portable_data_hash\":\"ad02e37b6a7f45bbe2ead3c29a109b8a+54\"}"
+      },
+      headers: auth(:active)
     assert_response 200
     assert_equal 'ad02e37b6a7f45bbe2ead3c29a109b8a+54', json_response['portable_data_hash']
 
-    put "/arvados/v1/collections/#{json_response['uuid']}", {
-      format: :json,
-      collection: { name: "a name" }
-    }, auth(:active)
+    put "/arvados/v1/collections/#{json_response['uuid']}",
+      params: {
+        format: :json,
+        collection: { name: "a name" }
+      },
+      headers: auth(:active)
 
     assert_response 200
     assert_equal 'ad02e37b6a7f45bbe2ead3c29a109b8a+54', json_response['portable_data_hash']
     assert_equal 'a name', json_response['name']
 
-    get "/arvados/v1/collections/#{json_response['uuid']}", {
-      format: :json,
-    }, auth(:active)
+    get "/arvados/v1/collections/#{json_response['uuid']}",
+      params: {format: :json},
+      headers: auth(:active)
 
     assert_response 200
     assert_equal 'ad02e37b6a7f45bbe2ead3c29a109b8a+54', json_response['portable_data_hash']
@@ -169,17 +201,19 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
     collection = collections(:multilevel_collection_1)
 
     # update collection's description
-    put "/arvados/v1/collections/#{collection['uuid']}", {
-      format: :json,
-      collection: { description: "something specific" }
-    }, auth(:active)
+    put "/arvados/v1/collections/#{collection['uuid']}",
+      params: {
+        format: :json,
+        collection: { description: "something specific" }
+      },
+      headers: auth(:active)
     assert_response :success
     assert_equal 'something specific', json_response['description']
 
     # get the collection and verify newly added description
-    get "/arvados/v1/collections/#{collection['uuid']}", {
-      format: :json,
-    }, auth(:active)
+    get "/arvados/v1/collections/#{collection['uuid']}",
+      params: {format: :json},
+      headers: auth(:active)
     assert_response 200
     assert_equal 'something specific', json_response['description']
 
@@ -191,10 +225,12 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
   test "create collection, update manifest, and search with filename" do
     # create collection
     signed_manifest = Collection.sign_manifest(". bad42fa702ae3ea7d888fef11b46f450+44 0:44:my_test_file.txt\n", api_token(:active))
-    post "/arvados/v1/collections", {
-      format: :json,
-      collection: {manifest_text: signed_manifest}.to_json,
-    }, auth(:active)
+    post "/arvados/v1/collections",
+      params: {
+        format: :json,
+        collection: {manifest_text: signed_manifest}.to_json,
+      },
+      headers: auth(:active)
     assert_response :success
     assert_equal true, json_response['manifest_text'].include?('my_test_file.txt')
     assert_includes json_response['manifest_text'], 'my_test_file.txt'
@@ -206,10 +242,12 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
 
     # update the collection's manifest text
     signed_manifest = Collection.sign_manifest(". bad42fa702ae3ea7d888fef11b46f450+44 0:44:my_updated_test_file.txt\n", api_token(:active))
-    put "/arvados/v1/collections/#{created['uuid']}", {
-      format: :json,
-      collection: {manifest_text: signed_manifest}.to_json,
-    }, auth(:active)
+    put "/arvados/v1/collections/#{created['uuid']}",
+      params: {
+        format: :json,
+        collection: {manifest_text: signed_manifest}.to_json,
+      },
+      headers: auth(:active)
     assert_response :success
     assert_equal created['uuid'], json_response['uuid']
     assert_includes json_response['manifest_text'], 'my_updated_test_file.txt'
@@ -222,9 +260,9 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
   end
 
   def search_using_filter search_filter, expected_items
-    get '/arvados/v1/collections', {
-      :filters => [['any', 'ilike', "%#{search_filter}%"]].to_json
-    }, auth(:active)
+    get '/arvados/v1/collections',
+      params: {:filters => [['any', 'ilike', "%#{search_filter}%"]].to_json},
+      headers: auth(:active)
     assert_response :success
     response_items = json_response['items']
     assert_not_nil response_items
@@ -240,10 +278,12 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
   test "search collection using full text search" do
     # create collection to be searched for
     signed_manifest = Collection.sign_manifest(". 85877ca2d7e05498dd3d109baf2df106+95+A3a4e26a366ee7e4ed3e476ccf05354761be2e4ae@545a9920 0:95:file_in_subdir1\n./subdir2/subdir3 2bbc341c702df4d8f42ec31f16c10120+64+A315d7e7bad2ce937e711fc454fae2d1194d14d64@545a9920 0:32:file1_in_subdir3.txt 32:32:file2_in_subdir3.txt\n./subdir2/subdir3/subdir4 2bbc341c702df4d8f42ec31f16c10120+64+A315d7e7bad2ce937e711fc454fae2d1194d14d64@545a9920 0:32:file3_in_subdir4.txt 32:32:file4_in_subdir4.txt\n", api_token(:active))
-    post "/arvados/v1/collections", {
-      format: :json,
-      collection: {description: 'specific collection description', manifest_text: signed_manifest}.to_json,
-    }, auth(:active)
+    post "/arvados/v1/collections",
+      params: {
+        format: :json,
+        collection: {description: 'specific collection description', manifest_text: signed_manifest}.to_json,
+      },
+      headers: auth(:active)
     assert_response :success
     assert_equal true, json_response['manifest_text'].include?('file4_in_subdir4.txt')
 
@@ -260,9 +300,9 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
   end
 
   def search_using_full_text_search search_filter, expected_items
-    get '/arvados/v1/collections', {
-      :filters => [['any', '@@', search_filter]].to_json
-    }, auth(:active)
+    get '/arvados/v1/collections',
+      params: {:filters => [['any', '@@', search_filter]].to_json},
+      headers: auth(:active)
     assert_response :success
     response_items = json_response['items']
     assert_not_nil response_items
@@ -277,9 +317,9 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
 
   # search for the filename in the file_names column and expect error
   test "full text search not supported for individual columns" do
-    get '/arvados/v1/collections', {
-      :filters => [['name', '@@', 'General']].to_json
-    }, auth(:active)
+    get '/arvados/v1/collections',
+      params: {:filters => [['name', '@@', 'General']].to_json},
+      headers: auth(:active)
     assert_response 422
   end
 
@@ -292,9 +332,9 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
     test "full text search ignores special characters and finds with filter #{search_filter}" do
       # description: The quick_brown_fox jumps over the lazy_dog
       # full text search treats '_' as space apparently
-      get '/arvados/v1/collections', {
-        :filters => [['any', '@@', search_filter]].to_json
-      }, auth(:active)
+      get '/arvados/v1/collections',
+        params: {:filters => [['any', '@@', search_filter]].to_json},
+        headers: auth(:active)
       assert_response 200
       response_items = json_response['items']
       assert_not_nil response_items
@@ -307,20 +347,24 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
   test "create and get collection with properties" do
     # create collection to be searched for
     signed_manifest = Collection.sign_manifest(". bad42fa702ae3ea7d888fef11b46f450+44 0:44:my_test_file.txt\n", api_token(:active))
-    post "/arvados/v1/collections", {
-      format: :json,
-      collection: {manifest_text: signed_manifest}.to_json,
-    }, auth(:active)
+    post "/arvados/v1/collections",
+      params: {
+        format: :json,
+        collection: {manifest_text: signed_manifest}.to_json,
+      },
+      headers: auth(:active)
     assert_response 200
     assert_not_nil json_response['uuid']
     assert_not_nil json_response['properties']
     assert_empty json_response['properties']
 
     # update collection's description
-    put "/arvados/v1/collections/#{json_response['uuid']}", {
-      format: :json,
-      collection: { properties: {'property_1' => 'value_1'} }
-    }, auth(:active)
+    put "/arvados/v1/collections/#{json_response['uuid']}",
+      params: {
+        format: :json,
+        collection: { properties: {'property_1' => 'value_1'} }
+      },
+      headers: auth(:active)
     assert_response :success
     assert_equal 'value_1', json_response['properties']['property_1']
   end
index 3d13d144b8d658a3133632bb187113e80ae1b733..b925fbf77e737a01b4cb690850ec60118f67c13d 100644 (file)
@@ -22,24 +22,30 @@ class CollectionsApiPerformanceTest < ActionDispatch::IntegrationTest
       SafeJSON.dump({"manifest_text" => bigmanifest})
     end
     time_block 'create' do
-      post '/arvados/v1/collections', {collection: json}, auth(:active)
+      post '/arvados/v1/collections',
+        params: {collection: json},
+        headers: auth(:active)
       assert_response :success
     end
     uuid = json_response['uuid']
     time_block 'read' do
-      get '/arvados/v1/collections/' + uuid, {}, auth(:active)
+      get '/arvados/v1/collections/' + uuid, params: {}, headers: auth(:active)
       assert_response :success
     end
     time_block 'list' do
-      get '/arvados/v1/collections', {select: ['manifest_text'], filters: [['uuid', '=', uuid]].to_json}, auth(:active)
+      get '/arvados/v1/collections',
+        params: {select: ['manifest_text'], filters: [['uuid', '=', uuid]].to_json},
+        headers: auth(:active)
       assert_response :success
     end
     time_block 'update' do
-      put '/arvados/v1/collections/' + uuid, {collection: json}, auth(:active)
+      put '/arvados/v1/collections/' + uuid,
+        params: {collection: json},
+        headers: auth(:active)
       assert_response :success
     end
     time_block 'delete' do
-      delete '/arvados/v1/collections/' + uuid, {}, auth(:active)
+      delete '/arvados/v1/collections/' + uuid, params: {}, headers: auth(:active)
     end
   end
 
@@ -53,7 +59,9 @@ class CollectionsApiPerformanceTest < ActionDispatch::IntegrationTest
       SafeJSON.dump({manifest_text: hugemanifest})
     end
     vmpeak "post" do
-      post '/arvados/v1/collections', {collection: json}, auth(:active)
+      post '/arvados/v1/collections',
+        params: {collection: json},
+        headers: auth(:active)
     end
   end
 end
index 552cce44b1b58115149cf006522468758d457b18..2a1ebabc0a9a52be5f0b8b97b411a448347b11f4 100644 (file)
@@ -8,57 +8,59 @@ class ContainerAuthTest < ActionDispatch::IntegrationTest
   fixtures :all
 
   test "container token validate, Running, regular auth" do
-    get "/arvados/v1/containers/current", {
-      :format => :json
-        }, {'HTTP_AUTHORIZATION' => "Bearer #{api_client_authorizations(:running_container_auth).token}/#{containers(:running).uuid}"}
+    get "/arvados/v1/containers/current",
+      params: {:format => :json},
+      headers: {'HTTP_AUTHORIZATION' => "Bearer #{api_client_authorizations(:running_container_auth).token}/#{containers(:running).uuid}"}
     # Container is Running, token can be used
     assert_response :success
     assert_equal containers(:running).uuid, json_response['uuid']
   end
 
   test "container token validate, Locked, runtime_token" do
-    get "/arvados/v1/containers/current", {
-      :format => :json
-        }, {'HTTP_AUTHORIZATION' => "Bearer #{api_client_authorizations(:container_runtime_token).token}/#{containers(:runtime_token).uuid}"}
+    get "/arvados/v1/containers/current",
+      params: {:format => :json},
+      headers: {'HTTP_AUTHORIZATION' => "Bearer #{api_client_authorizations(:container_runtime_token).token}/#{containers(:runtime_token).uuid}"}
     # Container is Running, token can be used
     assert_response :success
     assert_equal containers(:runtime_token).uuid, json_response['uuid']
   end
 
   test "container token validate, Cancelled, runtime_token" do
-    put "/arvados/v1/containers/#{containers(:runtime_token).uuid}", {
-          :format => :json,
-          :container => {:state => "Cancelled"}
-        }, {'HTTP_AUTHORIZATION' => "Bearer #{api_client_authorizations(:dispatch1).token}"}
+    put "/arvados/v1/containers/#{containers(:runtime_token).uuid}",
+      params: {
+        :format => :json,
+        :container => {:state => "Cancelled"}
+      },
+      headers: {'HTTP_AUTHORIZATION' => "Bearer #{api_client_authorizations(:dispatch1).token}"}
     assert_response :success
-    get "/arvados/v1/containers/current", {
-      :format => :json
-        }, {'HTTP_AUTHORIZATION' => "Bearer #{api_client_authorizations(:container_runtime_token).token}/#{containers(:runtime_token).uuid}"}
+    get "/arvados/v1/containers/current",
+      params: {:format => :json},
+      headers: {'HTTP_AUTHORIZATION' => "Bearer #{api_client_authorizations(:container_runtime_token).token}/#{containers(:runtime_token).uuid}"}
     # Container is Queued, token cannot be used
     assert_response 401
   end
 
   test "container token validate, Running, without optional portion" do
-    get "/arvados/v1/containers/current", {
-      :format => :json
-        }, {'HTTP_AUTHORIZATION' => "Bearer #{api_client_authorizations(:running_container_auth).token}"}
+    get "/arvados/v1/containers/current",
+      params: {:format => :json},
+      headers: {'HTTP_AUTHORIZATION' => "Bearer #{api_client_authorizations(:running_container_auth).token}"}
     # Container is Running, token can be used
     assert_response :success
     assert_equal containers(:running).uuid, json_response['uuid']
   end
 
   test "container token validate, Locked, runtime_token, without optional portion" do
-    get "/arvados/v1/containers/current", {
-      :format => :json
-        }, {'HTTP_AUTHORIZATION' => "Bearer #{api_client_authorizations(:container_runtime_token).token}"}
+    get "/arvados/v1/containers/current",
+      params: {:format => :json},
+      headers: {'HTTP_AUTHORIZATION' => "Bearer #{api_client_authorizations(:container_runtime_token).token}"}
     # runtime_token without container uuid won't return 'current'
     assert_response 404
   end
 
   test "container token validate, wrong container uuid" do
-    get "/arvados/v1/containers/current", {
-      :format => :json
-        }, {'HTTP_AUTHORIZATION' => "Bearer #{api_client_authorizations(:container_runtime_token).token}/#{containers(:running).uuid}"}
+    get "/arvados/v1/containers/current",
+      params: {:format => :json},
+      headers: {'HTTP_AUTHORIZATION' => "Bearer #{api_client_authorizations(:container_runtime_token).token}/#{containers(:running).uuid}"}
     # Container uuid mismatch, token can't be used
     assert_response 401
   end
index 5109ea46a642a0853528d40986c2314610f050a1..e3099f15735dec3d9ebf688b251553aad3964463 100644 (file)
@@ -15,19 +15,19 @@ class CrossOriginTest < ActionDispatch::IntegrationTest
 
   %w(/login /logout /auth/example/callback /auth/joshid).each do |path|
     test "OPTIONS requests are refused at #{path}" do
-      options path, {}, {}
+      options path, params: {}, headers: {}
       assert_no_cors_headers
     end
 
     test "CORS headers do not exist at GET #{path}" do
-      get path, {}, {}
+      get path, params: {}, headers: {}
       assert_no_cors_headers
     end
   end
 
   %w(/discovery/v1/apis/arvados/v1/rest).each do |path|
     test "CORS headers are set at GET #{path}" do
-      get path, {}, {}
+      get path, params: {}, headers: {}
       assert_response :success
       assert_cors_headers
     end
@@ -37,14 +37,14 @@ class CrossOriginTest < ActionDispatch::IntegrationTest
    '/arvados/v1/users',
    '/arvados/v1/api_client_authorizations'].each do |path|
     test "CORS headers are set and body is empty at OPTIONS #{path}" do
-      options path, {}, {}
+      options path, params: {}, headers: {}
       assert_response :success
       assert_cors_headers
       assert_equal '', response.body
     end
 
     test "CORS headers are set at authenticated GET #{path}" do
-      get path, {}, auth(:active_trustedclient)
+      get path, params: {}, headers: auth(:active_trustedclient)
       assert_response :success
       assert_cors_headers
     end
@@ -55,7 +55,7 @@ class CrossOriginTest < ActionDispatch::IntegrationTest
     # does not grant access to any resources.
     ['GET', 'POST'].each do |method|
       test "Session does not work at #{method} #{path}" do
-        send method.downcase, path, {format: 'json'}, {user_id: 1}
+        send method.downcase, path, params: {format: 'json'}, headers: {user_id: 1}
         assert_response 401
         assert_cors_headers
       end
index dc215f2a3c6e4f7654dfc7b274fb312514fca01f..6ac127087ea7c8f1793556ac3d043153c2f746c2 100644 (file)
@@ -28,15 +28,20 @@ class CrunchDispatchIntegrationTest < ActionDispatch::IntegrationTest
   end
 
   test "job runs" do
-    post "/arvados/v1/jobs", {
-      format: "json",
-      job: {
-        script: "log",
-        repository: "active/crunchdispatchtest",
-        script_version: "f35f99b7d32bac257f5989df02b9f12ee1a9b0d6",
-        script_parameters: "{}"
-      }
-    }, auth(:admin)
+    post "/arvados/v1/jobs",
+      params: {
+        format: "json",
+        job: {
+          script: "log",
+          repository: "active/crunchdispatchtest",
+          script_version: "f35f99b7d32bac257f5989df02b9f12ee1a9b0d6",
+          script_parameters: {
+            input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
+            an_integer: '1'
+          }
+        }
+      },
+      headers: auth(:admin)
     assert_response :success
   end
 end
index 430474ea0498898a362b83e54e46709d67bb41f8..7015453a9a62b0825628a19f8883a8b70275d72c 100644 (file)
@@ -10,7 +10,7 @@ class DatabaseResetTest < ActionDispatch::IntegrationTest
     begin
       Rails.env = 'production'
       Rails.application.reload_routes!
-      post '/database/reset', {}, auth(:admin)
+      post '/database/reset', params: {}, headers: auth(:admin)
       assert_response 404
     ensure
       Rails.env = rails_env_was
@@ -19,7 +19,7 @@ class DatabaseResetTest < ActionDispatch::IntegrationTest
   end
 
   test "reset fails with non-admin token" do
-    post '/database/reset', {}, auth(:active)
+    post '/database/reset', params: {}, headers: auth(:active)
     assert_response 403
   end
 
@@ -28,24 +28,25 @@ class DatabaseResetTest < ActionDispatch::IntegrationTest
     admin_auth = auth(:admin)
 
     authorize_with :admin
-    post '/database/reset', {}, admin_auth
+    post '/database/reset', params: {}, headers: admin_auth
     assert_response :success
 
-    post '/arvados/v1/specimens', {specimen: '{}'}, active_auth
+    post '/arvados/v1/specimens', params: {specimen: '{}'}, headers: active_auth
     assert_response :success
     new_uuid = json_response['uuid']
 
-    get '/arvados/v1/specimens/'+new_uuid, {}, active_auth
+    get '/arvados/v1/specimens/'+new_uuid, params: {}, headers: active_auth
     assert_response :success
 
     put('/arvados/v1/specimens/'+new_uuid,
-        {specimen: '{"properties":{}}'}, active_auth)
+      params: {specimen: '{"properties":{}}'},
+      headers: active_auth)
     assert_response :success
 
-    delete '/arvados/v1/specimens/'+new_uuid, {}, active_auth
+    delete '/arvados/v1/specimens/'+new_uuid, params: {}, headers: active_auth
     assert_response :success
 
-    get '/arvados/v1/specimens/'+new_uuid, {}, active_auth
+    get '/arvados/v1/specimens/'+new_uuid, params: {}, headers: active_auth
     assert_response 404
   end
 
@@ -55,23 +56,23 @@ class DatabaseResetTest < ActionDispatch::IntegrationTest
 
     old_uuid = specimens(:owned_by_active_user).uuid
     authorize_with :admin
-    post '/database/reset', {}, admin_auth
+    post '/database/reset', params: {}, headers: admin_auth
     assert_response :success
 
-    delete '/arvados/v1/specimens/' + old_uuid, {}, active_auth
+    delete '/arvados/v1/specimens/' + old_uuid, params: {}, headers: active_auth
     assert_response :success
-    post '/arvados/v1/specimens', {specimen: '{}'}, active_auth
+    post '/arvados/v1/specimens', params: {specimen: '{}'}, headers: active_auth
     assert_response :success
     new_uuid = json_response['uuid']
 
     # Reset to fixtures.
-    post '/database/reset', {}, admin_auth
+    post '/database/reset', params: {}, headers: admin_auth
     assert_response :success
 
     # New specimen should disappear. Old specimen should reappear.
-    get '/arvados/v1/specimens/'+new_uuid, {}, active_auth
+    get '/arvados/v1/specimens/'+new_uuid, params: {}, headers: active_auth
     assert_response 404
-    get '/arvados/v1/specimens/'+old_uuid, {}, active_auth
+    get '/arvados/v1/specimens/'+old_uuid, params: {}, headers: active_auth
     assert_response :success
   end
 end
index 142455880d5d2fbfc7247ab6113bac20e1d95897..d04e3838318dd8d67ed86c560cd907e032be4bb8 100644 (file)
@@ -9,7 +9,7 @@ class ErrorsTest < ActionDispatch::IntegrationTest
 
   %w(/arvados/v1/shoes /arvados/shoes /shoes /nodes /users).each do |path|
     test "non-existent route #{path}" do
-      get path, {:format => :json}, auth(:active)
+      get path, params: {:format => :json}, headers: auth(:active)
       assert_nil assigns(:objects)
       assert_nil assigns(:object)
       assert_not_nil json_response['errors']
index cf0261585a9a77cdace3268918f9f4c5614bff5c..e45dd4eb5213954631314dd3fdf57cf4ebc44beb 100644 (file)
@@ -9,12 +9,14 @@ class GroupsTest < ActionDispatch::IntegrationTest
     test "results are consistent when provided orders #{orders} is incomplete" do
       last = nil
       (0..20).each do
-        get '/arvados/v1/groups/contents', {
-          id: groups(:aproject).uuid,
-          filters: [["uuid", "is_a", "arvados#collection"]].to_json,
-          orders: orders.to_json,
-          format: :json,
-        }, auth(:active)
+        get '/arvados/v1/groups/contents',
+          params: {
+            id: groups(:aproject).uuid,
+            filters: [["uuid", "is_a", "arvados#collection"]].to_json,
+            orders: orders.to_json,
+            format: :json,
+          },
+          headers: auth(:active)
         assert_response :success
         if last.nil?
           last = json_response['items']
@@ -32,12 +34,14 @@ class GroupsTest < ActionDispatch::IntegrationTest
     uuid_received = {}
     owner_received = {}
     while true
-      get "/arvados/v1/groups/contents", {
-        id: groups(:aproject).uuid,
-        limit: limit,
-        offset: offset,
-        format: :json,
-      }, auth(:active)
+      get "/arvados/v1/groups/contents",
+        params: {
+          id: groups(:aproject).uuid,
+          limit: limit,
+          offset: offset,
+          format: :json,
+        },
+        headers: auth(:active)
 
       assert_response :success
       assert_operator(0, :<, json_response['items'].count,
@@ -71,11 +75,13 @@ class GroupsTest < ActionDispatch::IntegrationTest
     ['no-such-thing', false],         # script_parameter of pipeline instances
   ].each do |search_filter, expect_results|
     test "full text search of group-owned objects for #{search_filter}" do
-      get "/arvados/v1/groups/contents", {
-        id: groups(:aproject).uuid,
-        limit: 5,
-        :filters => [['any', '@@', search_filter]].to_json
-      }, auth(:active)
+      get "/arvados/v1/groups/contents",
+        params: {
+          id: groups(:aproject).uuid,
+          limit: 5,
+          :filters => [['any', '@@', search_filter]].to_json
+        },
+        headers: auth(:active)
       assert_response :success
       if expect_results
         refute_empty json_response['items']
@@ -90,18 +96,22 @@ class GroupsTest < ActionDispatch::IntegrationTest
   end
 
   test "full text search is not supported for individual columns" do
-    get "/arvados/v1/groups/contents", {
-      :filters => [['name', '@@', 'Private']].to_json
-    }, auth(:active)
+    get "/arvados/v1/groups/contents",
+      params: {
+        :filters => [['name', '@@', 'Private']].to_json
+      },
+      headers: auth(:active)
     assert_response 422
   end
 
   test "group contents with include trash collections" do
-    get "/arvados/v1/groups/contents", {
-      include_trash: "true",
-      filters: [["uuid", "is_a", "arvados#collection"]].to_json,
-      limit: 1000
-    }, auth(:active)
+    get "/arvados/v1/groups/contents",
+      params: {
+        include_trash: "true",
+        filters: [["uuid", "is_a", "arvados#collection"]].to_json,
+        limit: 1000
+      },
+      headers: auth(:active)
     assert_response 200
 
     coll_uuids = []
@@ -111,10 +121,12 @@ class GroupsTest < ActionDispatch::IntegrationTest
   end
 
   test "group contents without trash collections" do
-    get "/arvados/v1/groups/contents", {
-      filters: [["uuid", "is_a", "arvados#collection"]].to_json,
-      limit: 1000
-    }, auth(:active)
+    get "/arvados/v1/groups/contents",
+      params: {
+        filters: [["uuid", "is_a", "arvados#collection"]].to_json,
+        limit: 1000
+      },
+      headers: auth(:active)
     assert_response 200
 
     coll_uuids = []
@@ -122,6 +134,49 @@ class GroupsTest < ActionDispatch::IntegrationTest
     assert_includes coll_uuids, collections(:foo_collection_in_aproject).uuid
     assert_not_includes coll_uuids, collections(:expired_collection).uuid
   end
+
+  test "unsharing a project results in hiding it from previously shared user" do
+    # remove sharing link for project
+    delete "/arvados/v1/links/#{links(:share_starred_project_with_project_viewer).uuid}", headers: auth(:admin)
+    assert_response 200
+
+    # verify that the user can no longer see the project
+    get "/arvados/v1/groups",
+      params: {
+        filters: [['group_class', '=', 'project']].to_json,
+        limit: 1000
+      }, headers: auth(:project_viewer)
+    assert_response 200
+    found_projects = {}
+    json_response['items'].each do |g|
+      found_projects[g['uuid']] = g
+    end
+    assert_equal false, found_projects.include?(groups(:starred_and_shared_active_user_project).uuid)
+
+    # share the project
+    post "/arvados/v1/links", params: {
+      link: {
+        link_class: "permission",
+        name: "can_read",
+        head_uuid: groups(:starred_and_shared_active_user_project).uuid,
+        tail_uuid: users(:project_viewer).uuid,
+      }
+    }, headers: auth(:system_user)
+    assert_response 200
+    assert_equal 'permission', json_response['link_class']
+
+    # verify that project_viewer user can now see shared project again
+    get "/arvados/v1/groups", params: {
+      filters: [['group_class', '=', 'project']].to_json,
+      limit: 1000
+    }, headers: auth(:project_viewer)
+    assert_response 200
+    found_projects = {}
+    json_response['items'].each do |g|
+      found_projects[g['uuid']] = g
+    end
+    assert_equal true, found_projects.include?(groups(:starred_and_shared_active_user_project).uuid)
+  end
 end
 
 class NonTransactionalGroupsTest < ActionDispatch::IntegrationTest
@@ -130,11 +185,11 @@ class NonTransactionalGroupsTest < ActionDispatch::IntegrationTest
   # This is needed because nested transactions share the connection pool, so
   # one thread is locked while trying to talk to the database, until the other
   # one finishes.
-  self.use_transactional_fixtures = false
+  self.use_transactional_tests = false
 
   teardown do
     # Explicitly reset the database after each test.
-    post '/database/reset', {}, auth(:admin)
+    post '/database/reset', params: {}, headers: auth(:admin)
     assert_response :success
   end
 
@@ -144,29 +199,35 @@ class NonTransactionalGroupsTest < ActionDispatch::IntegrationTest
     assert_equal nil, Group.find_by_name(name)
 
     # Trigger the asynchronous permission update by using async=true parameter.
-    post "/arvados/v1/groups", {
-      group: {
-        name: name
+    post "/arvados/v1/groups",
+      params: {
+        group: {
+          name: name
+        },
+        async: true
       },
-      async: true
-    }, auth(:active)
+      headers: auth(:active)
     assert_response 202
 
     # The group exists on the database, but it's not accessible yet.
     assert_not_nil Group.find_by_name(name)
-    get "/arvados/v1/groups", {
-      filters: [["name", "=", name]].to_json,
-      limit: 10
-    }, auth(:active)
+    get "/arvados/v1/groups",
+      params: {
+        filters: [["name", "=", name]].to_json,
+        limit: 10
+      },
+      headers: auth(:active)
     assert_response 200
     assert_equal 0, json_response['items_available']
 
     # Wait a bit and try again.
     sleep(1)
-    get "/arvados/v1/groups", {
-      filters: [["name", "=", name]].to_json,
-      limit: 10
-    }, auth(:active)
+    get "/arvados/v1/groups",
+      params: {
+        filters: [["name", "=", name]].to_json,
+        limit: 10
+      },
+      headers: auth(:active)
     assert_response 200
     assert_equal 1, json_response['items_available']
   end
index b8b338f14b7db7be0fa76c6332f4ca9d289a5090..f5fb920b46d82e4e48bd06c5db1b145ebd5279b3 100644 (file)
@@ -8,29 +8,35 @@ class JobsApiTest < ActionDispatch::IntegrationTest
   fixtures :all
 
   test "cancel job" do
-    post "/arvados/v1/jobs/#{jobs(:running).uuid}/cancel", {:format => :json}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
+    post "/arvados/v1/jobs/#{jobs(:running).uuid}/cancel",
+      params: {:format => :json},
+      headers: {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
     assert_response :success
     assert_equal "arvados#job", json_response['kind']
     assert_not_nil json_response['cancelled_at']
   end
 
   test "cancel someone else's visible job" do
-    post "/arvados/v1/jobs/#{jobs(:runningbarbaz).uuid}/cancel", {:format => :json}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:spectator).api_token}"}
+    post "/arvados/v1/jobs/#{jobs(:runningbarbaz).uuid}/cancel",
+      params: {:format => :json},
+      headers: {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:spectator).api_token}"}
     assert_response 403
   end
 
   test "cancel someone else's invisible job" do
-    post "/arvados/v1/jobs/#{jobs(:running).uuid}/cancel", {:format => :json}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:spectator).api_token}"}
+    post "/arvados/v1/jobs/#{jobs(:running).uuid}/cancel",
+      params: {:format => :json},
+      headers: {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:spectator).api_token}"}
     assert_response 404
   end
 
   test "task qsequence values automatically increase monotonically" do
     post_args = ["/arvados/v1/job_tasks",
-                 {job_task: {
+                 params: {job_task: {
                      job_uuid: jobs(:running).uuid,
                      sequence: 1,
                    }},
-                 auth(:active)]
+                 headers: auth(:active)]
     last_qsequence = -1
     (1..3).each do |task_num|
       @response = nil
@@ -43,4 +49,43 @@ class JobsApiTest < ActionDispatch::IntegrationTest
       last_qsequence = qsequence
     end
   end
+
+  test 'get_delete components_get again for job with components' do
+    authorize_with :active
+    get "/arvados/v1/jobs/#{jobs(:running_job_with_components).uuid}",
+      headers: auth(:active)
+    assert_response 200
+    assert_not_nil json_response["components"]
+    assert_equal ["component1", "component2"], json_response["components"].keys
+
+    # delete second component
+    put "/arvados/v1/jobs/#{jobs(:running_job_with_components).uuid}", params: {
+      job: {
+        components: {"component1" => "zzzzz-8i9sb-jobuuid00000001"}
+      },
+      limit: 1000
+    }, headers: auth(:active)
+    assert_response 200
+
+    get "/arvados/v1/jobs/#{jobs(:running_job_with_components).uuid}",
+      headers: auth(:active)
+    assert_response 200
+    assert_not_nil json_response["components"]
+    assert_equal ["component1"], json_response["components"].keys
+
+    # delete all components
+    put "/arvados/v1/jobs/#{jobs(:running_job_with_components).uuid}", params: {
+      job: {
+        components: nil
+      },
+      limit: 1000
+    }, headers: auth(:active)
+    assert_response 200
+
+    get "/arvados/v1/jobs/#{jobs(:running_job_with_components).uuid}",
+      headers: auth(:active)
+    assert_response 200
+    assert_not_nil json_response["components"]
+    assert_equal [], json_response["components"].keys
+  end
 end
index 8c286eab466032128f39745b841ae93e09469425..664295175a1bd3374129956f23ccf61fb9767d38 100644 (file)
@@ -6,7 +6,9 @@ require 'test_helper'
 
 class KeepProxyTest < ActionDispatch::IntegrationTest
   test "request keep disks" do
-    get "/arvados/v1/keep_services/accessible", {:format => :json}, auth(:active)
+    get "/arvados/v1/keep_services/accessible",
+      params: {:format => :json},
+      headers: auth(:active)
     assert_response :success
     services = json_response['items']
 
@@ -17,7 +19,9 @@ class KeepProxyTest < ActionDispatch::IntegrationTest
   end
 
   test "request keep proxy" do
-    get "/arvados/v1/keep_services/accessible", {:format => :json}, auth(:active).merge({'HTTP_X_EXTERNAL_CLIENT' => '1'})
+    get "/arvados/v1/keep_services/accessible",
+      params: {:format => :json},
+      headers: auth(:active).merge({'HTTP_X_EXTERNAL_CLIENT' => '1'})
     assert_response :success
     services = json_response['items']
 
index 85b4cb746e6ddb12f459f0458761c371b1b75625..8691030e9d3c09e14a909ae0f0a3bd647a293212 100644 (file)
@@ -6,22 +6,25 @@ require 'test_helper'
 
 class LoginWorkflowTest < ActionDispatch::IntegrationTest
   test "default prompt to login is JSON" do
-    post('/arvados/v1/specimens', {specimen: {}},
-         {'HTTP_ACCEPT' => ''})
+    post('/arvados/v1/specimens',
+      params: {specimen: {}},
+      headers: {'HTTP_ACCEPT' => ''})
     assert_response 401
     assert_includes(json_response['errors'], "Not logged in")
   end
 
   test "login prompt respects JSON Accept header" do
-    post('/arvados/v1/specimens', {specimen: {}},
-         {'HTTP_ACCEPT' => 'application/json'})
+    post('/arvados/v1/specimens',
+      params: {specimen: {}},
+      headers: {'HTTP_ACCEPT' => 'application/json'})
     assert_response 401
     assert_includes(json_response['errors'], "Not logged in")
   end
 
   test "login prompt respects HTML Accept header" do
-    post('/arvados/v1/specimens', {specimen: {}},
-         {'HTTP_ACCEPT' => 'text/html'})
+    post('/arvados/v1/specimens',
+      params: {specimen: {}},
+      headers: {'HTTP_ACCEPT' => 'text/html'})
     assert_response 302
     assert_match(%r{/auth/joshid$}, @response.headers['Location'],
                  "HTML login prompt did not include expected redirect")
index 13b0fa66ffbc6991aa62bc0ac954bb9f55ab00b3..a94898ba22a83612b4913b31f3c900daf914e837 100644 (file)
@@ -21,22 +21,25 @@ class NoopDeepMungeTest < ActionDispatch::IntegrationTest
 
   def check(val)
     post "/arvados/v1/container_requests",
-         {
-           :container_request => {
-             :name => "workflow",
-             :state => "Uncommitted",
-             :command => ["echo"],
-             :container_image => "arvados/jobs",
-             :output_path => "/",
-             :mounts => {
-               :foo => {
-                 :kind => "json",
-                 :content => JSON.parse(SafeJSON.dump(val)),
-               }
-             }
-           }
-         }.to_json, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin).api_token}",
-                    'CONTENT_TYPE' => 'application/json'}
+      params: {
+        :container_request => {
+          :name => "workflow",
+          :state => "Uncommitted",
+          :command => ["echo"],
+          :container_image => "arvados/jobs",
+          :output_path => "/",
+          :mounts => {
+            :foo => {
+              :kind => "json",
+              :content => JSON.parse(SafeJSON.dump(val)),
+            }
+          }
+        }
+      }.to_json,
+      headers: {
+        'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin).api_token}",
+        'CONTENT_TYPE' => 'application/json'
+      }
     assert_response :success
     assert_equal "arvados#containerRequest", json_response['kind']
     assert_equal val, json_response['mounts']['foo']['content']
index 49fa473b6b9a08460fe805708ecea385e1a7f26b..eec41aa0857fd481d600c69fa51b9514241057cf 100644 (file)
@@ -11,100 +11,128 @@ class PermissionsTest < ActionDispatch::IntegrationTest
 
   test "adding and removing direct can_read links" do
     # try to read collection as spectator
-    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response 404
 
     # try to add permission as spectator
-    post "/arvados/v1/links", {
-      :format => :json,
-      :link => {
-        tail_uuid: users(:spectator).uuid,
-        link_class: 'permission',
-        name: 'can_read',
-        head_uuid: collections(:foo_file).uuid,
-        properties: {}
-      }
-    }, auth(:spectator)
+    post "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :link => {
+          tail_uuid: users(:spectator).uuid,
+          link_class: 'permission',
+          name: 'can_read',
+          head_uuid: collections(:foo_file).uuid,
+          properties: {}
+        }
+      },
+      headers: auth(:spectator)
     assert_response 422
 
     # add permission as admin
-    post "/arvados/v1/links", {
-      :format => :json,
-      :link => {
-        tail_uuid: users(:spectator).uuid,
-        link_class: 'permission',
-        name: 'can_read',
-        head_uuid: collections(:foo_file).uuid,
-        properties: {}
-      }
-    }, auth(:admin)
+    post "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :link => {
+          tail_uuid: users(:spectator).uuid,
+          link_class: 'permission',
+          name: 'can_read',
+          head_uuid: collections(:foo_file).uuid,
+          properties: {}
+        }
+      },
+      headers: auth(:admin)
     u = json_response['uuid']
     assert_response :success
 
     # read collection as spectator
-    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response :success
 
     # try to delete permission as spectator
-    delete "/arvados/v1/links/#{u}", {:format => :json}, auth(:spectator)
+    delete "/arvados/v1/links/#{u}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response 403
 
     # delete permission as admin
-    delete "/arvados/v1/links/#{u}", {:format => :json}, auth(:admin)
+    delete "/arvados/v1/links/#{u}",
+      params: {:format => :json},
+      headers: auth(:admin)
     assert_response :success
 
     # try to read collection as spectator
-    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response 404
   end
 
 
   test "adding can_read links from user to group, group to collection" do
     # try to read collection as spectator
-    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response 404
 
     # add permission for spectator to read group
-    post "/arvados/v1/links", {
-      :format => :json,
-      :link => {
-        tail_uuid: users(:spectator).uuid,
-        link_class: 'permission',
-        name: 'can_read',
-        head_uuid: groups(:private).uuid,
-        properties: {}
-      }
-    }, auth(:admin)
+    post "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :link => {
+          tail_uuid: users(:spectator).uuid,
+          link_class: 'permission',
+          name: 'can_read',
+          head_uuid: groups(:private).uuid,
+          properties: {}
+        }
+      },
+      headers: auth(:admin)
     assert_response :success
 
     # try to read collection as spectator
-    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response 404
 
     # add permission for group to read collection
-    post "/arvados/v1/links", {
-      :format => :json,
-      :link => {
-        tail_uuid: groups(:private).uuid,
-        link_class: 'permission',
-        name: 'can_read',
-        head_uuid: collections(:foo_file).uuid,
-        properties: {}
-      }
-    }, auth(:admin)
+    post "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :link => {
+          tail_uuid: groups(:private).uuid,
+          link_class: 'permission',
+          name: 'can_read',
+          head_uuid: collections(:foo_file).uuid,
+          properties: {}
+        }
+      },
+      headers: auth(:admin)
     u = json_response['uuid']
     assert_response :success
 
     # try to read collection as spectator
-    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response :success
 
     # delete permission for group to read collection
-    delete "/arvados/v1/links/#{u}", {:format => :json}, auth(:admin)
+    delete "/arvados/v1/links/#{u}",
+      params: {:format => :json},
+      headers: auth(:admin)
     assert_response :success
 
     # try to read collection as spectator
-    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response 404
 
   end
@@ -112,141 +140,175 @@ class PermissionsTest < ActionDispatch::IntegrationTest
 
   test "adding can_read links from group to collection, user to group" do
     # try to read collection as spectator
-    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response 404
 
     # add permission for group to read collection
-    post "/arvados/v1/links", {
-      :format => :json,
-      :link => {
-        tail_uuid: groups(:private).uuid,
-        link_class: 'permission',
-        name: 'can_read',
-        head_uuid: collections(:foo_file).uuid,
-        properties: {}
-      }
-    }, auth(:admin)
+    post "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :link => {
+          tail_uuid: groups(:private).uuid,
+          link_class: 'permission',
+          name: 'can_read',
+          head_uuid: collections(:foo_file).uuid,
+          properties: {}
+        }
+      },
+      headers: auth(:admin)
     assert_response :success
 
     # try to read collection as spectator
-    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response 404
 
     # add permission for spectator to read group
-    post "/arvados/v1/links", {
-      :format => :json,
-      :link => {
-        tail_uuid: users(:spectator).uuid,
-        link_class: 'permission',
-        name: 'can_read',
-        head_uuid: groups(:private).uuid,
-        properties: {}
-      }
-    }, auth(:admin)
+    post "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :link => {
+          tail_uuid: users(:spectator).uuid,
+          link_class: 'permission',
+          name: 'can_read',
+          head_uuid: groups(:private).uuid,
+          properties: {}
+        }
+      },
+      headers: auth(:admin)
     u = json_response['uuid']
     assert_response :success
 
     # try to read collection as spectator
-    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response :success
 
     # delete permission for spectator to read group
-    delete "/arvados/v1/links/#{u}", {:format => :json}, auth(:admin)
+    delete "/arvados/v1/links/#{u}",
+      params: {:format => :json},
+      headers: auth(:admin)
     assert_response :success
 
     # try to read collection as spectator
-    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response 404
 
   end
 
   test "adding can_read links from user to group, group to group, group to collection" do
     # try to read collection as spectator
-    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response 404
 
     # add permission for user to read group
-    post "/arvados/v1/links", {
-      :format => :json,
-      :link => {
-        tail_uuid: users(:spectator).uuid,
-        link_class: 'permission',
-        name: 'can_read',
-        head_uuid: groups(:private).uuid,
-        properties: {}
-      }
-    }, auth(:admin)
+    post "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :link => {
+          tail_uuid: users(:spectator).uuid,
+          link_class: 'permission',
+          name: 'can_read',
+          head_uuid: groups(:private).uuid,
+          properties: {}
+        }
+      },
+      headers: auth(:admin)
     assert_response :success
 
     # add permission for group to read group
-    post "/arvados/v1/links", {
-      :format => :json,
-      :link => {
-        tail_uuid: groups(:private).uuid,
-        link_class: 'permission',
-        name: 'can_read',
-        head_uuid: groups(:empty_lonely_group).uuid,
-        properties: {}
-      }
-    }, auth(:admin)
+    post "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :link => {
+          tail_uuid: groups(:private).uuid,
+          link_class: 'permission',
+          name: 'can_read',
+          head_uuid: groups(:empty_lonely_group).uuid,
+          properties: {}
+        }
+      },
+      headers: auth(:admin)
     assert_response :success
 
     # add permission for group to read collection
-    post "/arvados/v1/links", {
-      :format => :json,
-      :link => {
-        tail_uuid: groups(:empty_lonely_group).uuid,
-        link_class: 'permission',
-        name: 'can_read',
-        head_uuid: collections(:foo_file).uuid,
-        properties: {}
-      }
-    }, auth(:admin)
+    post "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :link => {
+          tail_uuid: groups(:empty_lonely_group).uuid,
+          link_class: 'permission',
+          name: 'can_read',
+          head_uuid: collections(:foo_file).uuid,
+          properties: {}
+        }
+      },
+      headers: auth(:admin)
     u = json_response['uuid']
     assert_response :success
 
     # try to read collection as spectator
-    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response :success
 
     # delete permission for group to read collection
-    delete "/arvados/v1/links/#{u}", {:format => :json}, auth(:admin)
+    delete "/arvados/v1/links/#{u}",
+      params: {:format => :json},
+      headers: auth(:admin)
     assert_response :success
 
     # try to read collection as spectator
-    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}",
+      params: {:format => :json},
+      headers: auth(:spectator)
     assert_response 404
   end
 
   test "read-only group-admin cannot modify administered user" do
-    put "/arvados/v1/users/#{users(:active).uuid}", {
-      :user => {
-        first_name: 'KilroyWasHere'
+    put "/arvados/v1/users/#{users(:active).uuid}",
+      params: {
+        :user => {
+          first_name: 'KilroyWasHere'
+        },
+        :format => :json
       },
-      :format => :json
-    }, auth(:rominiadmin)
+      headers: auth(:rominiadmin)
     assert_response 403
   end
 
   test "read-only group-admin cannot read or update non-administered user" do
-    get "/arvados/v1/users/#{users(:spectator).uuid}", {
-      :format => :json
-    }, auth(:rominiadmin)
+    get "/arvados/v1/users/#{users(:spectator).uuid}",
+      params: {:format => :json},
+      headers: auth(:rominiadmin)
     assert_response 404
 
-    put "/arvados/v1/users/#{users(:spectator).uuid}", {
-      :user => {
-        first_name: 'KilroyWasHere'
+    put "/arvados/v1/users/#{users(:spectator).uuid}",
+      params: {
+        :user => {
+          first_name: 'KilroyWasHere'
+        },
+        :format => :json
       },
-      :format => :json
-    }, auth(:rominiadmin)
+      headers: auth(:rominiadmin)
     assert_response 404
   end
 
   test "RO group-admin finds user's specimens, RW group-admin can update" do
     [[:rominiadmin, false],
      [:miniadmin, true]].each do |which_user, update_should_succeed|
-      get "/arvados/v1/specimens", {:format => :json}, auth(which_user)
+      get "/arvados/v1/specimens",
+        params: {:format => :json},
+        headers: auth(which_user)
       assert_response :success
       resp_uuids = json_response['items'].collect { |i| i['uuid'] }
       [[true, specimens(:owned_by_active_user).uuid],
@@ -258,14 +320,16 @@ class PermissionsTest < ActionDispatch::IntegrationTest
                      [which_user.to_s,
                       should_find ? '' : 'not ',
                       uuid])
-        put "/arvados/v1/specimens/#{uuid}", {
-          :specimen => {
-            properties: {
-              miniadmin_was_here: true
-            }
+        put "/arvados/v1/specimens/#{uuid}",
+          params: {
+            :specimen => {
+              properties: {
+                miniadmin_was_here: true
+              }
+            },
+            :format => :json
           },
-          :format => :json
-        }, auth(which_user)
+          headers: auth(which_user)
         if !should_find
           assert_response 404
         elsif !update_should_succeed
@@ -279,55 +343,63 @@ class PermissionsTest < ActionDispatch::IntegrationTest
 
   test "get_permissions returns list" do
     # First confirm that user :active cannot get permissions on group :public
-    get "/arvados/v1/permissions/#{groups(:public).uuid}", nil, auth(:active)
+    get "/arvados/v1/permissions/#{groups(:public).uuid}",
+      params: nil,
+      headers: auth(:active)
     assert_response 404
 
     # add some permissions, including can_manage
     # permission for user :active
-    post "/arvados/v1/links", {
-      :format => :json,
-      :link => {
-        tail_uuid: users(:spectator).uuid,
-        link_class: 'permission',
-        name: 'can_read',
-        head_uuid: groups(:public).uuid,
-        properties: {}
-      }
-    }, auth(:admin)
+    post "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :link => {
+          tail_uuid: users(:spectator).uuid,
+          link_class: 'permission',
+          name: 'can_read',
+          head_uuid: groups(:public).uuid,
+          properties: {}
+        }
+      },
+      headers: auth(:admin)
     assert_response :success
     can_read_uuid = json_response['uuid']
 
-    post "/arvados/v1/links", {
-      :format => :json,
-      :link => {
-        tail_uuid: users(:inactive).uuid,
-        link_class: 'permission',
-        name: 'can_write',
-        head_uuid: groups(:public).uuid,
-        properties: {}
-      }
-    }, auth(:admin)
+    post "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :link => {
+          tail_uuid: users(:inactive).uuid,
+          link_class: 'permission',
+          name: 'can_write',
+          head_uuid: groups(:public).uuid,
+          properties: {}
+        }
+      },
+      headers: auth(:admin)
     assert_response :success
     can_write_uuid = json_response['uuid']
 
-    post "/arvados/v1/links", {
-      :format => :json,
-      :link => {
-        tail_uuid: users(:active).uuid,
-        link_class: 'permission',
-        name: 'can_manage',
-        head_uuid: groups(:public).uuid,
-        properties: {}
-      }
-    }, auth(:admin)
+    post "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :link => {
+          tail_uuid: users(:active).uuid,
+          link_class: 'permission',
+          name: 'can_manage',
+          head_uuid: groups(:public).uuid,
+          properties: {}
+        }
+      },
+      headers: auth(:admin)
     assert_response :success
     can_manage_uuid = json_response['uuid']
 
     # Now user :active should be able to retrieve permissions
     # on group :public.
     get("/arvados/v1/permissions/#{groups(:public).uuid}",
-        { :format => :json },
-        auth(:active))
+      params: { :format => :json },
+      headers: auth(:active))
     assert_response :success
 
     perm_uuids = json_response['items'].map { |item| item['uuid'] }
@@ -339,26 +411,30 @@ class PermissionsTest < ActionDispatch::IntegrationTest
   test "get_permissions returns 404 for nonexistent uuid" do
     nonexistent = Group.generate_uuid
     # make sure it really doesn't exist
-    get "/arvados/v1/groups/#{nonexistent}", nil, auth(:admin)
+    get "/arvados/v1/groups/#{nonexistent}", params: nil, headers: auth(:admin)
     assert_response 404
 
-    get "/arvados/v1/permissions/#{nonexistent}", nil, auth(:active)
+    get "/arvados/v1/permissions/#{nonexistent}", params: nil, headers: auth(:active)
     assert_response 404
   end
 
   test "get_permissions returns 403 if user can read but not manage" do
-    post "/arvados/v1/links", {
-      :link => {
-        tail_uuid: users(:active).uuid,
-        link_class: 'permission',
-        name: 'can_read',
-        head_uuid: groups(:public).uuid,
-        properties: {}
-      }
-    }, auth(:admin)
+    post "/arvados/v1/links",
+      params: {
+        :link => {
+          tail_uuid: users(:active).uuid,
+          link_class: 'permission',
+          name: 'can_read',
+          head_uuid: groups(:public).uuid,
+          properties: {}
+        }
+      },
+      headers: auth(:admin)
     assert_response :success
 
-    get "/arvados/v1/permissions/#{groups(:public).uuid}", nil, auth(:active)
+    get "/arvados/v1/permissions/#{groups(:public).uuid}",
+      params: nil,
+      headers: auth(:active)
     assert_response 403
   end
 
@@ -366,8 +442,8 @@ class PermissionsTest < ActionDispatch::IntegrationTest
     # The active user should be able to read the empty collection.
 
     get("/arvados/v1/collections/#{empty_collection_uuid}",
-        { :format => :json },
-        auth(:active))
+      params: {:format => :json},
+      headers: auth(:active))
     assert_response :success
     assert_empty json_response['manifest_text'], "empty collection manifest_text is not empty"
   end
index 1e9a4d5c649eed79d0676082d42daa8b46b98ea7..d4f7eba30265ca52d8006983665fdc17e37623b0 100644 (file)
@@ -28,13 +28,17 @@ class PipelineIntegrationTest < ActionDispatch::IntegrationTest
     }
 
     post("/arvados/v1/pipeline_instances",
-         {pipeline_instance: {components: {comp_name => component}}.to_json},
-         auth(:active))
+      params: {
+        pipeline_instance: {
+          components: {comp_name => component}
+        }.to_json
+      },
+      headers: auth(:active))
     check_component_match(comp_name, component)
     pi_uuid = json_response["uuid"]
 
     @response = nil
-    get("/arvados/v1/pipeline_instances/#{pi_uuid}", {}, auth(:active))
+    get("/arvados/v1/pipeline_instances/#{pi_uuid}", params: {}, headers: auth(:active))
     check_component_match(comp_name, component)
   end
 end
index a60be093a31f033f15d4dbb96a22d4f35da0dda2..e8e8c910c7153a73411cb6602322a6ec64cf8f60 100644 (file)
@@ -16,7 +16,7 @@ class ReaderTokensTest < ActionDispatch::IntegrationTest
     params[:reader_tokens] = [api_token(read_auth)].send(formatter) if read_auth
     headers = {}
     headers.merge!(auth(main_auth)) if main_auth
-    get('/arvados/v1/specimens', params, headers)
+    get('/arvados/v1/specimens', params: params, headers: headers)
   end
 
   def get_specimen_uuids(main_auth, read_auth, formatter=:to_a)
@@ -34,8 +34,8 @@ class ReaderTokensTest < ActionDispatch::IntegrationTest
       expected = 401
     end
     post('/arvados/v1/specimens.json',
-         {specimen: {}, reader_tokens: [api_token(read_auth)].send(formatter)},
-         headers)
+      params: {specimen: {}, reader_tokens: [api_token(read_auth)].send(formatter)},
+      headers: headers)
     assert_response expected
   end
 
@@ -65,8 +65,8 @@ class ReaderTokensTest < ActionDispatch::IntegrationTest
 
   test "scopes are still limited with reader tokens" do
     get('/arvados/v1/collections',
-        {reader_tokens: [api_token(:spectator_specimens)]},
-        auth(:active_noscope))
+      params: {reader_tokens: [api_token(:spectator_specimens)]},
+      headers: auth(:active_noscope))
     assert_response 403
   end
 
index 44737524e5f583cb76bb62a6aa0ff8af5ca91319..5c09cf1bcc6e274eb713b2cf7988263d53020790 100644 (file)
@@ -81,7 +81,9 @@ class RemoteUsersTest < ActionDispatch::IntegrationTest
   end
 
   test 'authenticate with remote token' do
-    get '/arvados/v1/users/current', {format: 'json'}, auth(remote: 'zbbbb')
+    get '/arvados/v1/users/current',
+      params: {format: 'json'},
+      headers: auth(remote: 'zbbbb')
     assert_response :success
     assert_equal 'zbbbb-tpzed-000000000000000', json_response['uuid']
     assert_equal false, json_response['is_admin']
@@ -93,7 +95,9 @@ class RemoteUsersTest < ActionDispatch::IntegrationTest
     @stub_status = 401
 
     # re-authorize before cache expires
-    get '/arvados/v1/users/current', {format: 'json'}, auth(remote: 'zbbbb')
+    get '/arvados/v1/users/current',
+      params: {format: 'json'},
+      headers: auth(remote: 'zbbbb')
     assert_response :success
 
     # simulate cache expiry
@@ -102,7 +106,9 @@ class RemoteUsersTest < ActionDispatch::IntegrationTest
       update_all(expires_at: db_current_time - 1.minute)
 
     # re-authorize after cache expires
-    get '/arvados/v1/users/current', {format: 'json'}, auth(remote: 'zbbbb')
+    get '/arvados/v1/users/current',
+      params: {format: 'json'},
+      headers: auth(remote: 'zbbbb')
     assert_response 401
 
     # simulate cached token indicating wrong user (e.g., local user
@@ -116,7 +122,9 @@ class RemoteUsersTest < ActionDispatch::IntegrationTest
     @stub_status = 200
     @stub_content[:username] = 'blarney'
     @stub_content[:email] = 'blarney@example.com'
-    get '/arvados/v1/users/current', {format: 'json'}, auth(remote: 'zbbbb')
+    get '/arvados/v1/users/current',
+      params: {format: 'json'},
+      headers: auth(remote: 'zbbbb')
     assert_response :success
     assert_equal 'barney', json_response['username'], 'local username should not change once assigned'
     assert_equal 'blarney@example.com', json_response['email']
@@ -124,20 +132,26 @@ class RemoteUsersTest < ActionDispatch::IntegrationTest
 
   test 'authenticate with remote token, remote username conflicts with local' do
     @stub_content[:username] = 'active'
-    get '/arvados/v1/users/current', {format: 'json'}, auth(remote: 'zbbbb')
+    get '/arvados/v1/users/current',
+      params: {format: 'json'},
+      headers: auth(remote: 'zbbbb')
     assert_response :success
     assert_equal 'active2', json_response['username']
   end
 
   test 'authenticate with remote token, remote username is nil' do
     @stub_content.delete :username
-    get '/arvados/v1/users/current', {format: 'json'}, auth(remote: 'zbbbb')
+    get '/arvados/v1/users/current',
+      params: {format: 'json'},
+      headers: auth(remote: 'zbbbb')
     assert_response :success
     assert_equal 'foo', json_response['username']
   end
 
   test 'authenticate with remote token from misbhehaving remote cluster' do
-    get '/arvados/v1/users/current', {format: 'json'}, auth(remote: 'zbork')
+    get '/arvados/v1/users/current',
+      params: {format: 'json'},
+      headers: auth(remote: 'zbork')
     assert_response 401
   end
 
@@ -146,7 +160,9 @@ class RemoteUsersTest < ActionDispatch::IntegrationTest
     @stub_content = {
       error: 'not authorized',
     }
-    get '/arvados/v1/users/current', {format: 'json'}, auth(remote: 'zbbbb')
+    get '/arvados/v1/users/current',
+      params: {format: 'json'},
+      headers: auth(remote: 'zbbbb')
     assert_response 401
   end
 
@@ -169,30 +185,36 @@ class RemoteUsersTest < ActionDispatch::IntegrationTest
    '///',
   ].each do |token|
     test "authenticate with malformed remote token #{token}" do
-      get '/arvados/v1/users/current', {format: 'json'}, {"HTTP_AUTHORIZATION" => "Bearer #{token}"}
+      get '/arvados/v1/users/current',
+        params: {format: 'json'},
+        headers: {"HTTP_AUTHORIZATION" => "Bearer #{token}"}
       assert_response 401
     end
   end
 
   test "ignore extra fields in remote token" do
     token = salted_active_token(remote: 'zbbbb') + '/foo/bar/baz/*'
-    get '/arvados/v1/users/current', {format: 'json'}, {"HTTP_AUTHORIZATION" => "Bearer #{token}"}
+    get '/arvados/v1/users/current',
+      params: {format: 'json'},
+      headers: {"HTTP_AUTHORIZATION" => "Bearer #{token}"}
     assert_response :success
   end
 
   test 'remote api server is not an api server' do
     @stub_status = 200
     @stub_content = '<html>bad</html>'
-    get '/arvados/v1/users/current', {format: 'json'}, auth(remote: 'zbbbb')
+    get '/arvados/v1/users/current',
+      params: {format: 'json'},
+      headers: auth(remote: 'zbbbb')
     assert_response 401
   end
 
   ['zbbbb', 'z0000'].each do |token_valid_for|
     test "validate #{token_valid_for}-salted token for remote cluster zbbbb" do
       salted_token = salt_token(fixture: :active, remote: token_valid_for)
-      get '/arvados/v1/users/current', {format: 'json', remote: 'zbbbb'}, {
-            "HTTP_AUTHORIZATION" => "Bearer #{salted_token}"
-          }
+      get '/arvados/v1/users/current',
+        params: {format: 'json', remote: 'zbbbb'},
+        headers: {"HTTP_AUTHORIZATION" => "Bearer #{salted_token}"}
       if token_valid_for == 'zbbbb'
         assert_response 200
         assert_equal(users(:active).uuid, json_response['uuid'])
@@ -204,13 +226,13 @@ class RemoteUsersTest < ActionDispatch::IntegrationTest
 
   test "list readable groups with salted token" do
     salted_token = salt_token(fixture: :active, remote: 'zbbbb')
-    get '/arvados/v1/groups', {
-          format: 'json',
-          remote: 'zbbbb',
-          limit: 10000,
-        }, {
-          "HTTP_AUTHORIZATION" => "Bearer #{salted_token}"
-        }
+    get '/arvados/v1/groups',
+      params: {
+        format: 'json',
+        remote: 'zbbbb',
+        limit: 10000,
+      },
+      headers: {"HTTP_AUTHORIZATION" => "Bearer #{salted_token}"}
     assert_response 200
     group_uuids = json_response['items'].collect { |i| i['uuid'] }
     assert_includes(group_uuids, 'zzzzz-j7d0g-fffffffffffffff')
@@ -222,7 +244,9 @@ class RemoteUsersTest < ActionDispatch::IntegrationTest
 
   test 'auto-activate user from trusted cluster' do
     Rails.configuration.auto_activate_users_from = ['zbbbb']
-    get '/arvados/v1/users/current', {format: 'json'}, auth(remote: 'zbbbb')
+    get '/arvados/v1/users/current',
+      params: {format: 'json'},
+      headers: auth(remote: 'zbbbb')
     assert_response :success
     assert_equal 'zbbbb-tpzed-000000000000000', json_response['uuid']
     assert_equal false, json_response['is_admin']
@@ -232,17 +256,21 @@ class RemoteUsersTest < ActionDispatch::IntegrationTest
   end
 
   test 'pre-activate remote user' do
-    post '/arvados/v1/users', {
-           "user" => {
-             "uuid" => "zbbbb-tpzed-000000000000000",
-             "email" => 'foo@example.com',
-             "username" => 'barney',
-             "is_active" => true
-           }
-    }, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_token(:admin)}"}
+    post '/arvados/v1/users',
+      params: {
+        "user" => {
+          "uuid" => "zbbbb-tpzed-000000000000000",
+          "email" => 'foo@example.com',
+          "username" => 'barney',
+          "is_active" => true
+        }
+      },
+      headers: {'HTTP_AUTHORIZATION' => "OAuth2 #{api_token(:admin)}"}
     assert_response :success
 
-    get '/arvados/v1/users/current', {format: 'json'}, auth(remote: 'zbbbb')
+    get '/arvados/v1/users/current',
+      params: {format: 'json'},
+      headers: auth(remote: 'zbbbb')
     assert_response :success
     assert_equal 'zbbbb-tpzed-000000000000000', json_response['uuid']
     assert_equal nil, json_response['is_admin']
@@ -254,9 +282,9 @@ class RemoteUsersTest < ActionDispatch::IntegrationTest
   test "validate unsalted v2 token for remote cluster zbbbb" do
     auth = api_client_authorizations(:active)
     token = "v2/#{auth.uuid}/#{auth.api_token}"
-    get '/arvados/v1/users/current', {format: 'json', remote: 'zbbbb'}, {
-          "HTTP_AUTHORIZATION" => "Bearer #{token}"
-        }
+    get '/arvados/v1/users/current',
+      params: {format: 'json', remote: 'zbbbb'},
+      headers: {"HTTP_AUTHORIZATION" => "Bearer #{token}"}
     assert_response :success
     assert_equal(users(:active).uuid, json_response['uuid'])
   end
@@ -267,15 +295,17 @@ class RemoteUsersTest < ActionDispatch::IntegrationTest
      ["invalid local", "v2/#{api_client_authorizations(:active).uuid}/fakefakefake"],
      ["invalid remote", "v2/zbork-gj3su-000000000000000/abc"],
     ].each do |label, runtime_token|
-      post '/arvados/v1/container_requests', {
-             "container_request" => {
-               "command" => ["echo"],
-               "container_image" => "xyz",
-               "output_path" => "/",
-               "cwd" => "/",
-               "runtime_token" => runtime_token
-             }
-           }, {"HTTP_AUTHORIZATION" => "Bearer #{api_client_authorizations(:active).api_token}"}
+      post '/arvados/v1/container_requests',
+        params: {
+          "container_request" => {
+            "command" => ["echo"],
+            "container_image" => "xyz",
+            "output_path" => "/",
+            "cwd" => "/",
+            "runtime_token" => runtime_token
+          }
+        },
+        headers: {"HTTP_AUTHORIZATION" => "Bearer #{api_client_authorizations(:active).api_token}"}
       if label.include? "invalid"
         assert_response 422
       else
index fb3f4f617adef8afb6f82726b8b030f45227624e..7fbab3b3b00e484a5653435452f7d620178af251 100644 (file)
@@ -6,7 +6,9 @@ require 'test_helper'
 
 class SelectTest < ActionDispatch::IntegrationTest
   test "should select just two columns" do
-    get "/arvados/v1/links", {:format => :json, :select => ['uuid', 'link_class']}, auth(:active)
+    get "/arvados/v1/links",
+      params: {:format => :json, :select => ['uuid', 'link_class']},
+      headers: auth(:active)
     assert_response :success
     assert_equal json_response['items'].count, json_response['items'].select { |i|
       i.count == 3 and i['uuid'] != nil and i['link_class'] != nil
@@ -14,11 +16,15 @@ class SelectTest < ActionDispatch::IntegrationTest
   end
 
   test "fewer distinct than total count" do
-    get "/arvados/v1/links", {:format => :json, :select => ['link_class'], :distinct => false}, auth(:active)
+    get "/arvados/v1/links",
+      params: {:format => :json, :select => ['link_class'], :distinct => false},
+      headers: auth(:active)
     assert_response :success
     links = json_response['items']
 
-    get "/arvados/v1/links", {:format => :json, :select => ['link_class'], :distinct => true}, auth(:active)
+    get "/arvados/v1/links",
+      params: {:format => :json, :select => ['link_class'], :distinct => true},
+      headers: auth(:active)
     assert_response :success
     distinct = json_response['items']
 
@@ -28,7 +34,9 @@ class SelectTest < ActionDispatch::IntegrationTest
   end
 
   test "select with order" do
-    get "/arvados/v1/links", {:format => :json, :select => ['uuid'], :order => ["uuid asc"]}, auth(:active)
+    get "/arvados/v1/links",
+      params: {:format => :json, :select => ['uuid'], :order => ["uuid asc"]},
+      headers: auth(:active)
     assert_response :success
 
     assert json_response['items'].length > 0
@@ -41,7 +49,9 @@ class SelectTest < ActionDispatch::IntegrationTest
   end
 
   test "select with default order" do
-    get "/arvados/v1/links", {format: :json, select: ['uuid']}, auth(:admin)
+    get "/arvados/v1/links",
+      params: {format: :json, select: ['uuid']},
+      headers: auth(:admin)
     assert_response :success
     uuids = json_response['items'].collect { |i| i['uuid'] }
     assert_equal uuids, uuids.sort
@@ -58,7 +68,12 @@ class SelectTest < ActionDispatch::IntegrationTest
   end
 
   test "select two columns with order" do
-    get "/arvados/v1/links", {:format => :json, :select => ['link_class', 'uuid'], :order => ['link_class asc', "uuid desc"]}, auth(:active)
+    get "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :select => ['link_class', 'uuid'], :order => ['link_class asc', "uuid desc"]
+      },
+      headers: auth(:active)
     assert_response :success
 
     assert json_response['items'].length > 0
@@ -80,7 +95,12 @@ class SelectTest < ActionDispatch::IntegrationTest
   end
 
   test "select two columns with old-style order syntax" do
-    get "/arvados/v1/links", {:format => :json, :select => ['link_class', 'uuid'], :order => 'link_class asc, uuid desc'}, auth(:active)
+    get "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :select => ['link_class', 'uuid'], :order => 'link_class asc, uuid desc'
+      },
+      headers: auth(:active)
     assert_response :success
 
     assert json_response['items'].length > 0
index d7599bc00f5e55367f41cf7e3332dc99b1ec0dd6..16d43e6f3c61b9fc99edbe4c580e9f90bb227323 100644 (file)
@@ -48,7 +48,8 @@ class SerializedEncodingTest < ActionDispatch::IntegrationTest
   }.each_pair do |resource, postdata|
     test "create json-encoded #{resource.to_s}" do
       post("/arvados/v1/#{resource.to_s.pluralize}",
-           {resource => postdata.to_json}, auth(:admin_trustedclient))
+        params: {resource => postdata.to_json},
+        headers: auth(:admin_trustedclient))
       assert_response :success
     end
   end
index f5085999ec5681d9da56f5244bd204e5473246dd..f2dbaa5069528f50e6d37c0d441c1d6c0f797878 100644 (file)
@@ -28,8 +28,8 @@ class UserSessionsApiTest < ActionDispatch::IntegrationTest
     mock['info']['username'] = username unless username.nil?
     mock['info']['identity_url'] = identity_url unless identity_url.nil?
     post('/auth/josh_id/callback',
-         {return_to: client_url(remote: remote)},
-         {'omniauth.auth' => mock})
+      params: {return_to: client_url(remote: remote)},
+      headers: {'omniauth.auth' => mock})
 
     errors = {
       :redirect => 'Did not redirect to client with token',
index 28e43b84506f492b7c3f88c73a0b461eda40ea51..5886fb2d08965ee494898a4bf1ca06cfc70a18f2 100644 (file)
@@ -11,16 +11,18 @@ class UsersTest < ActionDispatch::IntegrationTest
   test "setup user multiple times" do
     repo_name = 'usertestrepo'
 
-    post "/arvados/v1/users/setup", {
-      repo_name: repo_name,
-      openid_prefix: 'https://www.google.com/accounts/o8/id',
-      user: {
-        uuid: 'zzzzz-tpzed-abcdefghijklmno',
-        first_name: "in_create_test_first_name",
-        last_name: "test_last_name",
-        email: "foo@example.com"
-      }
-    }, auth(:admin)
+    post "/arvados/v1/users/setup",
+      params: {
+        repo_name: repo_name,
+        openid_prefix: 'https://www.google.com/accounts/o8/id',
+        user: {
+          uuid: 'zzzzz-tpzed-abcdefghijklmno',
+          first_name: "in_create_test_first_name",
+          last_name: "test_last_name",
+          email: "foo@example.com"
+        }
+      },
+      headers: auth(:admin)
 
     assert_response :success
 
@@ -50,26 +52,30 @@ class UsersTest < ActionDispatch::IntegrationTest
     verify_system_group_permission_link_for created['uuid']
 
     # invoke setup again with the same data
-    post "/arvados/v1/users/setup", {
-      repo_name: repo_name,
-      vm_uuid: virtual_machines(:testvm).uuid,
-      openid_prefix: 'https://www.google.com/accounts/o8/id',
-      user: {
-        uuid: 'zzzzz-tpzed-abcdefghijklmno',
-        first_name: "in_create_test_first_name",
-        last_name: "test_last_name",
-        email: "foo@example.com"
-      }
-    }, auth(:admin)
+    post "/arvados/v1/users/setup",
+      params: {
+        repo_name: repo_name,
+        vm_uuid: virtual_machines(:testvm).uuid,
+        openid_prefix: 'https://www.google.com/accounts/o8/id',
+        user: {
+          uuid: 'zzzzz-tpzed-abcdefghijklmno',
+          first_name: "in_create_test_first_name",
+          last_name: "test_last_name",
+          email: "foo@example.com"
+        }
+      },
+      headers: auth(:admin)
     assert_response 422         # cannot create another user with same UUID
 
     # invoke setup on the same user
-    post "/arvados/v1/users/setup", {
-      repo_name: repo_name,
-      vm_uuid: virtual_machines(:testvm).uuid,
-      openid_prefix: 'https://www.google.com/accounts/o8/id',
-      uuid: 'zzzzz-tpzed-abcdefghijklmno',
-    }, auth(:admin)
+    post "/arvados/v1/users/setup",
+      params: {
+        repo_name: repo_name,
+        vm_uuid: virtual_machines(:testvm).uuid,
+        openid_prefix: 'https://www.google.com/accounts/o8/id',
+        uuid: 'zzzzz-tpzed-abcdefghijklmno',
+      },
+      headers: auth(:admin)
 
     response_items = json_response['items']
 
@@ -94,12 +100,14 @@ class UsersTest < ActionDispatch::IntegrationTest
   end
 
   test "setup user in multiple steps and verify response" do
-    post "/arvados/v1/users/setup", {
-      openid_prefix: 'http://www.example.com/account',
-      user: {
-        email: "foo@example.com"
-      }
-    }, auth(:admin)
+    post "/arvados/v1/users/setup",
+      params: {
+        openid_prefix: 'http://www.example.com/account',
+        user: {
+          email: "foo@example.com"
+        }
+      },
+      headers: auth(:admin)
 
     assert_response :success
     response_items = json_response['items']
@@ -120,11 +128,13 @@ class UsersTest < ActionDispatch::IntegrationTest
         nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
 
    # invoke setup with a repository
-    post "/arvados/v1/users/setup", {
-      openid_prefix: 'http://www.example.com/account',
-      repo_name: 'newusertestrepo',
-      uuid: created['uuid']
-    }, auth(:admin)
+    post "/arvados/v1/users/setup",
+      params: {
+        openid_prefix: 'http://www.example.com/account',
+        repo_name: 'newusertestrepo',
+        uuid: created['uuid']
+      },
+      headers: auth(:admin)
 
     assert_response :success
 
@@ -144,14 +154,16 @@ class UsersTest < ActionDispatch::IntegrationTest
         nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
 
     # invoke setup with a vm_uuid
-    post "/arvados/v1/users/setup", {
-      vm_uuid: virtual_machines(:testvm).uuid,
-      openid_prefix: 'http://www.example.com/account',
-      user: {
-        email: 'junk_email'
+    post "/arvados/v1/users/setup",
+      params: {
+        vm_uuid: virtual_machines(:testvm).uuid,
+        openid_prefix: 'http://www.example.com/account',
+        user: {
+          email: 'junk_email'
+        },
+        uuid: created['uuid']
       },
-      uuid: created['uuid']
-    }, auth(:admin)
+      headers: auth(:admin)
 
     assert_response :success
 
@@ -169,12 +181,14 @@ class UsersTest < ActionDispatch::IntegrationTest
   end
 
   test "setup and unsetup user" do
-    post "/arvados/v1/users/setup", {
-      repo_name: 'newusertestrepo',
-      vm_uuid: virtual_machines(:testvm).uuid,
-      user: {email: 'foo@example.com'},
-      openid_prefix: 'https://www.google.com/accounts/o8/id'
-    }, auth(:admin)
+    post "/arvados/v1/users/setup",
+      params: {
+        repo_name: 'newusertestrepo',
+        vm_uuid: virtual_machines(:testvm).uuid,
+        user: {email: 'foo@example.com'},
+        openid_prefix: 'https://www.google.com/accounts/o8/id'
+      },
+      headers: auth(:admin)
 
     assert_response :success
     response_items = json_response['items']
@@ -197,7 +211,7 @@ class UsersTest < ActionDispatch::IntegrationTest
 
     verify_link_existence created['uuid'], created['email'], true, true, true, true, false
 
-    post "/arvados/v1/users/#{created['uuid']}/unsetup", {}, auth(:admin)
+    post "/arvados/v1/users/#{created['uuid']}/unsetup", params: {}, headers: auth(:admin)
 
     assert_response :success
 
@@ -218,36 +232,46 @@ class UsersTest < ActionDispatch::IntegrationTest
   end
 
   test 'merge active into project_viewer account' do
-    post('/arvados/v1/groups', {
-           group: {
-             group_class: 'project',
-             name: "active user's stuff",
-           },
-         }, auth(:project_viewer))
+    post('/arvados/v1/groups',
+      params: {
+        group: {
+          group_class: 'project',
+          name: "active user's stuff",
+        },
+      },
+      headers: auth(:project_viewer))
     assert_response(:success)
     project_uuid = json_response['uuid']
 
-    post('/arvados/v1/users/merge', {
-           new_user_token: api_client_authorizations(:project_viewer_trustedclient).api_token,
-           new_owner_uuid: project_uuid,
-           redirect_to_new_user: true,
-         }, auth(:active_trustedclient))
+    post('/arvados/v1/users/merge',
+      params: {
+        new_user_token: api_client_authorizations(:project_viewer_trustedclient).api_token,
+        new_owner_uuid: project_uuid,
+        redirect_to_new_user: true,
+      },
+      headers: auth(:active_trustedclient))
     assert_response(:success)
 
-    get('/arvados/v1/users/current', {}, auth(:active))
+    get('/arvados/v1/users/current', params: {}, headers: auth(:active))
     assert_response(:success)
     assert_equal(users(:project_viewer).uuid, json_response['uuid'])
 
-    get('/arvados/v1/authorized_keys/' + authorized_keys(:active).uuid, {}, auth(:active))
+    get('/arvados/v1/authorized_keys/' + authorized_keys(:active).uuid,
+      params: {},
+      headers: auth(:active))
     assert_response(:success)
     assert_equal(users(:project_viewer).uuid, json_response['owner_uuid'])
     assert_equal(users(:project_viewer).uuid, json_response['authorized_user_uuid'])
 
-    get('/arvados/v1/repositories/' + repositories(:foo).uuid, {}, auth(:active))
+    get('/arvados/v1/repositories/' + repositories(:foo).uuid,
+      params: {},
+      headers: auth(:active))
     assert_response(:success)
     assert_equal(users(:project_viewer).uuid, json_response['owner_uuid'])
 
-    get('/arvados/v1/groups/' + groups(:aproject).uuid, {}, auth(:active))
+    get('/arvados/v1/groups/' + groups(:aproject).uuid,
+      params: {},
+      headers: auth(:active))
     assert_response(:success)
     assert_equal(project_uuid, json_response['owner_uuid'])
   end
index ed705fc04dd4d4ceef74fef40d97d48c3a93ea91..1a98a65744275ae2b432f847e3ed5e26e1776da5 100644 (file)
@@ -10,33 +10,39 @@ class ValidLinksTest < ActionDispatch::IntegrationTest
   test "tail must exist on update" do
     admin_auth = {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin).api_token}"}
 
-    post "/arvados/v1/links", {
-      :format => :json,
-      :link => {
-        link_class: 'test',
-        name: 'stuff',
-        head_uuid: users(:active).uuid,
-        tail_uuid: virtual_machines(:testvm).uuid
-      }
-    }, admin_auth
+    post "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :link => {
+          link_class: 'test',
+          name: 'stuff',
+          head_uuid: users(:active).uuid,
+          tail_uuid: virtual_machines(:testvm).uuid
+        }
+      },
+      headers: admin_auth
     assert_response :success
     u = json_response['uuid']
 
-    put "/arvados/v1/links/#{u}", {
-      :format => :json,
-      :link => {
-        tail_uuid: virtual_machines(:testvm2).uuid
-      }
-    }, admin_auth
+    put "/arvados/v1/links/#{u}",
+      params: {
+        :format => :json,
+        :link => {
+          tail_uuid: virtual_machines(:testvm2).uuid
+        }
+      },
+      headers: admin_auth
     assert_response :success
     assert_equal virtual_machines(:testvm2).uuid, (ActiveSupport::JSON.decode @response.body)['tail_uuid']
 
-    put "/arvados/v1/links/#{u}", {
-      :format => :json,
-      :link => {
-        tail_uuid: 'zzzzz-tpzed-xyzxyzxerrrorxx'
-      }
-    }, admin_auth
+    put "/arvados/v1/links/#{u}",
+      params: {
+        :format => :json,
+        :link => {
+          tail_uuid: 'zzzzz-tpzed-xyzxyzxerrrorxx'
+        }
+      },
+      headers: admin_auth
     assert_response 422
   end
 
index b1b538583e38ae4aa71c769d8cf1933994b34a53..092c01fe12c5305fc1a4e8776818e12c5f7a144d 100644 (file)
@@ -3,16 +3,30 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 require 'test_helper'
-require 'rails/performance_test_help'
+require 'benchmark'
 
-class IndexTest < ActionDispatch::PerformanceTest
+class IndexTest < ActionDispatch::IntegrationTest
   def test_links_index
-    get '/arvados/v1/links', {format: :json}, auth(:admin)
+    puts("Get links index: ", Benchmark.measure do
+      get '/arvados/v1/links', params: {
+        limit: 1000,
+        format: :json
+      }, headers: auth(:admin)
+    end)
   end
   def test_links_index_with_filters
-    get '/arvados/v1/links', {format: :json, filters: [%w[head_uuid is_a arvados#collection]].to_json}, auth(:admin)
+    puts("Get links index with filters: ", Benchmark.measure do
+      get '/arvados/v1/links', params: {
+        format: :json,
+        filters: [%w[head_uuid is_a arvados#collection]].to_json
+      }, headers: auth(:admin)
+    end)
   end
   def test_collections_index
-    get '/arvados/v1/collections', {format: :json}, auth(:admin)
+    puts("Get collections index: ", Benchmark.measure do
+      get '/arvados/v1/collections', params: {
+        format: :json
+        }, headers: auth(:admin)
+      end)
   end
 end
index e4a3b0a41a9c211b0cb6258f617653b93819c2a7..a0605f97e72c1a749ccec12b46cd1a406417e2f0 100644 (file)
@@ -40,14 +40,15 @@ class PermissionPerfTest < ActionDispatch::IntegrationTest
                    end
                  end
                end
+               User.invalidate_permissions_cache
              end
            end)
     end
     puts "created #{n}"
     puts "Time spent getting group index:"
-    (0..4).each do
+    (0..1).each do
       puts(Benchmark.measure do
-             get '/arvados/v1/groups', {format: :json, limit: 1000}, auth(:permission_perftest)
+             get '/arvados/v1/groups', params: {format: :json}, headers: auth(:permission_perftest)
              assert json_response['items_available'] >= n
            end)
     end
index ffd50d808072887884caabffab08252aa2d71716..939242cf8e70eca87be21abac8ac1ef94c2a0a9b 100644 (file)
@@ -152,6 +152,8 @@ end
 class ActionController::TestCase
   setup do
     @test_counter = 0
+    self.request.headers['Accept'] = 'application/json'
+    self.request.headers['Content-Type'] = 'application/json'
   end
 
   def check_counter action
@@ -164,6 +166,18 @@ class ActionController::TestCase
   [:get, :post, :put, :patch, :delete].each do |method|
     define_method method do |action, *args|
       check_counter action
+      # After Rails 5.0 upgrade, some params don't get properly serialized.
+      # One case are filters: [['attr', 'op', 'val']] become [['attr'], ['op'], ['val']]
+      # if not passed upstream as a JSON string.
+      if args[0].is_a?(Hash) && args[0][:params].is_a?(Hash)
+        args[0][:params].each do |key, _|
+          next if key == :exclude_script_versions # Job Reuse tests
+          # Keys could be: :filters, :where, etc
+          if [Array, Hash].include?(args[0][:params][key].class)
+            args[0][:params][key] = SafeJSON.dump(args[0][:params][key])
+          end
+        end
+      end
       super action, *args
     end
   end
index d07027721f603565d3d6c66838fdd5ad666b95da..0fcdad704f4e1133d6f6148e2dd5bccce87c34c3 100644 (file)
@@ -140,6 +140,7 @@ class ArvadosModelTest < ActiveSupport::TestCase
     all_tables =  ActiveRecord::Base.connection.tables
     all_tables.delete 'schema_migrations'
     all_tables.delete 'permission_refresh_lock'
+    all_tables.delete 'ar_internal_metadata'
 
     all_tables.each do |table|
       table_class = table.classify.constantize
@@ -152,7 +153,10 @@ class ArvadosModelTest < ActiveSupport::TestCase
 
         indexes = ActiveRecord::Base.connection.indexes(table)
         search_index_by_columns = indexes.select do |index|
-          index.columns.sort == search_index_columns.sort
+          # After rails 5.0 upgrade, AR::Base.connection.indexes() started to include
+          # GIN indexes, with its 'columns' attribute being a String like
+          # 'to_tsvector(...)'
+          index.columns.is_a?(Array) ? index.columns.sort == search_index_columns.sort : false
         end
         search_index_by_name = indexes.select do |index|
           index.name == "#{table}_search_index"
index 9797ed63dc0d098898d38a4e0741ecd9fc7e0e4c..8deedee0186ea5bbd87ba6d219d7ef4d47f66314 100644 (file)
@@ -60,6 +60,56 @@ class CollectionTest < ActiveSupport::TestCase
     end
   end
 
+  [
+    [". d41d8cd98f00b204e9800998ecf8427e 0:34:foo.txt\n", 1, 34],
+    [". d41d8cd98f00b204e9800998ecf8427e 0:34:foo.txt 0:30:foo.txt 0:30:foo1.txt 0:30:foo2.txt 0:30:foo3.txt 0:30:foo4.txt\n", 5, 184],
+    [". d41d8cd98f00b204e9800998ecf8427e 0:0:.\n", 0, 0]
+  ].each do |manifest, count, size|
+    test "file stats on create collection with #{manifest}" do
+      act_as_system_user do
+        c = Collection.create(manifest_text: manifest)
+        assert_equal count, c.file_count
+        assert_equal size, c.file_size_total
+      end
+    end
+  end
+
+  test "file stats cannot be changed unless through manifest change" do
+    act_as_system_user do
+      # Direct changes to file stats should be ignored
+      c = Collection.create(manifest_text: ". d41d8cd98f00b204e9800998ecf8427e 0:34:foo.txt\n")
+      c.file_count = 6
+      c.file_size_total = 30
+      assert c.valid?
+      assert_equal 1, c.file_count
+      assert_equal 34, c.file_size_total
+
+      # File stats specified on create should be ignored and overwritten
+      c = Collection.create(manifest_text: ". d41d8cd98f00b204e9800998ecf8427e 0:34:foo.txt\n", file_count: 10, file_size_total: 10)
+      assert c.valid?
+      assert_equal 1, c.file_count
+      assert_equal 34, c.file_size_total
+
+      # Updating the manifest should change file stats
+      c.update_attributes(manifest_text: ". d41d8cd98f00b204e9800998ecf8427e 0:34:foo.txt 0:34:foo2.txt\n")
+      assert c.valid?
+      assert_equal 2, c.file_count
+      assert_equal 68, c.file_size_total
+
+      # Updating file stats and the manifest should use manifest values
+      c.update_attributes(manifest_text: ". d41d8cd98f00b204e9800998ecf8427e 0:34:foo.txt\n", file_count:10, file_size_total: 10)
+      assert c.valid?
+      assert_equal 1, c.file_count
+      assert_equal 34, c.file_size_total
+
+      # Updating just the file stats should be ignored
+      c.update_attributes(file_count: 10, file_size_total: 10)
+      assert c.valid?
+      assert_equal 1, c.file_count
+      assert_equal 34, c.file_size_total
+    end
+  end
+
   [
     nil,
     "",
index 1a53df7dab4a2b76e260b00d213f659a35db1b29..5ce3739a36dc7ca5d4002019d36144b90a584da0 100644 (file)
@@ -388,9 +388,11 @@ class ContainerTest < ActiveSupport::TestCase
                                                runtime_status: {'warning' => 'This is not an error'},
                                                progress: 0.15})
     c_faster_started_second.update_attributes!({state: Container::Locked})
+    assert_equal 0, Container.where("runtime_status->'error' is not null").count
     c_faster_started_second.update_attributes!({state: Container::Running,
                                                 runtime_status: {'error' => 'Something bad happened'},
                                                 progress: 0.2})
+    assert_equal 1, Container.where("runtime_status->'error' is not null").count
     reused = Container.find_reusable(common_attrs)
     assert_not_nil reused
     # Selected the non-failing container even if it's the one with less progress done
index 3460abe3cc6c50ac4e2f1a40fbbe2acb22350c0b..42ef0d160cb1c595f781858cb9137a79d88e1da0 100644 (file)
@@ -79,17 +79,6 @@ class CrunchDispatchTest < ActiveSupport::TestCase
     begin
       pid = Process.fork do
         begin
-          # Abandon database connections inherited from parent
-          # process.  Credit to
-          # https://github.com/kstephens/rails_is_forked
-          ActiveRecord::Base.connection_handler.connection_pools.each_value do |pool|
-            pool.instance_eval do
-              @reserved_connections = {}
-              @connections = []
-            end
-          end
-          ActiveRecord::Base.establish_connection
-
           dispatch = CrunchDispatch.new
           dispatch.stubs(:did_recently).returns true
           dispatch.run []
diff --git a/services/api/test/unit/group_pdhs_test.rb b/services/api/test/unit/group_pdhs_test.rb
new file mode 100644 (file)
index 0000000..82256e6
--- /dev/null
@@ -0,0 +1,27 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+require 'test_helper'
+require 'group_pdhs'
+
+# NOTE: Migration 20190322174136_add_file_info_to_collection.rb
+# relies on this test. Change with caution!
+class GroupPdhsTest < ActiveSupport::TestCase
+  test "pdh_grouping_by_manifest_size" do
+    batch_size_max = 200
+    pdhs_in = ['x1+30', 'x2+30', 'x3+201', 'x4+100', 'x5+100']
+    pdh_lambda = lambda { |last_pdh, &block|
+      pdhs = pdhs_in.select{|pdh| pdh > last_pdh} 
+      pdhs.each do |p|
+        block.call(p)
+      end
+    }
+    batched_pdhs = []
+    GroupPdhs.group_pdhs_for_multiple_transactions(pdh_lambda, pdhs_in.size, batch_size_max, "") do |pdhs|
+      batched_pdhs << pdhs
+    end
+    expected = [['x1+30', 'x2+30'], ['x3+201'], ['x4+100', 'x5+100']]
+    assert_equal(batched_pdhs, expected)
+  end
+end
index 41e2adb9c3d35a2a6d52f9244b666913eff3e1d5..fcbd1722f38f4aff02ac4f38be8cfa7b61c87a0b 100644 (file)
@@ -661,6 +661,8 @@ class JobTest < ActiveSupport::TestCase
 
   test 'enable legacy api configuration option = auto, has jobs' do
     Rails.configuration.enable_legacy_jobs_api = "auto"
+    assert Job.count > 0
+    assert_equal [], Rails.configuration.disable_api_methods
     check_enable_legacy_jobs_api
     assert_equal [], Rails.configuration.disable_api_methods
   end
@@ -670,7 +672,8 @@ class JobTest < ActiveSupport::TestCase
     act_as_system_user do
       Job.destroy_all
     end
-    puts "ZZZ #{Job.count}"
+    assert_equal 0, Job.count
+    assert_equal [], Rails.configuration.disable_api_methods
     check_enable_legacy_jobs_api
     assert_equal Disable_jobs_api_method_list, Rails.configuration.disable_api_methods
   end
index 0656cbf89ad34661d08bb467c96b2be152a7908f..88cd221cbf8aaed87e4f91a6289e8dd02458cd90 100644 (file)
@@ -52,7 +52,7 @@ func (s *GitoliteSuite) SetUpTest(c *check.C) {
                        APIHost:  arvadostest.APIHost(),
                        Insecure: true,
                },
-               Listen:       ":0",
+               Listen:       "localhost:0",
                GitCommand:   "/usr/share/gitolite3/gitolite-shell",
                GitoliteHome: s.gitoliteHome,
                RepoRoot:     s.tmpRepoRoot,
index 10c69eedd3bf2e2c81cb51ea7c92961d108f1204..53b636dc0e577e75bf5577e66a54059628be8774 100644 (file)
@@ -77,7 +77,7 @@ func (s *IntegrationSuite) SetUpTest(c *check.C) {
                                APIHost:  arvadostest.APIHost(),
                                Insecure: true,
                        },
-                       Listen:          ":0",
+                       Listen:          "localhost:0",
                        GitCommand:      "/usr/bin/git",
                        RepoRoot:        s.tmpRepoRoot,
                        ManagementToken: arvadostest.ManagementToken,
index dcd54e8968e930f1cdb390aa9b0e5c40182c3bdb..ae09c52f213f5d17f94445b9ad3c77cea9a21e99 100644 (file)
@@ -85,14 +85,15 @@ func doMain() error {
        }
        arv.Retries = 25
 
+       ctx, cancel := context.WithCancel(context.Background())
+
        dispatcher := dispatch.Dispatcher{
                Logger:       logger,
                Arv:          arv,
-               RunContainer: run,
+               RunContainer: (&LocalRun{startFunc, make(chan bool, 8), ctx}).run,
                PollPeriod:   time.Duration(*pollInterval) * time.Second,
        }
 
-       ctx, cancel := context.WithCancel(context.Background())
        err = dispatcher.Run(ctx)
        if err != nil {
                return err
@@ -123,7 +124,11 @@ func startFunc(container arvados.Container, cmd *exec.Cmd) error {
        return cmd.Start()
 }
 
-var startCmd = startFunc
+type LocalRun struct {
+       startCmd         func(container arvados.Container, cmd *exec.Cmd) error
+       concurrencyLimit chan bool
+       ctx              context.Context
+}
 
 // Run a container.
 //
@@ -133,14 +138,36 @@ var startCmd = startFunc
 //
 // If the container is in any other state, or is not Complete/Cancelled after
 // crunch-run terminates, mark the container as Cancelled.
-func run(dispatcher *dispatch.Dispatcher,
+func (lr *LocalRun) run(dispatcher *dispatch.Dispatcher,
        container arvados.Container,
        status <-chan arvados.Container) {
 
        uuid := container.UUID
 
        if container.State == dispatch.Locked {
+
+               select {
+               case lr.concurrencyLimit <- true:
+                       break
+               case <-lr.ctx.Done():
+                       return
+               }
+
+               defer func() { <-lr.concurrencyLimit }()
+
+               select {
+               case c := <-status:
+                       // Check for state updates after possibly
+                       // waiting to be ready-to-run
+                       if c.Priority == 0 {
+                               goto Finish
+                       }
+               default:
+                       break
+               }
+
                waitGroup.Add(1)
+               defer waitGroup.Done()
 
                cmd := exec.Command(*crunchRunCommand, uuid)
                cmd.Stdin = nil
@@ -153,7 +180,7 @@ func run(dispatcher *dispatch.Dispatcher,
                // succeed in starting crunch-run.
 
                runningCmdsMutex.Lock()
-               if err := startCmd(container, cmd); err != nil {
+               if err := lr.startCmd(container, cmd); err != nil {
                        runningCmdsMutex.Unlock()
                        dispatcher.Logger.Warnf("error starting %q for %s: %s", *crunchRunCommand, uuid, err)
                        dispatcher.UpdateState(uuid, dispatch.Cancelled)
@@ -194,9 +221,10 @@ func run(dispatcher *dispatch.Dispatcher,
                        delete(runningCmds, uuid)
                        runningCmdsMutex.Unlock()
                }
-               waitGroup.Done()
        }
 
+Finish:
+
        // If the container is not finalized, then change it to "Cancelled".
        err := dispatcher.Arv.Get("containers", uuid, nil, &container)
        if err != nil {
index 6bae1f40997a8a824284390a18c2da8df8568cdb..41357403f0a01c9092e2ee7503e13943ba4c2cd3 100644 (file)
@@ -73,18 +73,19 @@ func (s *TestSuite) TestIntegration(c *C) {
        dispatcher := dispatch.Dispatcher{
                Arv:        arv,
                PollPeriod: time.Second,
-               RunContainer: func(d *dispatch.Dispatcher, c arvados.Container, s <-chan arvados.Container) {
-                       run(d, c, s)
-                       cancel()
-               },
        }
 
-       startCmd = func(container arvados.Container, cmd *exec.Cmd) error {
+       startCmd := func(container arvados.Container, cmd *exec.Cmd) error {
                dispatcher.UpdateState(container.UUID, "Running")
                dispatcher.UpdateState(container.UUID, "Complete")
                return cmd.Start()
        }
 
+       dispatcher.RunContainer = func(d *dispatch.Dispatcher, c arvados.Container, s <-chan arvados.Container) {
+               (&LocalRun{startCmd, make(chan bool, 8), ctx}).run(d, c, s)
+               cancel()
+       }
+
        err = dispatcher.Run(ctx)
        c.Assert(err, Equals, context.Canceled)
 
@@ -175,18 +176,19 @@ func testWithServerStub(c *C, apiStubResponses map[string]arvadostest.StubRespon
        dispatcher := dispatch.Dispatcher{
                Arv:        arv,
                PollPeriod: time.Second / 20,
-               RunContainer: func(d *dispatch.Dispatcher, c arvados.Container, s <-chan arvados.Container) {
-                       run(d, c, s)
-                       cancel()
-               },
        }
 
-       startCmd = func(container arvados.Container, cmd *exec.Cmd) error {
+       startCmd := func(container arvados.Container, cmd *exec.Cmd) error {
                dispatcher.UpdateState(container.UUID, "Running")
                dispatcher.UpdateState(container.UUID, "Complete")
                return cmd.Start()
        }
 
+       dispatcher.RunContainer = func(d *dispatch.Dispatcher, c arvados.Container, s <-chan arvados.Container) {
+               (&LocalRun{startCmd, make(chan bool, 8), ctx}).run(d, c, s)
+               cancel()
+       }
+
        re := regexp.MustCompile(`(?ms).*` + expected + `.*`)
        go func() {
                for i := 0; i < 80 && !re.MatchString(buf.String()); i++ {
index 3925b0b7b1f810c9c451c7e756693ba5875bc252..84b578a3e21ee6a1b9b70f1adf48709154452bb9 100644 (file)
@@ -987,7 +987,7 @@ func (runner *ContainerRunner) AttachStreams() (err error) {
                go func() {
                        _, err := io.Copy(response.Conn, stdinRdr)
                        if err != nil {
-                               runner.CrunchLog.Print("While writing stdin collection to docker container %q", err)
+                               runner.CrunchLog.Printf("While writing stdin collection to docker container %q", err)
                                runner.stop(nil)
                        }
                        stdinRdr.Close()
@@ -997,7 +997,7 @@ func (runner *ContainerRunner) AttachStreams() (err error) {
                go func() {
                        _, err := io.Copy(response.Conn, bytes.NewReader(stdinJson))
                        if err != nil {
-                               runner.CrunchLog.Print("While writing stdin json to docker container %q", err)
+                               runner.CrunchLog.Printf("While writing stdin json to docker container %q", err)
                                runner.stop(nil)
                        }
                        response.CloseWrite()
index 8b689efbdc1f1d731bc2a9dfb106c12e3c214cef..a9830bc1de4715d2cfdaa39049106bcf95cce779 100644 (file)
@@ -266,9 +266,10 @@ func (s *IntegrationSuite) runCurl(c *check.C, token, host, uri string, args ...
        c.Log(fmt.Sprintf("curlArgs == %#v", curlArgs))
        cmd := exec.Command("curl", curlArgs...)
        stdout, err := cmd.StdoutPipe()
-       c.Assert(err, check.Equals, nil)
-       cmd.Stderr = cmd.Stdout
-       go cmd.Start()
+       c.Assert(err, check.IsNil)
+       cmd.Stderr = os.Stderr
+       err = cmd.Start()
+       c.Assert(err, check.IsNil)
        buf := make([]byte, 2<<27)
        n, err := io.ReadFull(stdout, buf)
        // Discard (but measure size of) anything past 128 MiB.
@@ -276,9 +277,9 @@ func (s *IntegrationSuite) runCurl(c *check.C, token, host, uri string, args ...
        if err == io.ErrUnexpectedEOF {
                buf = buf[:n]
        } else {
-               c.Assert(err, check.Equals, nil)
+               c.Assert(err, check.IsNil)
                discarded, err = io.Copy(ioutil.Discard, stdout)
-               c.Assert(err, check.Equals, nil)
+               c.Assert(err, check.IsNil)
        }
        err = cmd.Wait()
        // Without "-f", curl exits 0 as long as it gets a valid HTTP
index fc4783eff9a41f342211fc1aa1e6f67520fc7185..c6fd99b9d8ed2f70b264b342ed041d5062eeb0a8 100644 (file)
@@ -152,7 +152,7 @@ func main() {
                }
                err = f.Sync()
                if err != nil {
-                       log.Fatal("sync(%s): %s", cfg.PIDFile, err)
+                       log.Fatalf("sync(%s): %s", cfg.PIDFile, err)
                }
        }
 
@@ -541,7 +541,7 @@ func (h *proxyHandler) Put(resp http.ResponseWriter, req *http.Request) {
        if locatorIn == "" {
                bytes, err2 := ioutil.ReadAll(req.Body)
                if err2 != nil {
-                       _ = errors.New(fmt.Sprintf("Error reading request body: %s", err2))
+                       err = fmt.Errorf("Error reading request body: %s", err2)
                        status = http.StatusInternalServerError
                        return
                }
index 42d990fa6675a8e6e9c7d8484448254898c7dbfc..420b1528618c10ec4f3b2f2b986060e25dfd2116 100644 (file)
@@ -6,6 +6,6 @@ source 'https://rubygems.org'
 gemspec
 group :test, :performance do
   gem 'minitest', '>= 5.0.0'
-  gem 'mocha', require: false
+  gem 'mocha', '>= 1.5.0', require: false
   gem 'rake'
 end
index b64aab2dc6cb0e189341ab93d175e27d38a659ce..f998a8f35211c89ae81dd89def87d5aef9d46412 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-if not File.exists?('/usr/bin/git') then
+if not File.exist?('/usr/bin/git') then
   STDERR.puts "\nGit binary not found, aborting. Please install git and run gem build from a checked out copy of the git repository.\n\n"
   exit
 end
index eb680043e4b50bf3f44bbd28a97bd551a39c12de..e00495c04db7db621ba0bf377cbe62072b82feba 100755 (executable)
@@ -108,7 +108,7 @@ begin
                 "-G", groups.join(","),
                 l[:username],
                 out: devnull)
-        STDERR.puts "Account creation failed for #{l[:username]}: $?"
+        STDERR.puts "Account creation failed for #{l[:username]}: #{$?}"
         next
       end
       begin
@@ -121,13 +121,13 @@ begin
 
     @homedir = pwnam[l[:username]].dir
     userdotssh = File.join(@homedir, ".ssh")
-    Dir.mkdir(userdotssh) if !File.exists?(userdotssh)
+    Dir.mkdir(userdotssh) if !File.exist?(userdotssh)
 
     newkeys = "###\n###\n" + keys[l[:username]].join("\n") + "\n###\n###\n"
 
     keysfile = File.join(userdotssh, "authorized_keys")
 
-    if File.exists?(keysfile)
+    if File.exist?(keysfile)
       oldkeys = IO::read(keysfile)
     else
       oldkeys = ""
index d7fab3c0db8fe202ad979f7ed469db1632ebc685..cf69da6efcc6e94d0b877cf84d738dd0b7386fc5 100644 (file)
@@ -3,19 +3,10 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 require 'etc'
-require 'mocha/mini_test'
+require 'mocha/minitest'
 require 'ostruct'
 
 module Stubs
-  # These Etc mocks help only when we run arvados-login-sync in-process.
-
-  def setup
-    super
-    ENV['ARVADOS_VIRTUAL_MACHINE_UUID'] = 'testvm2.shell'
-    Etc.stubs(:to_enum).with(:passwd).returns stubpasswd.map { |x| OpenStruct.new x }
-    Etc.stubs(:to_enum).with(:group).returns stubgroup.map { |x| OpenStruct.new x }
-  end
-
   def stubpasswd
     [{name: 'root', uid: 0}]
   end
@@ -24,10 +15,16 @@ module Stubs
     [{name: 'root', gid: 0}]
   end
 
-  # These child-ENV tricks help only when we run arvados-login-sync as a subprocess.
 
   def setup
     super
+
+    # These Etc mocks help only when we run arvados-login-sync in-process.
+    ENV['ARVADOS_VIRTUAL_MACHINE_UUID'] = 'testvm2.shell'
+    Etc.stubs(:to_enum).with(:passwd).returns stubpasswd.map { |x| OpenStruct.new x }
+    Etc.stubs(:to_enum).with(:group).returns stubgroup.map { |x| OpenStruct.new x }
+
+    # These child-ENV tricks help only when we run arvados-login-sync as a subprocess.
     @env_was = Hash[ENV]
     @tmpdir = Dir.mktmpdir
   end
index 17942c2cffa784993b4338dc64711e56f5e17028..e90c16d64fae900df698c1db9d0cd6814022604b 100644 (file)
@@ -10,17 +10,14 @@ class TestAddUser < Minitest::Test
   include Stubs
 
   def test_useradd_error
+    valid_groups = %w(docker admin fuse).select { |g| Etc.getgrnam(g) rescue false }
     # binstub_new_user/useradd will exit non-zero because its args
     # won't match any line in this empty file:
     File.open(@tmpdir+'/succeed', 'w') do |f| end
     invoke_sync binstubs: ['new_user']
     spied = File.read(@tmpdir+'/spy')
     assert_match %r{useradd -m -c active -s /bin/bash -G (fuse)? active}, spied
-    # BUG(TC): This assertion succeeds only if docker and fuse groups
-    # exist on the host, but is insensitive to the admin group (groups
-    # are quietly ignored by login-sync if they don't exist on the
-    # current host).
-    assert_match %r{useradd -m -c adminroot -s /bin/bash -G (docker)?(,admin)?(,fuse)? adminroot}, spied
+    assert_match %r{useradd -m -c adminroot -s /bin/bash -G #{valid_groups.join(',')} adminroot}, spied
   end
 
   def test_useradd_success
index 8c443fd71afd3ddb2aee089df9bcb745b1c3315d..74933718c76ac8e0e499f62bf3ede740308ce073 100755 (executable)
@@ -285,6 +285,27 @@ run() {
     fi
 }
 
+update() {
+    CONFIG=$1
+    TAG=$2
+
+    if test -n "$TAG"
+    then
+        if test $(echo $TAG | cut -c1-1) != '-' ; then
+           TAG=":$TAG"
+            shift
+        else
+            unset TAG
+        fi
+    fi
+
+    if echo "$CONFIG" | grep 'demo$' ; then
+       docker pull arvados/arvbox-demo$TAG
+    else
+       docker pull arvados/arvbox-dev$TAG
+    fi
+}
+
 stop() {
     if docker ps -a --filter "status=running" | grep -E "$ARVBOX_CONTAINER$" -q ; then
         docker stop $ARVBOX_CONTAINER
@@ -383,6 +404,13 @@ case "$subcmd" in
         run $@
         ;;
 
+    update)
+        check $@
+        stop
+       update $@
+        run $@
+        ;;
+
     ip)
         getip
         ;;
@@ -487,10 +515,13 @@ case "$subcmd" in
         fi
         ;;
 
-    install-root-cert)
-       set -x
-       sudo cp $VAR_DATA/root-cert.pem /usr/local/share/ca-certificates/${ARVBOX_CONTAINER}-testing-cert.crt
-       sudo update-ca-certificates
+    root-cert)
+       CERT=$PWD/${ARVBOX_CONTAINER}-root-cert.pem
+       if test -n "$1" ; then
+           CERT="$1"
+       fi
+       docker exec $ARVBOX_CONTAINER cat /var/lib/arvados/root-cert.pem > "$CERT"
+       echo "Certificate copied to $CERT"
        ;;
 
     devenv)
@@ -530,17 +561,19 @@ case "$subcmd" in
     *)
         echo "Arvados-in-a-box                      http://arvados.org"
         echo
-        echo "build   <config>      build arvbox Docker image"
-        echo "rebuild <config>      build arvbox Docker image, no layer cache"
         echo "start|run <config> [tag]  start $ARVBOX_CONTAINER container"
-        echo "open       open arvbox workbench in a web browser"
-        echo "shell      enter arvbox shell"
-        echo "ip         print arvbox docker container ip address"
-        echo "host       print arvbox published host"
-        echo "status     print some information about current arvbox"
         echo "stop       stop arvbox container"
         echo "restart <config>  stop, then run again"
-        echo "reboot  <config>  stop, build arvbox Docker image, run"
+        echo "status     print some information about current arvbox"
+        echo "ip         print arvbox docker container ip address"
+        echo "host       print arvbox published host"
+        echo "shell      enter arvbox shell"
+        echo "open       open arvbox workbench in a web browser"
+        echo "root-cert  get copy of root certificate"
+        echo "update  <config> stop, pull latest image, run"
+        echo "build   <config> build arvbox Docker image"
+        echo "reboot  <config> stop, build arvbox Docker image, run"
+        echo "rebuild <config> build arvbox Docker image, no layer cache"
         echo "reset      delete arvbox arvados data (be careful!)"
         echo "destroy    delete all arvbox code and data (be careful!)"
         echo "log <service> tail log of specified service"
index 1949af435bd2de82c3c9e2398ce58fa873477035..741bd33c4998cab201e6e9e60f0c58a69a3414fd 100644 (file)
@@ -16,11 +16,11 @@ RUN apt-get update && \
     pkg-config libattr1-dev python-llfuse python-pycurl \
     libwww-perl libio-socket-ssl-perl libcrypt-ssleay-perl \
     libjson-perl nginx gitolite3 lsof libreadline-dev \
-    apt-transport-https ca-certificates slurm-wlm \
+    apt-transport-https ca-certificates \
     linkchecker python3-virtualenv python-virtualenv xvfb iceweasel \
     libgnutls28-dev python3-dev vim cadaver cython gnupg dirmngr \
     libsecret-1-dev r-base r-cran-testthat libxml2-dev pandoc \
-    python3-setuptools python3-pip openjdk-8-jdk && \
+    python3-setuptools python3-pip openjdk-8-jdk bsdmainutils && \
     apt-get clean
 
 ENV RUBYVERSION_MINOR 2.3
index bb0ff76fe8f065c1be45338f677cf0e7cd99b8ed..22668253e1bf038c2bcbd297bff85233b92ee430 100644 (file)
@@ -12,5 +12,7 @@ RUN echo "development" > /var/lib/arvados/api_rails_env
 RUN echo "development" > /var/lib/arvados/sso_rails_env
 RUN echo "development" > /var/lib/arvados/workbench_rails_env
 
-RUN mkdir /etc/test-service && ln -sf /var/lib/arvbox/service/postgres /etc/test-service
+RUN mkdir /etc/test-service && \
+    ln -sf /var/lib/arvbox/service/postgres /etc/test-service && \
+    ln -sf /var/lib/arvbox/service/certificate /etc/test-service
 RUN mkdir /etc/devenv-service
\ No newline at end of file
index 0f283830f5b4e62fec3f59d761bdfb6704163e4e..482934c9151e295b38182081e3b0f4e6be8bc1a5 100755 (executable)
@@ -18,9 +18,6 @@ fi
 
 set -u
 
-if ! test -s /var/lib/arvados/api_uuid_prefix ; then
-    ruby -e 'puts "#{rand(2**64).to_s(36)[0,5]}"' > /var/lib/arvados/api_uuid_prefix
-fi
 uuid_prefix=$(cat /var/lib/arvados/api_uuid_prefix)
 
 if ! test -s /var/lib/arvados/api_secret_token ; then
diff --git a/tools/arvbox/lib/arvbox/docker/service/slurmctld/log/main/.gitstub b/tools/arvbox/lib/arvbox/docker/service/slurmctld/log/main/.gitstub
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/tools/arvbox/lib/arvbox/docker/service/slurmctld/log/run b/tools/arvbox/lib/arvbox/docker/service/slurmctld/log/run
deleted file mode 120000 (symlink)
index d6aef4a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/tools/arvbox/lib/arvbox/docker/service/slurmctld/run b/tools/arvbox/lib/arvbox/docker/service/slurmctld/run
deleted file mode 100755 (executable)
index bb500a5..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-# Copyright (C) The Arvados Authors. All rights reserved.
-#
-# SPDX-License-Identifier: AGPL-3.0
-
-exec 2>&1
-set -eux -o pipefail
-
-. /usr/local/lib/arvbox/common.sh
-
-cat > /etc/slurm-llnl/slurm.conf  <<EOF
-ControlMachine=$HOSTNAME
-ControlAddr=$HOSTNAME
-AuthType=auth/munge
-DefaultStorageLoc=/var/log/slurm-llnl
-SelectType=select/cons_res
-SelectTypeParameters=CR_CPU_Memory
-SlurmUser=arvbox
-SlurmdUser=arvbox
-SlurmctldPort=7002
-SlurmctldTimeout=300
-SlurmdPort=7003
-SlurmdSpoolDir=/var/tmp/slurmd.spool
-SlurmdTimeout=300
-StateSaveLocation=/var/tmp/slurm.state
-NodeName=$HOSTNAME
-PartitionName=compute State=UP Default=YES Nodes=$HOSTNAME
-EOF
-
-mkdir -p /var/run/munge
-
-/usr/sbin/munged -f
-
-exec /usr/sbin/slurmctld -v -D
diff --git a/tools/arvbox/lib/arvbox/docker/service/slurmd/log/main/.gitstub b/tools/arvbox/lib/arvbox/docker/service/slurmd/log/main/.gitstub
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/tools/arvbox/lib/arvbox/docker/service/slurmd/log/run b/tools/arvbox/lib/arvbox/docker/service/slurmd/log/run
deleted file mode 120000 (symlink)
index d6aef4a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/tools/arvbox/lib/arvbox/docker/service/slurmd/run b/tools/arvbox/lib/arvbox/docker/service/slurmd/run
deleted file mode 100755 (executable)
index 8656b27..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) The Arvados Authors. All rights reserved.
-#
-# SPDX-License-Identifier: AGPL-3.0
-
-exec 2>&1
-set -eux -o pipefail
-
-exec /usr/local/lib/arvbox/runsu.sh /usr/sbin/slurmd -v -D
index af49d4b3c0f829618f6572b800b5eb85597fc779..cbd3b2fbef2089dfd21d0b40e57cce7c130f2677 100755 (executable)
@@ -25,10 +25,10 @@ fi
 
 set -u
 
-if ! test -s /var/lib/arvados/sso_uuid_prefix ; then
-  ruby -e 'puts "#{rand(2**64).to_s(36)[0,5]}"' > /var/lib/arvados/sso_uuid_prefix
+if ! test -s /var/lib/arvados/api_uuid_prefix ; then
+  ruby -e 'puts "x#{rand(2**64).to_s(36)[0,4]}"' > /var/lib/arvados/api_uuid_prefix
 fi
-uuid_prefix=$(cat /var/lib/arvados/sso_uuid_prefix)
+uuid_prefix=$(cat /var/lib/arvados/api_uuid_prefix)
 
 if ! test -s /var/lib/arvados/sso_secret_token ; then
   ruby -e 'puts rand(2**400).to_s(36)' > /var/lib/arvados/sso_secret_token
index 58f156cb1775dfb9cbab2a25a8f3d5a3d501e472..6bda618ab899e2a8ca1a429bf319f82263995c49 100755 (executable)
@@ -1,8 +1,14 @@
-#!/bin/sh
+#!/bin/bash
 # Copyright (C) The Arvados Authors. All rights reserved.
 #
 # SPDX-License-Identifier: AGPL-3.0
 
+. /usr/local/lib/arvbox/common.sh
+
 while ! psql postgres -c\\du >/dev/null 2>/dev/null ; do
     sleep 1
 done
+
+while ! test -s /var/lib/arvados/server-cert-${localip}.pem ; do
+    sleep 1
+done