diff options
Diffstat (limited to 'spec/requests/api/graphql/mutations/ci')
-rw-r--r-- | spec/requests/api/graphql/mutations/ci/job_retry_spec.rb | 32 | ||||
-rw-r--r-- | spec/requests/api/graphql/mutations/ci/pipeline_cancel_spec.rb | 2 |
2 files changed, 33 insertions, 1 deletions
diff --git a/spec/requests/api/graphql/mutations/ci/job_retry_spec.rb b/spec/requests/api/graphql/mutations/ci/job_retry_spec.rb index ef640183bd8..8cf559a372a 100644 --- a/spec/requests/api/graphql/mutations/ci/job_retry_spec.rb +++ b/spec/requests/api/graphql/mutations/ci/job_retry_spec.rb @@ -47,6 +47,38 @@ RSpec.describe 'JobRetry' do expect(new_job).not_to be_retried end + context 'when given CI variables' do + let(:job) { create(:ci_build, :success, :actionable, pipeline: pipeline, name: 'build') } + + let(:mutation) do + variables = { + id: job.to_global_id.to_s, + variables: { key: 'MANUAL_VAR', value: 'test manual var' } + } + + graphql_mutation(:job_retry, variables, + <<-QL + errors + job { + id + } + QL + ) + end + + it 'applies them to a retried manual job' do + post_graphql_mutation(mutation, current_user: user) + + expect(response).to have_gitlab_http_status(:success) + + new_job_id = GitlabSchema.object_from_id(mutation_response['job']['id']).sync.id + new_job = ::Ci::Build.find(new_job_id) + expect(new_job.job_variables.count).to be(1) + expect(new_job.job_variables.first.key).to eq('MANUAL_VAR') + expect(new_job.job_variables.first.value).to eq('test manual var') + end + end + context 'when the job is not retryable' do let(:job) { create(:ci_build, :retried, pipeline: pipeline) } diff --git a/spec/requests/api/graphql/mutations/ci/pipeline_cancel_spec.rb b/spec/requests/api/graphql/mutations/ci/pipeline_cancel_spec.rb index d9106aa42c4..6ec1b7ce9b6 100644 --- a/spec/requests/api/graphql/mutations/ci/pipeline_cancel_spec.rb +++ b/spec/requests/api/graphql/mutations/ci/pipeline_cancel_spec.rb @@ -40,7 +40,7 @@ RSpec.describe 'PipelineCancel' do expect(build).not_to be_canceled end - it "cancels all cancelable builds from a pipeline" do + it 'cancels all cancelable builds from a pipeline', :sidekiq_inline do build = create(:ci_build, :running, pipeline: pipeline) post_graphql_mutation(mutation, current_user: user) |