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

Add latest changes from gitlab-org/gitlab@master

parent 0d6fa033
No related branches found
No related tags found
No related merge requests found
Showing
with 319 additions and 22 deletions
Loading
Loading
@@ -120,7 +120,7 @@ describe QA::Resource::ApiFabricator do
end
end
 
context '#transform_api_resource' do
describe '#transform_api_resource' do
let(:resource) do
Class.new do
def self.name
Loading
Loading
# frozen_string_literal: true
 
describe QA::Scenario::Test::Integration::Github do
context '#perform' do
describe '#perform' do
let(:env) { spy('Runtime::Env') }
 
before do
Loading
Loading
# frozen_string_literal: true
 
describe QA::Scenario::Test::Integration::InstanceSAML do
context '#perform' do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:instance_saml] }
end
Loading
Loading
# frozen_string_literal: true
 
describe QA::Scenario::Test::Integration::Kubernetes do
context '#perform' do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:kubernetes] }
end
Loading
Loading
# frozen_string_literal: true
 
describe QA::Scenario::Test::Integration::LDAPNoTLS do
context '#perform' do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:ldap_no_tls] }
end
Loading
Loading
@@ -9,7 +9,7 @@ describe QA::Scenario::Test::Integration::LDAPNoTLS do
end
 
describe QA::Scenario::Test::Integration::LDAPNoServer do
context '#perform' do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:ldap_no_server] }
end
Loading
Loading
@@ -17,7 +17,7 @@ describe QA::Scenario::Test::Integration::LDAPNoServer do
end
 
describe QA::Scenario::Test::Integration::LDAPTLS do
context '#perform' do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:ldap_tls] }
end
Loading
Loading
# frozen_string_literal: true
 
describe QA::Scenario::Test::Integration::Mattermost do
context '#perform' do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:args) { %w[gitlab_address mattermost_address] }
let(:args) do
Loading
Loading
# frozen_string_literal: true
 
describe QA::Scenario::Test::Integration::OAuth do
context '#perform' do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:oauth] }
end
Loading
Loading
# frozen_string_literal: true
 
describe QA::Scenario::Test::Integration::ObjectStorage do
context '#perform' do
describe '#perform' do
it_behaves_like 'a QA scenario class' do
let(:tags) { [:object_storage] }
end
Loading
Loading
Loading
Loading
@@ -11,7 +11,7 @@ describe QA::Specs::Runner do
end
end
 
context '#perform' do
describe '#perform' do
before do
allow(QA::Runtime::Browser).to receive(:configure!)
end
Loading
Loading
Loading
Loading
@@ -896,7 +896,7 @@ describe ApplicationController do
end
end
 
context '#set_current_context' do
describe '#set_current_context' do
controller(described_class) do
def index
Labkit::Context.with_context do |context|
Loading
Loading
Loading
Loading
@@ -14,7 +14,7 @@ describe Groups::Registry::RepositoriesController do
sign_in(user)
end
 
context 'GET #index' do
shared_examples 'renders a list of repositories' do
context 'when container registry is enabled' do
it 'show index page' do
expect(Gitlab::Tracking).not_to receive(:event)
Loading
Loading
@@ -33,6 +33,7 @@ describe Groups::Registry::RepositoriesController do
}
 
expect(response).to match_response_schema('registry/repositories')
expect(response).to include_pagination_headers
end
 
it 'returns a list of projects for json format' do
Loading
Loading
@@ -89,5 +90,29 @@ describe Groups::Registry::RepositoriesController do
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'with :vue_container_registry_explorer feature flag disabled' do
before do
stub_feature_flags(vue_container_registry_explorer: false)
end
it 'has the correct response schema' do
get :index, params: {
group_id: group,
format: :json
}
expect(response).to match_response_schema('registry/repositories')
expect(response).not_to include_pagination_headers
end
end
end
context 'GET #index' do
it_behaves_like 'renders a list of repositories'
end
context 'GET #show' do
it_behaves_like 'renders a list of repositories'
end
end
Loading
Loading
@@ -245,7 +245,7 @@ describe Projects::MilestonesController do
end
end
 
