X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b91db14a4dced9d6ea124e86be3c796e6f2c8e8c..fd5d197916b117386fbe872790ff6493326c4ea2:/services/api/test/functional/arvados/v1/pipeline_instances_controller_test.rb diff --git a/services/api/test/functional/arvados/v1/pipeline_instances_controller_test.rb b/services/api/test/functional/arvados/v1/pipeline_instances_controller_test.rb index 63c47ff407..a76151150f 100644 --- a/services/api/test/functional/arvados/v1/pipeline_instances_controller_test.rb +++ b/services/api/test/functional/arvados/v1/pipeline_instances_controller_test.rb @@ -1,10 +1,14 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'test_helper' 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 } @@ -16,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: {} } @@ -25,4 +29,24 @@ class Arvados::V1::PipelineInstancesControllerTest < ActionController::TestCase assert_equal({}, assigns(:object).components) end + [ + true, + false + ].each do |cascade| + test "cancel a pipeline instance with cascade=#{cascade}" do + authorize_with :active + pi_uuid = pipeline_instances(:job_child_pipeline_with_components_at_level_2).uuid + + post :cancel, params: {id: pi_uuid, cascade: cascade} + assert_response :success + + pi = PipelineInstance.where(uuid: pi_uuid).first + assert_equal "Paused", pi.state + + children = Job.where(uuid: ['zzzzz-8i9sb-job1atlevel3noc', 'zzzzz-8i9sb-job2atlevel3noc']) + children.each do |child| + assert_equal ("Cancelled" == child.state), cascade + end + end + end end