Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-17 06:09:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-17 06:09:27 +0300
commit9345f69894862e02f3491ea3136c3ed2b23fd5b8 (patch)
tree08a4a1b2861cd5894e2a1146300a206071f06ea3 /spec/lib/gitlab
parentd43aaf286fe6b8e8383e73ea580274d8841608d7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r--spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb28
-rw-r--r--spec/lib/gitlab/gitaly_client/operation_service_spec.rb4
2 files changed, 18 insertions, 14 deletions
diff --git a/spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb b/spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb
index 0b8f64e97a1..923f620a81d 100644
--- a/spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb
+++ b/spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb
@@ -50,7 +50,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
end
end
- context 'with application settings and admin users' do
+ context 'with application settings and admin users', :request_store do
let(:project) { result[:project] }
let(:group) { result[:group] }
let(:application_setting) { Gitlab::CurrentSettings.current_application_settings }
@@ -58,8 +58,9 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
let!(:user) { create(:user, :admin) }
before do
- allow(ApplicationSetting).to receive(:current_without_cache) { application_setting }
- application_setting.allow_local_requests_from_web_hooks_and_services = true
+ stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
+
+ application_setting.update(allow_local_requests_from_web_hooks_and_services: true)
end
shared_examples 'has prometheus service' do |listen_address|
@@ -130,12 +131,17 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
it 'saves the project id' do
expect(result[:status]).to eq(:success)
- expect(application_setting.self_monitoring_project_id).to eq(project.id)
+ expect(application_setting.reload.self_monitoring_project_id).to eq(project.id)
end
- it 'expires application_setting cache' do
- expect(Gitlab::CurrentSettings).to receive(:expire_current_application_settings)
+ it 'creates a Prometheus service' do
expect(result[:status]).to eq(:success)
+
+ services = result[:project].reload.services
+
+ expect(services.count).to eq(1)
+ # Ensures PrometheusService#self_monitoring_project? is true
+ expect(services.first.allow_local_api_url?).to be_truthy
end
it 'creates an environment for the project' do
@@ -158,8 +164,8 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
end
it 'returns error when saving project ID fails' do
- allow(application_setting).to receive(:update).and_call_original
- allow(application_setting).to receive(:update)
+ allow(subject.application_settings).to receive(:update).and_call_original
+ allow(subject.application_settings).to receive(:update)
.with(self_monitoring_project_id: anything)
.and_return(false)
@@ -175,8 +181,8 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
let(:existing_project) { create(:project, namespace: existing_group) }
before do
- application_setting.instance_administrators_group_id = existing_group.id
- application_setting.self_monitoring_project_id = existing_project.id
+ application_setting.update(instance_administrators_group_id: existing_group.id,
+ self_monitoring_project_id: existing_project.id)
end
it 'returns success' do
@@ -189,7 +195,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
context 'when local requests from hooks and services are not allowed' do
before do
- application_setting.allow_local_requests_from_web_hooks_and_services = false
+ application_setting.update(allow_local_requests_from_web_hooks_and_services: false)
end
it_behaves_like 'has prometheus service', 'http://localhost:9090'
diff --git a/spec/lib/gitlab/gitaly_client/operation_service_spec.rb b/spec/lib/gitlab/gitaly_client/operation_service_spec.rb
index 563e0590482..45701b501bb 100644
--- a/spec/lib/gitlab/gitaly_client/operation_service_spec.rb
+++ b/spec/lib/gitlab/gitaly_client/operation_service_spec.rb
@@ -274,7 +274,6 @@ describe Gitlab::GitalyClient::OperationService do
end
describe '#user_squash' do
- let(:branch_name) { 'my-branch' }
let(:squash_id) { '1' }
let(:start_sha) { 'b83d6e391c22777fca1ed3012fce84f633d7fed0' }
let(:end_sha) { '54cec5282aa9f21856362fe321c800c236a61615' }
@@ -284,7 +283,6 @@ describe Gitlab::GitalyClient::OperationService do
repository: repository.gitaly_repository,
user: gitaly_user,
squash_id: squash_id.to_s,
- branch: branch_name,
start_sha: start_sha,
end_sha: end_sha,
author: gitaly_user,
@@ -295,7 +293,7 @@ describe Gitlab::GitalyClient::OperationService do
let(:response) { Gitaly::UserSquashResponse.new(squash_sha: squash_sha) }
subject do
- client.user_squash(user, squash_id, branch_name, start_sha, end_sha, user, commit_message)
+ client.user_squash(user, squash_id, start_sha, end_sha, user, commit_message)
end
it 'sends a user_squash message and returns the squash sha' do