context '#participants' do
describe '#participants' do
render_views
 
context "when guest user" do
Loading
Loading
Loading
Loading
@@ -16,7 +16,7 @@ describe Projects::Registry::RepositoriesController do
project.add_developer(user)
end
 
describe 'GET index' do
shared_examples 'renders a list of repositories' do
context 'when root container repository exists' do
before do
create(:container_repository, :root, project: project)
Loading
Loading
@@ -58,6 +58,7 @@ describe Projects::Registry::RepositoriesController do
 
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('registry/repositories')
expect(response).to include_pagination_headers
end
end
 
Loading
Loading
@@ -84,9 +85,33 @@ describe Projects::Registry::RepositoriesController do
end
end
end
context 'with :vue_container_registry_explorer feature flag disabled' do
before do
stub_feature_flags(vue_container_registry_explorer: false)
stub_container_registry_tags(repository: project.full_path,
tags: %w[rc1 latest])
end
it 'json has a list of projects' do
go_to_index(format: :json)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('registry/repositories')
expect(response).not_to include_pagination_headers
end
end
end
describe 'GET #index' do
it_behaves_like 'renders a list of repositories'
end
describe 'GET #show' do
it_behaves_like 'renders a list of repositories'
end
 
describe 'DELETE destroy' do
describe 'DELETE #destroy' do
context 'when root container repository exists' do
let!(:repository) do
create(:container_repository, :root, project: project)
Loading
Loading
@@ -115,7 +140,7 @@ describe Projects::Registry::RepositoriesController do
end
 
context 'when user does not have access to registry' do
describe 'GET index' do
describe 'GET #index' do
it 'responds with 404' do
go_to_index
 
Loading
Loading
# frozen_string_literal: true
FactoryBot.define do
factory :alerting_alert, class: 'Gitlab::Alerting::Alert' do
project
payload { {} }
transient do
metric_id { nil }
after(:build) do |alert, evaluator|
unless alert.payload.key?('startsAt')
alert.payload['startsAt'] = Time.now.rfc3339
end
if metric_id = evaluator.metric_id
alert.payload['labels'] ||= {}
alert.payload['labels']['gitlab_alert_id'] = metric_id.to_s
end
end
end
skip_create
end
end
Loading
Loading
@@ -453,7 +453,7 @@ describe 'File blob', :js do
end
end
 
context '.gitlab-ci.yml' do
describe '.gitlab-ci.yml' do
before do
project.add_maintainer(project.creator)
 
Loading
Loading
@@ -481,7 +481,7 @@ describe 'File blob', :js do
end
end
 
context '.gitlab/route-map.yml' do
describe '.gitlab/route-map.yml' do
before do
project.add_maintainer(project.creator)
 
Loading
Loading
Loading
Loading
@@ -128,7 +128,7 @@ describe FinderWithCrossProjectAccess do
end
end
 
