Skip to content
Snippets Groups Projects
Commit 72721699 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 06be418a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -16,7 +16,8 @@
"label": { "type": "string" },
"track": { "type": "string" },
"prometheus_endpoint_path": { "type": "string" },
"metric_id": { "type": "number" }
"metric_id": { "type": "number" },
"edit_path": { "type": ["string", "null"] }
},
"additionalProperties": false
}
Loading
Loading
@@ -10,7 +10,8 @@
"panels": {
"type": "array",
"items": { "$ref": "panels.json" }
}
},
"has_custom_metrics": { "type": "boolean" }
},
"additionalProperties": false
}
Loading
Loading
@@ -394,6 +394,12 @@ describe Gitlab::Database do
expect(described_class.cached_table_exists?(:bogus_table_name)).to be_falsey
end
end
it 'returns false when database does not exist' do
expect(ActiveRecord::Base).to receive(:connection) { raise ActiveRecord::NoDatabaseError, 'broken' }
expect(described_class.cached_table_exists?(:projects)).to be(false)
end
end
 
describe '.exists?' do
Loading
Loading
Loading
Loading
@@ -281,6 +281,19 @@ describe Gitlab::GitalyClient::CommitService do
end
 
describe '#find_commits' do
it 'sends an RPC request with NONE when default' do
request = Gitaly::FindCommitsRequest.new(
repository: repository_message,
disable_walk: true,
order: 'NONE'
)
expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:find_commits)
.with(request, kind_of(Hash)).and_return([])
client.find_commits(order: 'default')
end
it 'sends an RPC request' do
request = Gitaly::FindCommitsRequest.new(
repository: repository_message,
Loading
Loading
Loading
Loading
@@ -12,6 +12,7 @@ describe Gitlab::Metrics::Dashboard::Processor do
[
Gitlab::Metrics::Dashboard::Stages::CommonMetricsInserter,
Gitlab::Metrics::Dashboard::Stages::ProjectMetricsInserter,
Gitlab::Metrics::Dashboard::Stages::ProjectMetricsDetailsInserter,
Gitlab::Metrics::Dashboard::Stages::EndpointInserter,
Gitlab::Metrics::Dashboard::Stages::Sorter
]
Loading
Loading
@@ -25,6 +26,10 @@ describe Gitlab::Metrics::Dashboard::Processor do
end
end
 
it 'includes boolean to indicate if panel group has custom metrics' do
expect(dashboard[:panel_groups]).to all(include( { has_custom_metrics: boolean } ))
end
context 'when the dashboard is not present' do
let(:dashboard_yml) { nil }
 
Loading
Loading
@@ -145,7 +150,8 @@ describe Gitlab::Metrics::Dashboard::Processor do
unit: metric.unit,
label: metric.legend,
metric_id: metric.id,
prometheus_endpoint_path: prometheus_path(metric.query)
prometheus_endpoint_path: prometheus_path(metric.query),
edit_path: edit_metric_path(metric)
}
end
 
Loading
Loading
@@ -165,4 +171,11 @@ describe Gitlab::Metrics::Dashboard::Processor do
identifier: metric
)
end
def edit_metric_path(metric)
Gitlab::Routing.url_helpers.edit_project_prometheus_metric_path(
project,
metric.id
)
end
end
Loading
Loading
@@ -104,6 +104,14 @@ describe PagesDomain do
describe 'validate certificate' do
subject { domain }
 
context 'serverless domain' do
it 'requires certificate and key to be present' do
expect(build(:pages_domain, :without_certificate, :without_key, usage: :serverless)).not_to be_valid
expect(build(:pages_domain, :without_certificate, usage: :serverless)).not_to be_valid
expect(build(:pages_domain, :without_key, usage: :serverless)).not_to be_valid
end
end
context 'with matching key' do
let(:domain) { build(:pages_domain) }
 
Loading
Loading
@@ -555,6 +563,28 @@ describe PagesDomain do
end
end
 
describe '.instance_serverless' do
subject { described_class.instance_serverless }
before do
create(:pages_domain, wildcard: true)
create(:pages_domain, :instance_serverless)
create(:pages_domain, scope: :instance)
create(:pages_domain, :instance_serverless)
create(:pages_domain, usage: :serverless)
end
it 'returns domains that are wildcard, instance-level, and serverless' do
expect(subject.length).to eq(2)
subject.each do |domain|
expect(domain.wildcard).to eq(true)
expect(domain.usage).to eq('serverless')
expect(domain.scope).to eq('instance')
end
end
end
describe '.need_auto_ssl_renewal' do
subject { described_class.need_auto_ssl_renewal }
 
Loading
Loading
Loading
Loading
@@ -266,8 +266,30 @@ describe API::Commits do
end
end
 
context 'set to blank' do
let(:order) { '' }
context 'set to default' do
let(:order) { 'default' }
# git log --graph -n 6 --pretty=format:"%h" --date-order 0031876
# * 0031876
# |\
# * | bf6e164
# | * 48ca272
# * | 9d526f8
# | * 335bc94
# |/
# * 1039376
it 'returns project commits ordered by default order' do
commits = project.repository.commits("0031876", limit: 6, order: 'default')
get api(route, current_user)
expect(json_response.size).to eq(6)
expect(json_response.map { |entry| entry["id"] }).to eq(commits.map(&:id))
end
end
context 'set to an invalid parameter' do
let(:order) { 'invalid' }
 
it_behaves_like '400 response' do
let(:request) { get api(route, current_user) }
Loading
Loading
# frozen_string_literal: true
require 'spec_helper'
describe Admin::Serverless::DomainsController do
it 'routes to #index' do
expect(get: '/admin/serverless/domains').to route_to('admin/serverless/domains#index')
end
it 'routes to #create' do
expect(post: '/admin/serverless/domains/').to route_to('admin/serverless/domains#create')
end
it 'routes to #update' do
expect(put: '/admin/serverless/domains/1').to route_to(controller: 'admin/serverless/domains', action: 'update', id: '1')
expect(patch: '/admin/serverless/domains/1').to route_to(controller: 'admin/serverless/domains', action: 'update', id: '1')
end
it 'routes #verify' do
expect(post: '/admin/serverless/domains/1/verify').to route_to(controller: 'admin/serverless/domains', action: 'verify', id: '1')
end
end
Loading
Loading
@@ -164,7 +164,9 @@ describe Snippets::CreateService do
it 'does not create snippet repository' do
stub_feature_flags(version_snippets: false)
 
subject
expect do
subject
end.to change(Snippet, :count).by(1)
 
expect(snippet.repository_exists?).to be_falsey
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment