diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 17:02:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 17:02:45 +0300 |
commit | 80f61b4035607d7cd87de993b8f5e996bde3481f (patch) | |
tree | 06b12f51e97d87192e3dd0e05edf55143645b894 /spec/lib/gitlab | |
parent | 4ab54c2233e91f60a80e5b6fa2181e6899fdcc3e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab')
22 files changed, 132 insertions, 279 deletions
diff --git a/spec/lib/gitlab/background_migration/add_gitlab_instance_administration_project_spec.rb b/spec/lib/gitlab/background_migration/add_gitlab_instance_administration_project_spec.rb deleted file mode 100644 index 76062b191a8..00000000000 --- a/spec/lib/gitlab/background_migration/add_gitlab_instance_administration_project_spec.rb +++ /dev/null @@ -1,234 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe Gitlab::BackgroundMigration::AddGitlabInstanceAdministrationProject, :migration, schema: 20190725080128 do - let(:application_settings) { table(:application_settings) } - let(:users) { table(:users) } - let(:projects) { table(:projects) } - let(:namespaces) { table(:namespaces) } - let(:members) { table(:members) } - - let(:service_class) do - Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService - end - - let(:prometheus_settings) do - { - enable: true, - listen_address: 'localhost:9090' - } - end - - before do - stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') - - stub_config(prometheus: prometheus_settings) - end - - describe 'perform' do - context 'without application_settings' do - it 'does not fail' do - subject.perform - - expect(Project.count).to eq(0) - end - end - - context 'without admin users' do - let!(:application_setting) { application_settings.create! } - - it 'does not fail' do - subject.perform - - expect(Project.count).to eq(0) - end - end - - context 'with admin users' do - let(:project) { Project.last } - let(:group) { Group.last } - let!(:application_setting) { application_settings.create! } - let!(:user) { users.create!(admin: true, email: 'admin1@example.com', projects_limit: 10, state: :active) } - - before do - stub_application_setting(allow_local_requests_from_web_hooks_and_services: true) - end - - shared_examples 'has prometheus service' do |listen_address| - it do - subject.perform - - prometheus = project.prometheus_service - expect(prometheus).to be_persisted - expect(prometheus).not_to eq(nil) - expect(prometheus.api_url).to eq(listen_address) - expect(prometheus.active).to eq(true) - expect(prometheus.manual_configuration).to eq(true) - end - end - - it_behaves_like 'has prometheus service', 'http://localhost:9090' - - it 'creates GitLab Instance Administrator group' do - subject.perform - - expect(group).to be_persisted - expect(group.name).to eq('GitLab Instance Administrators') - expect(group.path).to start_with('gitlab-instance-administrators') - expect(group.path.split('-').last.length).to eq(8) - expect(group.visibility_level).to eq(service_class::VISIBILITY_LEVEL) - end - - it 'creates project with internal visibility' do - subject.perform - - expect(project.visibility_level).to eq(Gitlab::VisibilityLevel::INTERNAL) - expect(project).to be_persisted - end - - it 'creates project with correct name and description' do - subject.perform - - path = 'administration/monitoring/gitlab_instance_administration_project/index' - docs_path = Rails.application.routes.url_helpers.help_page_path(path) - - expect(project.name).to eq(service_class::PROJECT_NAME) - expect(project.description).to eq( - 'This project is automatically generated and will be used to help monitor this GitLab instance. ' \ - "[More information](#{docs_path})" - ) - expect(File).to exist("doc/#{path}.md") - end - - it 'adds all admins as maintainers' do - admin1 = users.create!(admin: true, email: 'admin2@example.com', projects_limit: 10, state: :active) - admin2 = users.create!(admin: true, email: 'admin3@example.com', projects_limit: 10, state: :active) - users.create!(email: 'nonadmin1@example.com', projects_limit: 10, state: :active) - - subject.perform - - expect(project.owner).to eq(group) - expect(group.members.collect(&:user).collect(&:id)).to contain_exactly(user.id, admin1.id, admin2.id) - expect(group.members.collect(&:access_level)).to contain_exactly( - Gitlab::Access::OWNER, - Gitlab::Access::MAINTAINER, - Gitlab::Access::MAINTAINER - ) - end - - it 'saves the project id' do - subject.perform - - application_setting.reload - expect(application_setting.instance_administration_project_id).to eq(project.id) - end - - it 'does not fail when a project already exists' do - group = namespaces.create!( - path: 'gitlab-instance-administrators', - name: 'GitLab Instance Administrators', - type: 'Group' - ) - project = projects.create!( - namespace_id: group.id, - name: 'GitLab Instance Administration' - ) - - admin1 = users.create!(admin: true, email: 'admin4@example.com', projects_limit: 10, state: :active) - admin2 = users.create!(admin: true, email: 'admin5@example.com', projects_limit: 10, state: :active) - - members.create!( - user_id: admin1.id, - source_id: group.id, - source_type: 'Namespace', - type: 'GroupMember', - access_level: GroupMember::MAINTAINER, - notification_level: NotificationSetting.levels[:global] - ) - members.create!( - user_id: admin2.id, - source_id: group.id, - source_type: 'Namespace', - type: 'GroupMember', - access_level: GroupMember::MAINTAINER, - notification_level: NotificationSetting.levels[:global] - ) - - stub_application_setting(instance_administration_project: project) - - subject.perform - - expect(Project.last.id).to eq(project.id) - expect(Group.last.id).to eq(group.id) - end - - context 'when local requests from hooks and services are not allowed' do - before do - stub_application_setting(allow_local_requests_from_web_hooks_and_services: false) - end - - it_behaves_like 'has prometheus service', 'http://localhost:9090' - - it 'does not overwrite the existing whitelist' do - application_setting.update!(outbound_local_requests_whitelist: ['example.com']) - - subject.perform - - application_setting.reload - expect(application_setting.outbound_local_requests_whitelist).to contain_exactly( - 'example.com', 'localhost' - ) - end - end - - context 'with non default prometheus address' do - let(:prometheus_settings) do - { - enable: true, - listen_address: 'https://localhost:9090' - } - end - - it_behaves_like 'has prometheus service', 'https://localhost:9090' - end - - context 'when prometheus setting is not present in gitlab.yml' do - before do - allow(Gitlab.config).to receive(:prometheus).and_raise(Settingslogic::MissingSetting) - end - - it 'does not fail' do - subject.perform - - expect(project.prometheus_service).to be_nil - end - end - - context 'when prometheus setting is disabled in gitlab.yml' do - let(:prometheus_settings) do - { - enable: false, - listen_address: 'localhost:9090' - } - end - - it 'does not configure prometheus' do - subject.perform - - expect(project.prometheus_service).to be_nil - end - end - - context 'when prometheus listen address is blank in gitlab.yml' do - let(:prometheus_settings) { { enable: true, listen_address: '' } } - - it 'does not configure prometheus' do - subject.perform - - expect(project.prometheus_service).to be_nil - end - end - end - end -end diff --git a/spec/lib/gitlab/ci/config/external/file/remote_spec.rb b/spec/lib/gitlab/ci/config/external/file/remote_spec.rb index 46d68097fff..4a097b59216 100644 --- a/spec/lib/gitlab/ci/config/external/file/remote_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/remote_spec.rb @@ -8,7 +8,7 @@ describe Gitlab::Ci::Config::External::File::Remote do let(:context) { described_class::Context.new(nil, '12345', nil, Set.new) } let(:params) { { remote: location } } let(:remote_file) { described_class.new(params, context) } - let(:location) { 'https://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:location) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } let(:remote_file_content) do <<~HEREDOC before_script: @@ -57,7 +57,7 @@ describe Gitlab::Ci::Config::External::File::Remote do end context 'with an irregular url' do - let(:location) { 'not-valid://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:location) { 'not-valid://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } it 'returns false' do expect(remote_file.valid?).to be_falsy @@ -137,7 +137,7 @@ describe Gitlab::Ci::Config::External::File::Remote do subject { remote_file.error_message } context 'when remote file location is not valid' do - let(:location) { 'not-valid://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:location) { 'not-valid://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } it 'returns an error message describing invalid address' do expect(subject).to match /does not have a valid address!/ diff --git a/spec/lib/gitlab/ci/config/external/mapper_spec.rb b/spec/lib/gitlab/ci/config/external/mapper_spec.rb index e068b786b02..43708852594 100644 --- a/spec/lib/gitlab/ci/config/external/mapper_spec.rb +++ b/spec/lib/gitlab/ci/config/external/mapper_spec.rb @@ -9,7 +9,7 @@ describe Gitlab::Ci::Config::External::Mapper do set(:user) { create(:user) } let(:local_file) { '/lib/gitlab/ci/templates/non-existent-file.yml' } - let(:remote_url) { 'https://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:remote_url) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } let(:template_file) { 'Auto-DevOps.gitlab-ci.yml' } let(:expandset) { Set.new } diff --git a/spec/lib/gitlab/ci/config/external/processor_spec.rb b/spec/lib/gitlab/ci/config/external/processor_spec.rb index 856187371e1..3b1a1e804f0 100644 --- a/spec/lib/gitlab/ci/config/external/processor_spec.rb +++ b/spec/lib/gitlab/ci/config/external/processor_spec.rb @@ -56,7 +56,7 @@ describe Gitlab::Ci::Config::External::Processor do end context 'with a valid remote external file is defined' do - let(:remote_file) { 'https://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:remote_file) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } let(:values) { { include: remote_file, image: 'ruby:2.2' } } let(:external_file_content) do <<-HEREDOC @@ -118,7 +118,7 @@ describe Gitlab::Ci::Config::External::Processor do end context 'with multiple external files are defined' do - let(:remote_file) { 'https://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:remote_file) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } let(:external_files) do [ '/spec/fixtures/gitlab/ci/external_files/.gitlab-ci-template-1.yml', @@ -178,7 +178,7 @@ describe Gitlab::Ci::Config::External::Processor do end context "when both external files and values defined the same key" do - let(:remote_file) { 'https://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:remote_file) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } let(:values) do { include: remote_file, diff --git a/spec/lib/gitlab/ci/config_spec.rb b/spec/lib/gitlab/ci/config_spec.rb index 986cde3540a..839b4f9261d 100644 --- a/spec/lib/gitlab/ci/config_spec.rb +++ b/spec/lib/gitlab/ci/config_spec.rb @@ -209,7 +209,7 @@ describe Gitlab::Ci::Config do context "when using 'include' directive" do let(:project) { create(:project, :repository) } - let(:remote_location) { 'https://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:remote_location) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } let(:local_location) { 'spec/fixtures/gitlab/ci/external_files/.gitlab-ci-template-1.yml' } let(:remote_file_content) do diff --git a/spec/lib/gitlab/ci/trace/stream_spec.rb b/spec/lib/gitlab/ci/trace/stream_spec.rb index af519f4bae6..dd5f2f97ac9 100644 --- a/spec/lib/gitlab/ci/trace/stream_spec.rb +++ b/spec/lib/gitlab/ci/trace/stream_spec.rb @@ -58,7 +58,7 @@ describe Gitlab::Ci::Trace::Stream, :clean_gitlab_redis_cache do expect(result.encoding).to eq(Encoding.default_external) end - # See https://gitlab.com/gitlab-org/gitlab-ce/issues/30796 + # See https://gitlab.com/gitlab-org/gitlab-foss/issues/30796 it 'reads in binary, output as Encoding.default_external' do stream.limit(52) diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb index 8f2f23f6110..d43eb4e4b4a 100644 --- a/spec/lib/gitlab/ci/yaml_processor_spec.rb +++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb @@ -1288,7 +1288,7 @@ module Gitlab options: { script: ["test"], # This does not make sense, there is a follow-up: - # https://gitlab.com/gitlab-org/gitlab-ce/issues/65569 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/65569 bridge_needs: %w[build1 build2] }, needs_attributes: [ diff --git a/spec/lib/gitlab/cleanup/project_uploads_spec.rb b/spec/lib/gitlab/cleanup/project_uploads_spec.rb index bf130b8fabd..7bad788e44e 100644 --- a/spec/lib/gitlab/cleanup/project_uploads_spec.rb +++ b/spec/lib/gitlab/cleanup/project_uploads_spec.rb @@ -125,7 +125,7 @@ describe Gitlab::Cleanup::ProjectUploads do end # We will probably want to add logic (Reschedule background upload) to - # cover Case 2 in https://gitlab.com/gitlab-org/gitlab-ce/issues/46535#note_75355104 + # cover Case 2 in https://gitlab.com/gitlab-org/gitlab-foss/issues/46535#note_75355104 context 'when the file should be in object storage' do context 'when the file otherwise has the correct local path' do let!(:orphaned) { create(:upload, :issuable_upload, :object_storage, model: build(:project, :legacy_storage)) } diff --git a/spec/lib/gitlab/config/loader/yaml_spec.rb b/spec/lib/gitlab/config/loader/yaml_spec.rb index ccddf340c3d..28039e99916 100644 --- a/spec/lib/gitlab/config/loader/yaml_spec.rb +++ b/spec/lib/gitlab/config/loader/yaml_spec.rb @@ -63,7 +63,7 @@ describe Gitlab::Config::Loader::Yaml do end end - # Prevent Billion Laughs attack: https://gitlab.com/gitlab-org/gitlab-ce/issues/56018 + # Prevent Billion Laughs attack: https://gitlab.com/gitlab-org/gitlab-foss/issues/56018 context 'when yaml size is too large' do let(:yml) do <<~YAML @@ -101,7 +101,7 @@ describe Gitlab::Config::Loader::Yaml do end end - # Prevent Billion Laughs attack: https://gitlab.com/gitlab-org/gitlab-ce/issues/56018 + # Prevent Billion Laughs attack: https://gitlab.com/gitlab-org/gitlab-foss/issues/56018 context 'when yaml has cyclic data structure' do let(:yml) do <<~YAML diff --git a/spec/lib/gitlab/encoding_helper_spec.rb b/spec/lib/gitlab/encoding_helper_spec.rb index fc08719fb33..d091b6c1601 100644 --- a/spec/lib/gitlab/encoding_helper_spec.rb +++ b/spec/lib/gitlab/encoding_helper_spec.rb @@ -111,7 +111,7 @@ describe Gitlab::EncodingHelper do "Rüby ist eine Programmiersprache. Wir verlängern den text damit ICU die Sprache erkennen kann.".encode("UTF-8") ], [ - # Test case from https://gitlab.com/gitlab-org/gitlab-ce/issues/39227 + # Test case from https://gitlab.com/gitlab-org/gitlab-foss/issues/39227 "Equifax branch name", "refs/heads/Equifax".encode("UTF-8"), "refs/heads/Equifax".encode("UTF-8") diff --git a/spec/lib/gitlab/etag_caching/middleware_spec.rb b/spec/lib/gitlab/etag_caching/middleware_spec.rb index 9ead55075fa..e7734c6f9f6 100644 --- a/spec/lib/gitlab/etag_caching/middleware_spec.rb +++ b/spec/lib/gitlab/etag_caching/middleware_spec.rb @@ -7,10 +7,10 @@ describe Gitlab::EtagCaching::Middleware do let(:middleware) { described_class.new(app) } let(:app_status_code) { 200 } let(:if_none_match) { nil } - let(:enabled_path) { '/gitlab-org/gitlab-ce/noteable/issue/1/notes' } + let(:enabled_path) { '/gitlab-org/gitlab-foss/noteable/issue/1/notes' } context 'when ETag caching is not enabled for current route' do - let(:path) { '/gitlab-org/gitlab-ce/tree/master/noteable/issue/1/notes' } + let(:path) { '/gitlab-org/gitlab-foss/tree/master/noteable/issue/1/notes' } before do mock_app_response diff --git a/spec/lib/gitlab/etag_caching/router_spec.rb b/spec/lib/gitlab/etag_caching/router_spec.rb index fbc49d894a6..8fcd4eb3c21 100644 --- a/spec/lib/gitlab/etag_caching/router_spec.rb +++ b/spec/lib/gitlab/etag_caching/router_spec.rb @@ -92,6 +92,15 @@ describe Gitlab::EtagCaching::Router do expect(result).to be_blank end + it 'matches the cluster environments path' do + result = described_class.match( + '/my-group/my-project/-/clusters/47/environments' + ) + + expect(result).to be_present + expect(result.name).to eq 'cluster_environments' + end + it 'matches the environments path' do result = described_class.match( '/my-group/my-project/environments.json' diff --git a/spec/lib/gitlab/external_authorization_spec.rb b/spec/lib/gitlab/external_authorization_spec.rb index 7394fbfe0ce..c45fcca3f06 100644 --- a/spec/lib/gitlab/external_authorization_spec.rb +++ b/spec/lib/gitlab/external_authorization_spec.rb @@ -10,7 +10,7 @@ describe Gitlab::ExternalAuthorization, :request_store do it 'is always true when the feature is disabled' do # Not using `stub_application_setting` because the method is prepended in # `EE::ApplicationSetting` which breaks when using `any_instance` - # https://gitlab.com/gitlab-org/gitlab-ce/issues/33587 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/33587 expect(::Gitlab::CurrentSettings.current_application_settings) .to receive(:external_authorization_service_enabled) { false } diff --git a/spec/lib/gitlab/git/keep_around_spec.rb b/spec/lib/gitlab/git/keep_around_spec.rb new file mode 100644 index 00000000000..04ccf86cd28 --- /dev/null +++ b/spec/lib/gitlab/git/keep_around_spec.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Gitlab::Git::KeepAround do + include RepoHelpers + + let(:repository) { create(:project, :repository).repository } + let(:service) { described_class.new(repository) } + + it "does not fail if we attempt to reference bad commit" do + expect(service.kept_around?('abc1234')).to be_falsey + end + + it "stores a reference to the specified commit sha so it isn't garbage collected" do + service.execute([sample_commit.id]) + + expect(service.kept_around?(sample_commit.id)).to be_truthy + end + + it "attempting to call keep around on truncated ref does not fail" do + service.execute([sample_commit.id]) + ref = service.send(:keep_around_ref_name, sample_commit.id) + + path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do + File.join(repository.path, ref) + end + # Corrupt the reference + File.truncate(path, 0) + + expect(service.kept_around?(sample_commit.id)).to be_falsey + + service.execute([sample_commit.id]) + + expect(service.kept_around?(sample_commit.id)).to be_falsey + + File.delete(path) + end + + context 'for multiple SHAs' do + it 'skips non-existent SHAs' do + service.execute(['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', sample_commit.id]) + + expect(service.kept_around?(sample_commit.id)).to be_truthy + end + + it 'skips already-kept-around SHAs' do + service.execute([sample_commit.id]) + + expect(repository.raw_repository).to receive(:write_ref).exactly(1).and_call_original + + service.execute([sample_commit.id, another_sample_commit.id]) + + expect(service.kept_around?(another_sample_commit.id)).to be_truthy + end + end +end diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index e455c4c99ab..dcb7401b695 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -132,7 +132,7 @@ describe Gitlab::Git::Repository, :seed_helper do it 'sets ArchivePath to the expected globally-unique path' do # This is really important from a security perspective. Think carefully - # before changing it: https://gitlab.com/gitlab-org/gitlab-ce/issues/45689 + # before changing it: https://gitlab.com/gitlab-org/gitlab-foss/issues/45689 expect(expected_path).to include(File.join(repository.gl_repository, SeedRepo::LastCommit::ID)) expect(metadata['ArchivePath']).to eq(expected_path) diff --git a/spec/lib/gitlab/import_export/project.json b/spec/lib/gitlab/import_export/project.json index a211675bbf2..5f4bf18c743 100644 --- a/spec/lib/gitlab/import_export/project.json +++ b/spec/lib/gitlab/import_export/project.json @@ -3684,7 +3684,7 @@ "merge_request_diff_id": 14, "relative_order": 13, "sha": "e56497bb5f03a90a51293fc6d516788730953899", - "message": "Merge branch 'tree_helper_spec' into 'master'\n\nAdd directory structure for tree_helper spec\n\nThis directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module\n\nSee [merge request #275](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/275#note_732774)\n\nSee merge request !2\n", + "message": "Merge branch 'tree_helper_spec' into 'master'\n\nAdd directory structure for tree_helper spec\n\nThis directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module\n\nSee [merge request #275](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/275#note_732774)\n\nSee merge request !2\n", "authored_date": "2015-01-10T22:23:29.000+01:00", "author_name": "Sytse Sijbrandij", "author_email": "sytse@gitlab.com", @@ -4369,7 +4369,7 @@ "merge_request_diff_id": 13, "relative_order": 13, "sha": "e56497bb5f03a90a51293fc6d516788730953899", - "message": "Merge branch 'tree_helper_spec' into 'master'\n\nAdd directory structure for tree_helper spec\n\nThis directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module\n\nSee [merge request #275](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/275#note_732774)\n\nSee merge request !2\n", + "message": "Merge branch 'tree_helper_spec' into 'master'\n\nAdd directory structure for tree_helper spec\n\nThis directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module\n\nSee [merge request #275](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/275#note_732774)\n\nSee merge request !2\n", "authored_date": "2015-01-10T22:23:29.000+01:00", "author_name": "Sytse Sijbrandij", "author_email": "sytse@gitlab.com", @@ -5586,7 +5586,7 @@ "merge_request_diff_id": 10, "relative_order": 13, "sha": "e56497bb5f03a90a51293fc6d516788730953899", - "message": "Merge branch 'tree_helper_spec' into 'master'\n\nAdd directory structure for tree_helper spec\n\nThis directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module\n\nSee [merge request #275](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/275#note_732774)\n\nSee merge request !2\n", + "message": "Merge branch 'tree_helper_spec' into 'master'\n\nAdd directory structure for tree_helper spec\n\nThis directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module\n\nSee [merge request #275](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/275#note_732774)\n\nSee merge request !2\n", "authored_date": "2015-01-10T22:23:29.000+01:00", "author_name": "Sytse Sijbrandij", "author_email": "sytse@gitlab.com", diff --git a/spec/lib/gitlab/metrics/dashboard/finder_spec.rb b/spec/lib/gitlab/metrics/dashboard/finder_spec.rb index ce1bb49f5c9..af5df1fab43 100644 --- a/spec/lib/gitlab/metrics/dashboard/finder_spec.rb +++ b/spec/lib/gitlab/metrics/dashboard/finder_spec.rb @@ -15,7 +15,7 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi describe '.find' do let(:dashboard_path) { '.gitlab/dashboards/test.yml' } - let(:service_call) { described_class.find(project, user, environment, dashboard_path: dashboard_path) } + let(:service_call) { described_class.find(project, user, environment: environment, dashboard_path: dashboard_path) } it_behaves_like 'misconfigured dashboard service response', :not_found @@ -45,19 +45,19 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi end context 'when no dashboard is specified' do - let(:service_call) { described_class.find(project, user, environment) } + let(:service_call) { described_class.find(project, user, environment: environment) } it_behaves_like 'valid dashboard service response' end context 'when the dashboard is expected to be embedded' do - let(:service_call) { described_class.find(project, user, environment, **params) } - let(:params) { { embedded: true } } + let(:service_call) { described_class.find(project, user, **params) } + let(:params) { { environment: environment, embedded: true } } it_behaves_like 'valid embedded dashboard service response' context 'when params are incomplete' do - let(:params) { { embedded: true, dashboard_path: system_dashboard_path } } + let(:params) { { environment: environment, embedded: true, dashboard_path: system_dashboard_path } } it_behaves_like 'valid embedded dashboard service response' end @@ -65,11 +65,14 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi context 'when the panel is specified' do context 'as a custom metric' do let(:params) do - { embedded: true, + { + environment: environment, + embedded: true, dashboard_path: system_dashboard_path, group: business_metric_title, title: 'title', - y_label: 'y_label' } + y_label: 'y_label' + } end it_behaves_like 'misconfigured dashboard service response', :not_found @@ -86,11 +89,14 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi context 'as a project-defined panel' do let(:dashboard_path) { '.gitlab/dashboard/test.yml' } let(:params) do - { embedded: true, + { + environment: environment, + embedded: true, dashboard_path: dashboard_path, group: 'Group A', title: 'Super Chart A1', - y_label: 'y_label' } + y_label: 'y_label' + } end it_behaves_like 'misconfigured dashboard service response', :not_found diff --git a/spec/lib/gitlab/metrics/dashboard/processor_spec.rb b/spec/lib/gitlab/metrics/dashboard/processor_spec.rb index d7891e69dd0..e2ce1869810 100644 --- a/spec/lib/gitlab/metrics/dashboard/processor_spec.rb +++ b/spec/lib/gitlab/metrics/dashboard/processor_spec.rb @@ -8,8 +8,16 @@ describe Gitlab::Metrics::Dashboard::Processor do let(:dashboard_yml) { YAML.load_file('spec/fixtures/lib/gitlab/metrics/dashboard/sample_dashboard.yml') } describe 'process' do - let(:process_params) { [project, environment, dashboard_yml] } - let(:dashboard) { described_class.new(*process_params).process(insert_project_metrics: true) } + let(:sequence) do + [ + Gitlab::Metrics::Dashboard::Stages::CommonMetricsInserter, + Gitlab::Metrics::Dashboard::Stages::ProjectMetricsInserter, + Gitlab::Metrics::Dashboard::Stages::EndpointInserter, + Gitlab::Metrics::Dashboard::Stages::Sorter + ] + end + let(:process_params) { [project, dashboard_yml, sequence, { environment: environment }] } + let(:dashboard) { described_class.new(*process_params).process } it 'includes a path for the prometheus endpoint with each metric' do expect(all_metrics).to satisfy_all do |metric| @@ -54,7 +62,14 @@ describe Gitlab::Metrics::Dashboard::Processor do end context 'when the dashboard should not include project metrics' do - let(:dashboard) { described_class.new(*process_params).process(insert_project_metrics: false) } + let(:sequence) do + [ + Gitlab::Metrics::Dashboard::Stages::CommonMetricsInserter, + Gitlab::Metrics::Dashboard::Stages::EndpointInserter, + Gitlab::Metrics::Dashboard::Stages::Sorter + ] + end + let(:dashboard) { described_class.new(*process_params).process } it 'includes only dashboard metrics' do metrics = all_metrics.map { |m| m[:id] } @@ -67,7 +82,7 @@ describe Gitlab::Metrics::Dashboard::Processor do shared_examples_for 'errors with message' do |expected_message| it 'raises a DashboardLayoutError' do - error_class = Gitlab::Metrics::Dashboard::Stages::BaseStage::DashboardProcessingError + error_class = Gitlab::Metrics::Dashboard::Errors::DashboardProcessingError expect { dashboard }.to raise_error(error_class, expected_message) end diff --git a/spec/lib/gitlab/sentry_spec.rb b/spec/lib/gitlab/sentry_spec.rb index 9c4f3b8f42e..024ac733a07 100644 --- a/spec/lib/gitlab/sentry_spec.rb +++ b/spec/lib/gitlab/sentry_spec.rb @@ -38,7 +38,7 @@ describe Gitlab::Sentry do it 'logs the exception with all attributes passed' do expected_extras = { some_other_info: 'info', - issue_url: 'http://gitlab.com/gitlab-org/gitlab-ce/issues/1' + issue_url: 'http://gitlab.com/gitlab-org/gitlab-foss/issues/1' } expected_tags = { @@ -52,7 +52,7 @@ describe Gitlab::Sentry do described_class.track_exception( exception, - issue_url: 'http://gitlab.com/gitlab-org/gitlab-ce/issues/1', + issue_url: 'http://gitlab.com/gitlab-org/gitlab-foss/issues/1', extra: { some_other_info: 'info' } ) end @@ -67,7 +67,7 @@ describe Gitlab::Sentry do context '.track_acceptable_exception' do let(:exception) { RuntimeError.new('boom') } - let(:issue_url) { 'http://gitlab.com/gitlab-org/gitlab-ce/issues/1' } + let(:issue_url) { 'http://gitlab.com/gitlab-org/gitlab-foss/issues/1' } before do allow(described_class).to receive(:enabled?).and_return(true) diff --git a/spec/lib/gitlab/shell_spec.rb b/spec/lib/gitlab/shell_spec.rb index fe4853fd819..55d8bac6c03 100644 --- a/spec/lib/gitlab/shell_spec.rb +++ b/spec/lib/gitlab/shell_spec.rb @@ -370,7 +370,7 @@ describe Gitlab::Shell do end describe '#import_repository' do - let(:import_url) { 'https://gitlab.com/gitlab-org/gitlab-ce.git' } + let(:import_url) { 'https://gitlab.com/gitlab-org/gitlab-foss.git' } context 'with gitaly' do it 'returns true when the command succeeds' do diff --git a/spec/lib/gitlab/submodule_links_spec.rb b/spec/lib/gitlab/submodule_links_spec.rb index a84602cd07d..d4420c5b513 100644 --- a/spec/lib/gitlab/submodule_links_spec.rb +++ b/spec/lib/gitlab/submodule_links_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Gitlab::SubmoduleLinks do - let(:submodule_item) { double(id: 'hash', path: 'gitlab-ce') } + let(:submodule_item) { double(id: 'hash', path: 'gitlab-foss') } let(:repo) { double } let(:links) { described_class.new(repo) } @@ -32,11 +32,11 @@ describe Gitlab::SubmoduleLinks do context 'when the submodule is known' do before do - stub_urls({ 'gitlab-ce' => 'git@gitlab.com:gitlab-org/gitlab-ce.git' }) + stub_urls({ 'gitlab-foss' => 'git@gitlab.com:gitlab-org/gitlab-foss.git' }) end it 'returns links' do - expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash']) + expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash']) end end end diff --git a/spec/lib/gitlab/tracking_spec.rb b/spec/lib/gitlab/tracking_spec.rb index f14e74427e1..3cce82e522b 100644 --- a/spec/lib/gitlab/tracking_spec.rb +++ b/spec/lib/gitlab/tracking_spec.rb @@ -20,8 +20,8 @@ describe Gitlab::Tracking do hostname: 'gitfoo.com', cookieDomain: '.gitfoo.com', appId: '_abc123_', - pageTrackingEnabled: true, - activityTrackingEnabled: true + formTracking: true, + linkClickTracking: true ) end @@ -33,8 +33,8 @@ describe Gitlab::Tracking do ).and_return(false) expect(subject.snowplow_options('_group_')).to include( - pageTrackingEnabled: false, - activityTrackingEnabled: false + formTracking: false, + linkClickTracking: false ) end end |