context '.finder_model' do
describe '.finder_model' do
it 'is set correctly' do
expect(finder_class.finder_model).to eq(Project)
end
Loading
Loading
# frozen_string_literal: true
require 'spec_helper'
describe Projects::Prometheus::AlertsFinder do
let(:finder) { described_class.new(params) }
let(:params) { {} }
describe 'with params' do
let_it_be(:project) { create(:project) }
let_it_be(:other_project) { create(:project) }
let_it_be(:other_env) { create(:environment, project: other_project) }
let_it_be(:production) { create(:environment, project: project) }
let_it_be(:staging) { create(:environment, project: project) }
let_it_be(:alert) { create_alert(project, production) }
let_it_be(:alert2) { create_alert(project, production) }
let_it_be(:stg_alert) { create_alert(project, staging) }
let_it_be(:other_alert) { create_alert(other_project, other_env) }
describe '#execute' do
subject { finder.execute }
context 'with project' do
before do
params[:project] = project
end
it { is_expected.to eq([alert, alert2, stg_alert]) }
context 'with matching metric' do
before do
params[:metric] = alert.prometheus_metric
end
it { is_expected.to eq([alert]) }
end
context 'with matching metric id' do
before do
params[:metric] = alert.prometheus_metric_id
end
it { is_expected.to eq([alert]) }
end
context 'with project non-specific metric' do
before do
params[:metric] = other_alert.prometheus_metric
end
it { is_expected.to be_empty }
end
end
context 'with environment' do
before do
params[:environment] = production
end
it { is_expected.to eq([alert, alert2]) }
context 'with matching metric' do
before do
params[:metric] = alert.prometheus_metric
end
it { is_expected.to eq([alert]) }
end
context 'with environment non-specific metric' do
before do
params[:metric] = stg_alert.prometheus_metric
end
it { is_expected.to be_empty }
end
end
context 'with matching project and environment' do
before do
params[:project] = project
params[:environment] = production
end
it { is_expected.to eq([alert, alert2]) }
context 'with matching metric' do
before do
params[:metric] = alert.prometheus_metric
end
it { is_expected.to eq([alert]) }
end
context 'with environment non-specific metric' do
before do
params[:metric] = stg_alert.prometheus_metric
end
it { is_expected.to be_empty }
end
context 'with matching id' do
before do
params[:id] = alert.id
end
it { is_expected.to eq([alert]) }
end
context 'with a nil id' do
before do
params[:id] = nil
end
it { is_expected.to eq([alert, alert2]) }
end
end
context 'with non-matching project-environment pair' do
before do
params[:project] = project
params[:environment] = other_env
end
it { is_expected.to be_empty }
end
context 'with id' do
before do
params[:id] = alert.id
end
it { is_expected.to eq([alert]) }
end
context 'with multiple ids' do
before do
params[:id] = [alert.id, other_alert.id]
end
it { is_expected.to eq([alert, other_alert]) }
end
context 'with non-matching id' do
before do
params[:id] = -5
end
it { is_expected.to be_empty }
end
end
private
def create_alert(project, environment)
create(:prometheus_alert, project: project, environment: environment)
end
end
describe 'without params' do
subject { finder }
it 'raises an error' do
expect { subject }
.to raise_error(ArgumentError, 'Please provide one or more of the following params: :project, :environment, :id')
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe ProtectedBranchesFinder do
let(:project) { create(:project) }
let!(:protected_branch) { create(:protected_branch, project: project) }
let!(:another_protected_branch) { create(:protected_branch, project: project) }
let!(:other_protected_branch) { create(:protected_branch) }
let(:params) { {} }
describe '#execute' do
subject { described_class.new(project, params).execute }
it 'returns all protected branches of project by default' do
expect(subject).to match_array([protected_branch, another_protected_branch])
end
context 'when search param is present' do
let(:params) { { search: protected_branch.name } }
it 'filters by search param' do
expect(subject).to eq([protected_branch])
end
end
context 'when there are more protected branches than the limit' do
before do
stub_const("#{described_class}::LIMIT", 1)
end
it 'returns limited protected branches of project' do
expect(subject).to eq([another_protected_branch])
end
end
end
end
import { shallowMount } from '@vue/test-utils';
import ExternalUrlComp from '~/environments/components/environment_external_url.vue';
describe('External URL Component', () => {
let wrapper;
const externalUrl = 'https://gitlab.com';
beforeEach(() => {
wrapper = shallowMount(ExternalUrlComp, { propsData: { externalUrl } });
});
it('should link to the provided externalUrl prop', () => {
expect(wrapper.attributes('href')).toEqual(externalUrl);
expect(wrapper.find('a').exists()).toBe(true);
});
});
Loading
Loading
@@ -258,7 +258,7 @@ describe DiffHelper do
end
end
 
context '#render_overflow_warning?' do
describe '#render_overflow_warning?' do
let(:diffs_collection) { instance_double(Gitlab::Diff::FileCollection::MergeRequestDiff, raw_diff_files: diff_files) }
let(:diff_files) { Gitlab::Git::DiffCollection.new(files) }
let(:safe_file) { { too_large: false, diff: '' } }
Loading
Loading
@@ -303,7 +303,7 @@ describe DiffHelper do
end
end
 
context '#diff_file_path_text' do
describe '#diff_file_path_text' do
it 'returns full path by default' do
expect(diff_file_path_text(diff_file)).to eq(diff_file.new_path)
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