Commit 2bc65952 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'master' into ce-to-ee-2018-02-09

parents 7f712c6c 23d65b9f
...@@ -114,12 +114,16 @@ ...@@ -114,12 +114,16 @@
- cronjob:ldap_sync - cronjob:ldap_sync
- cronjob:update_all_mirrors - cronjob:update_all_mirrors
- geo:geo_base_scheduler
- geo:geo_file_download
- geo:geo_file_removal - geo:geo_file_removal
- geo:geo_hashed_storage_attachments_migration - geo:geo_hashed_storage_attachments_migration
- geo:geo_hashed_storage_migration - geo:geo_hashed_storage_migration
- geo:geo_project_sync
- geo:geo_rename_repository - geo:geo_rename_repository
- geo:geo_repositories_clean_up - geo:geo_repositories_clean_up
- geo:geo_repository_destroy - geo:geo_repository_destroy
- geo:geo_repository_shard_sync
- object_storage_upload - object_storage_upload
- object_storage:object_storage_background_move - object_storage:object_storage_background_move
...@@ -130,10 +134,6 @@ ...@@ -130,10 +134,6 @@
- elastic_commit_indexer - elastic_commit_indexer
- elastic_indexer - elastic_indexer
- export_csv - export_csv
- geo_base_scheduler
- geo_file_download
- geo_project_sync
- geo_repository_shard_sync
- ldap_group_sync - ldap_group_sync
- project_update_repository_storage - project_update_repository_storage
- rebase - rebase
......
...@@ -76,10 +76,6 @@ ...@@ -76,10 +76,6 @@
- [repository_update_remote_mirror, 1] - [repository_update_remote_mirror, 1]
- [project_update_repository_storage, 1] - [project_update_repository_storage, 1]
- [admin_emails, 1] - [admin_emails, 1]
- [geo_base_scheduler, 1] # Parent class of geo_repository_shard_sync and cronjob:geo_file_download_dispatch
- [geo_project_sync, 1]
- [geo_file_download, 1]
- [geo_repository_shard_sync, 1]
- [elastic_batch_project_indexer, 1] - [elastic_batch_project_indexer, 1]
- [elastic_indexer, 1] - [elastic_indexer, 1]
- [elastic_commit_indexer, 1] - [elastic_commit_indexer, 1]
......
module Geo module Geo
class BaseSchedulerWorker class BaseSchedulerWorker
include ApplicationWorker include ApplicationWorker
include GeoQueue
include ExclusiveLeaseGuard include ExclusiveLeaseGuard
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
......
module Geo module Geo
class FileDownloadWorker class FileDownloadWorker
include ApplicationWorker include ApplicationWorker
include GeoQueue
sidekiq_options retry: 3, dead: false sidekiq_options retry: 3, dead: false
......
module Geo module Geo
class ProjectSyncWorker class ProjectSyncWorker
include ApplicationWorker include ApplicationWorker
include GeoQueue
sidekiq_options retry: 3, dead: false sidekiq_options retry: 3, dead: false
......
require 'spec_helper' require 'spec_helper'
feature 'Profile > Pipeline Quota', :postgresql do describe 'Profile > Pipeline Quota' do
using RSpec::Parameterized::TableSyntax
set(:user) { create(:user) }
set(:namespace) { user.namespace }
set(:statistics) { create(:namespace_statistics, namespace: namespace) }
set(:project) { create(:project, namespace: namespace) }
set(:other_project) { create(:project, namespace: namespace, shared_runners_enabled: false) }
before do before do
gitlab_sign_in(user) gitlab_sign_in(user)
end end
let(:user) { create(:user) }
let(:namespace) { create(:namespace, owner: user) }
let!(:project) { create(:project, namespace: namespace, shared_runners_enabled: true) }
it 'is linked within the profile page' do it 'is linked within the profile page' do
visit profile_path visit profile_path
...@@ -17,67 +21,44 @@ feature 'Profile > Pipeline Quota', :postgresql do ...@@ -17,67 +21,44 @@ feature 'Profile > Pipeline Quota', :postgresql do
end end
end end
context 'with no quota' do describe 'shared runners use' do
let(:namespace) { create(:namespace, :with_build_minutes, owner: user) } where(:shared_runners_enabled, :used, :quota, :usage_class, :usage_text) do
false | 300 | 500 | 'success' | '300 / Unlimited minutes Unlimited'
it 'shows correct group quota info' do true | 300 | nil | 'success' | '300 / Unlimited minutes Unlimited'
visit profile_pipeline_quota_path true | 300 | 500 | 'success' | '300 / 500 minutes 60% used'
true | 1000 | 500 | 'danger' | '1000 / 500 minutes 200% used'
page.within('.pipeline-quota') do
expect(page).to have_content("400 / Unlimited minutes")
expect(page).to have_selector('.progress-bar-success')
end
end end
end
context 'with no projects using shared runners' do with_them do
let(:namespace) { create(:namespace, :with_not_used_build_minutes_limit, owner: user) } let(:no_shared_runners_text) { 'This group has no projects which use shared runners' }
let!(:project) { create(:project, namespace: namespace, shared_runners_enabled: false) }
it 'shows correct group quota info' do before do
visit profile_pipeline_quota_path project.update!(shared_runners_enabled: shared_runners_enabled)
statistics.update!(shared_runners_seconds: used.minutes.to_i)
namespace.update!(shared_runners_minutes_limit: quota)
page.within('.pipeline-quota') do visit profile_pipeline_quota_path
expect(page).to have_content("300 / Unlimited minutes")
expect(page).to have_selector('.progress-bar-success')
end end
page.within('.pipeline-project-metrics') do it 'shows the correct quota status' do
expect(page).to have_content('This group has no projects which use shared runners') page.within('.pipeline-quota') do
end expect(page).to have_content(usage_text)
end expect(page).to have_selector(".progress-bar-#{usage_class}")
end end
context 'minutes under quota' do
let(:namespace) { create(:namespace, :with_not_used_build_minutes_limit, owner: user) }
it 'shows correct group quota info' do
visit profile_pipeline_quota_path
page.within('.pipeline-quota') do
expect(page).to have_content("300 / 500 minutes")
expect(page).to have_content("60% used")
expect(page).to have_selector('.progress-bar-success')
end
end
end
context 'minutes over quota' do
let(:namespace) { create(:namespace, :with_used_build_minutes_limit, owner: user) }
let!(:other_project) { create(:project, namespace: namespace, shared_runners_enabled: false) }
it 'shows correct group quota and projects info' do
visit profile_pipeline_quota_path
page.within('.pipeline-quota') do
expect(page).to have_content("1000 / 500 minutes")
expect(page).to have_content("200% used")
expect(page).to have_selector('.progress-bar-danger')
end end
page.within('.pipeline-project-metrics') do it 'shows the correct per-project metrics' do
expect(page).to have_content(project.name) page.within('.pipeline-project-metrics') do
expect(page).not_to have_content(other_project.name) expect(page).not_to have_content(other_project.name)
if shared_runners_enabled
expect(page).to have_content(project.name)
expect(page).not_to have_content(no_shared_runners_text)
else
expect(page).not_to have_content(project.name)
expect(page).to have_content(no_shared_runners_text)
end
end
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment