diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-24 21:10:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-24 21:10:28 +0300 |
commit | e20fed01c86f47ffba316483f312a36330fd084d (patch) | |
tree | a97c23d9f1729ca3637c78769ebe1663e0765bb7 /spec/requests/api | |
parent | e778dcbceebbfbae42a3743cf76d80229ccc716c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api')
-rw-r--r-- | spec/requests/api/graphql/ci/runner_spec.rb | 22 | ||||
-rw-r--r-- | spec/requests/api/graphql/packages/package_spec.rb | 11 | ||||
-rw-r--r-- | spec/requests/api/project_packages_spec.rb | 10 |
3 files changed, 41 insertions, 2 deletions
diff --git a/spec/requests/api/graphql/ci/runner_spec.rb b/spec/requests/api/graphql/ci/runner_spec.rb index 94c0a3c41bd..3cc572731ba 100644 --- a/spec/requests/api/graphql/ci/runner_spec.rb +++ b/spec/requests/api/graphql/ci/runner_spec.rb @@ -86,6 +86,7 @@ RSpec.describe 'Query.runner(id)' do 'active' => runner.active, 'paused' => !runner.active, 'status' => runner.status('14.5').to_s.upcase, + 'jobExecutionStatus' => runner.running_builds.any? ? 'RUNNING' : 'IDLE', 'maximumTimeout' => runner.maximum_timeout, 'accessLevel' => runner.access_level.to_s.upcase, 'runUntagged' => runner.run_untagged, @@ -97,8 +98,12 @@ RSpec.describe 'Query.runner(id)' do 'maintenanceNote' => runner.maintenance_note, 'maintenanceNoteHtml' => runner.maintainer_note.present? ? a_string_including('<strong>Test maintenance note</strong>') : '', - 'jobCount' => 0, - 'jobs' => a_hash_including("count" => 0, "nodes" => [], "pageInfo" => anything), + 'jobCount' => runner.running_builds.count, + 'jobs' => a_hash_including( + "count" => runner.running_builds.count, + "nodes" => an_instance_of(Array), + "pageInfo" => anything + ), 'projectCount' => nil, 'adminUrl' => "http://localhost/admin/runners/#{runner.id}", 'userPermissions' => { @@ -179,6 +184,19 @@ RSpec.describe 'Query.runner(id)' do expect(runner_data).not_to include('tagList') end end + + context 'with build running' do + before do + project = create(:project, :repository) + pipeline = create(:ci_pipeline, project: project) + build = create(:ci_build, runner: runner, pipeline: pipeline) + create(:ci_running_build, build: build, project: project, runner: runner) + end + + specify { expect(runner.running_builds.count).to eq 1 } + + it_behaves_like 'runner details fetch' + end end describe 'for project runner' do diff --git a/spec/requests/api/graphql/packages/package_spec.rb b/spec/requests/api/graphql/packages/package_spec.rb index 02a3206f587..db346c41a9d 100644 --- a/spec/requests/api/graphql/packages/package_spec.rb +++ b/spec/requests/api/graphql/packages/package_spec.rb @@ -226,5 +226,16 @@ RSpec.describe 'package details' do end end end + + context 'with package that has no default status' do + before do + composer_package.update!(status: :error) + subject + end + + it "does not return package's details" do + expect(package_details).to be_nil + end + end end end diff --git a/spec/requests/api/project_packages_spec.rb b/spec/requests/api/project_packages_spec.rb index 00d295b3490..5d7266932cb 100644 --- a/spec/requests/api/project_packages_spec.rb +++ b/spec/requests/api/project_packages_spec.rb @@ -350,6 +350,16 @@ RSpec.describe API::ProjectPackages do end end end + + context 'when package has no default status' do + let!(:package1) { create(:npm_package, :error, project: project) } + + it 'returns 404' do + subject + + expect(response).to have_gitlab_http_status(:not_found) + end + end end describe 'DELETE /projects/:id/packages/:package_id' do |