diff options
28 files changed, 177 insertions, 66 deletions
diff --git a/.gitlab/issue_templates/Bug.md b/.gitlab/issue_templates/Bug.md index 9d53a48409a..aec734870d6 100644 --- a/.gitlab/issue_templates/Bug.md +++ b/.gitlab/issue_templates/Bug.md @@ -1,11 +1,18 @@ Please read this! Before opening a new issue, make sure to search for keywords in the issues -filtered by the "regression" or "bug" label: +filtered by the "regression" or "bug" label. + +For the Community Edition issue tracker: - https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name%5B%5D=bug +For the Enterprise Edition issue tracker: + +- https://gitlab.com/gitlab-org/gitlab-ee/issues?label_name%5B%5D=regression +- https://gitlab.com/gitlab-org/gitlab-ee/issues?label_name%5B%5D=bug + and verify the issue you're about to submit isn't a duplicate. Please remove this notice if you're confident your issue isn't a duplicate. diff --git a/.gitlab/issue_templates/Feature Proposal.md b/.gitlab/issue_templates/Feature Proposal.md index d96c9ad59e0..85ca1bca623 100644 --- a/.gitlab/issue_templates/Feature Proposal.md +++ b/.gitlab/issue_templates/Feature Proposal.md @@ -3,8 +3,14 @@ Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "feature proposal" label: +For the Community Edition issue tracker: + - https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name%5B%5D=feature+proposal +For the Enterprise Edition issue tracker: + +- https://gitlab.com/gitlab-org/gitlab-ee/issues?label_name%5B%5D=feature+proposal + and verify the issue you're about to submit isn't a duplicate. Please remove this notice if you're confident your issue isn't a duplicate. diff --git a/app/assets/javascripts/issuable_bulk_update_sidebar.js b/app/assets/javascripts/issuable_bulk_update_sidebar.js index 84bd2e092e6..a8856120c5e 100644 --- a/app/assets/javascripts/issuable_bulk_update_sidebar.js +++ b/app/assets/javascripts/issuable_bulk_update_sidebar.js @@ -22,6 +22,7 @@ export default class IssuableBulkUpdateSidebar { initDomElements() { this.$page = $('.page-with-sidebar'); this.$sidebar = $('.right-sidebar'); + this.$sidebarInnerContainer = this.$sidebar.find('.issuable-sidebar'); this.$bulkEditCancelBtn = $('.js-bulk-update-menu-hide'); this.$bulkEditSubmitBtn = $('.update-selected-issues'); this.$bulkUpdateEnableBtn = $('.js-bulk-update-toggle'); @@ -113,6 +114,7 @@ export default class IssuableBulkUpdateSidebar { toggleSidebarDisplay(show) { this.$page.toggleClass(SIDEBAR_EXPANDED_CLASS, show); this.$page.toggleClass(SIDEBAR_COLLAPSED_CLASS, !show); + this.$sidebarInnerContainer.toggleClass(HIDDEN_CLASS, !show); this.$sidebar.toggleClass(SIDEBAR_EXPANDED_CLASS, show); this.$sidebar.toggleClass(SIDEBAR_COLLAPSED_CLASS, !show); } diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js index b71c3097706..da7c0c5a36c 100644 --- a/app/assets/javascripts/right_sidebar.js +++ b/app/assets/javascripts/right_sidebar.js @@ -7,6 +7,13 @@ import Cookies from 'js-cookie'; function Sidebar(currentUser) { this.toggleTodo = this.toggleTodo.bind(this); this.sidebar = $('aside'); + + this.$sidebarInner = this.sidebar.find('.issuable-sidebar'); + this.$navGitlab = $('.navbar-gitlab'); + this.$layoutNav = $('.layout-nav'); + this.$subScroll = $('.sub-nav-scroll'); + this.$rightSidebar = $('.js-right-sidebar'); + this.removeListeners(); this.addEventListeners(); } @@ -21,14 +28,15 @@ import Cookies from 'js-cookie'; Sidebar.prototype.addEventListeners = function() { const $document = $(document); - const throttledSetSidebarHeight = _.throttle(this.setSidebarHeight, 10); + const throttledSetSidebarHeight = _.throttle(this.setSidebarHeight.bind(this), 20); + const debouncedSetSidebarHeight = _.debounce(this.setSidebarHeight.bind(this), 200); this.sidebar.on('click', '.sidebar-collapsed-icon', this, this.sidebarCollapseClicked); $('.dropdown').on('hidden.gl.dropdown', this, this.onSidebarDropdownHidden); $('.dropdown').on('loading.gl.dropdown', this.sidebarDropdownLoading); $('.dropdown').on('loaded.gl.dropdown', this.sidebarDropdownLoaded); $(window).on('resize', () => throttledSetSidebarHeight()); - $document.on('scroll', () => throttledSetSidebarHeight()); + $document.on('scroll', () => debouncedSetSidebarHeight()); $document.on('click', '.js-sidebar-toggle', function(e, triggered) { var $allGutterToggleIcons, $this, $thisIcon; e.preventDefault(); @@ -207,13 +215,14 @@ import Cookies from 'js-cookie'; }; Sidebar.prototype.setSidebarHeight = function() { - const $navHeight = $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight() + $('.sub-nav-scroll').outerHeight(); - const $rightSidebar = $('.js-right-sidebar'); + const $navHeight = this.$navGitlab.outerHeight() + this.$layoutNav.outerHeight() + (this.$subScroll ? this.$subScroll.outerHeight() : 0); const diff = $navHeight - $(window).scrollTop(); if (diff > 0) { - $rightSidebar.outerHeight($(window).height() - diff); + this.$rightSidebar.outerHeight($(window).height() - diff); + this.$sidebarInner.height('100%'); } else { - $rightSidebar.outerHeight('100%'); + this.$rightSidebar.outerHeight('100%'); + this.$sidebarInner.height(''); } }; diff --git a/app/assets/javascripts/settings_panels.js b/app/assets/javascripts/settings_panels.js index e67f449e1a2..59ff2a86293 100644 --- a/app/assets/javascripts/settings_panels.js +++ b/app/assets/javascripts/settings_panels.js @@ -1,11 +1,28 @@ +function expandSectionParent($section, $content) { + $section.addClass('expanded'); + $content.off('animationend.expandSectionParent'); +} + function expandSection($section) { $section.find('.js-settings-toggle').text('Close'); - $section.find('.settings-content').addClass('expanded').off('scroll').scrollTop(0); + + const $content = $section.find('.settings-content'); + $content.addClass('expanded').off('scroll.expandSection').scrollTop(0); + + if ($content.hasClass('no-animate')) { + expandSectionParent($section, $content); + } else { + $content.on('animationend.expandSectionParent', () => expandSectionParent($section, $content)); + } } function closeSection($section) { $section.find('.js-settings-toggle').text('Expand'); - $section.find('.settings-content').removeClass('expanded').on('scroll', () => expandSection($section)); + + const $content = $section.find('.settings-content'); + $content.removeClass('expanded').on('scroll.expandSection', () => expandSection($section)); + + $section.removeClass('expanded'); } function toggleSection($section) { @@ -21,7 +38,7 @@ function toggleSection($section) { export default function initSettingsPanels() { $('.settings').each((i, elm) => { const $section = $(elm); - $section.on('click', '.js-settings-toggle', () => toggleSection($section)); - $section.find('.settings-content:not(.expanded)').on('scroll', () => expandSection($section)); + $section.on('click.toggleSection', '.js-settings-toggle', () => toggleSection($section)); + $section.find('.settings-content:not(.expanded)').on('scroll.expandSection', () => expandSection($section)); }); } diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss index d4421e3af74..5cf9330b8f8 100644 --- a/app/assets/stylesheets/framework/sidebar.scss +++ b/app/assets/stylesheets/framework/sidebar.scss @@ -97,17 +97,19 @@ .issues-bulk-update.right-sidebar { @include maintain-sidebar-dimensions; - transition: right $sidebar-transition-duration; - right: -$gutter-width; + width: 0; + padding: 0; + transition: width $sidebar-transition-duration; &.right-sidebar-expanded { @include maintain-sidebar-dimensions; - right: 0; + width: $gutter-width; } &.right-sidebar-collapsed { @include maintain-sidebar-dimensions; - right: -$gutter-width; + width: 0; + padding: 0; .block { padding: 16px 0; @@ -118,5 +120,6 @@ .issuable-sidebar { padding: 0 3px; + width: calc(100% + 35px); } } diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss index 4abad3f2697..20f2eec9af5 100644 --- a/app/assets/stylesheets/pages/issuable.scss +++ b/app/assets/stylesheets/pages/issuable.scss @@ -204,7 +204,7 @@ .issuable-sidebar { width: calc(100% + 100px); - height: 100%; + height: calc(100% - #{$header-height}); overflow-y: scroll; overflow-x: hidden; -webkit-overflow-scrolling: touch; diff --git a/app/assets/stylesheets/pages/settings.scss b/app/assets/stylesheets/pages/settings.scss index 33b3c083fd2..7697a1b1c58 100644 --- a/app/assets/stylesheets/pages/settings.scss +++ b/app/assets/stylesheets/pages/settings.scss @@ -29,6 +29,10 @@ &:first-of-type { margin-top: 10px; } + + &.expanded { + overflow: visible; + } } .settings-header { diff --git a/app/views/shared/issuable/_bulk_update_sidebar.html.haml b/app/views/shared/issuable/_bulk_update_sidebar.html.haml index a8a6d84128d..7cfdfb6e6ee 100644 --- a/app/views/shared/issuable/_bulk_update_sidebar.html.haml +++ b/app/views/shared/issuable/_bulk_update_sidebar.html.haml @@ -1,7 +1,7 @@ - type = local_assigns.fetch(:type) %aside.issues-bulk-update.js-right-sidebar.right-sidebar.affix-top{ data: { "offset-top" => "50", "spy" => "affix" }, "aria-live" => "polite" } - .issuable-sidebar + .issuable-sidebar.hidden = form_tag [:bulk_update, @project.namespace.becomes(Namespace), @project, type], method: :post, class: "bulk-update" do .block .filter-item.inline.update-issues-btn.pull-left diff --git a/changelogs/unreleased/dt-printing-to-api.yml b/changelogs/unreleased/dt-printing-to-api.yml new file mode 100644 index 00000000000..5253b57f21a --- /dev/null +++ b/changelogs/unreleased/dt-printing-to-api.yml @@ -0,0 +1,4 @@ +--- +title: Added printing_merge_requst_link_enabled to the API +merge_request: +author: David Turner <dturner@twosigma.com> diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 0b33783869b..43a8c0078ca 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -454,6 +454,10 @@ production: &base # introduced in 9.0). Eventually Gitaly use will become mandatory and # this option will disappear. enabled: true + # Default Gitaly authentication token. Can be overriden per storage. Can + # be left blank when Gitaly is running locally on a Unix socket, which + # is the normal way to deploy Gitaly. + token: # # 4. Advanced settings @@ -469,6 +473,7 @@ production: &base default: path: /home/git/repositories/ gitaly_address: unix:/home/git/gitlab/tmp/sockets/private/gitaly.socket # TCP connections are supported too (e.g. tcp://host:port) + # gitaly_token: 'special token' # Optional: override global gitaly.token for this storage. ## Backup settings backup: @@ -594,6 +599,7 @@ test: gitaly_address: unix:tmp/tests/gitaly/gitaly.socket gitaly: enabled: true + token: secret backup: path: tmp/tests/backups gitlab_shell: diff --git a/doc/api/projects.md b/doc/api/projects.md index 58f18105e21..cc1bb3911c8 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -261,6 +261,7 @@ Parameters: ], "only_allow_merge_if_pipeline_succeeds": false, "only_allow_merge_if_all_discussions_are_resolved": false, + "printing_merge_requests_link_enabled": true, "request_access_enabled": false, "statistics": { "commit_count": 37, @@ -344,6 +345,7 @@ Parameters: | `request_access_enabled` | boolean | no | Allow users to request member access | | `tag_list` | array | no | The list of tags for a project; put array of tags, that should be finally assigned to a project | | `avatar` | mixed | no | Image file for avatar of the project | +| `printing_merge_request_link_enabled` | boolean | no | Show link to create/view merge request when pushing from the command line | ### Create project for user @@ -379,6 +381,7 @@ Parameters: | `request_access_enabled` | boolean | no | Allow users to request member access | | `tag_list` | array | no | The list of tags for a project; put array of tags, that should be finally assigned to a project | | `avatar` | mixed | no | Image file for avatar of the project | +| `printing_merge_request_link_enabled` | boolean | no | Show link to create/view merge request when pushing from the command line | ### Edit project diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 8bce79529e6..675bc52a983 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -118,6 +118,7 @@ module API expose :only_allow_merge_if_pipeline_succeeds expose :request_access_enabled expose :only_allow_merge_if_all_discussions_are_resolved + expose :printing_merge_request_link_enabled expose :statistics, using: 'API::Entities::ProjectStatistics', if: :statistics end diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 50d34e8a738..c5df45b7902 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -23,6 +23,7 @@ module API optional :only_allow_merge_if_all_discussions_are_resolved, type: Boolean, desc: 'Only allow to merge if all discussions are resolved' optional :tag_list, type: Array[String], desc: 'The list of tags for a project' optional :avatar, type: File, desc: 'Avatar image for project' + optional :printing_merge_request_link_enabled, type: Boolean, desc: 'Show link to create/view merge request when pushing from the command line' end params :optional_params do @@ -218,6 +219,7 @@ module API :only_allow_merge_if_all_discussions_are_resolved, :only_allow_merge_if_pipeline_succeeds, :path, + :printing_merge_request_link_enabled, :public_builds, :request_access_enabled, :shared_runners_enabled, diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb index 284e6ad55a5..818b3d9c46b 100644 --- a/lib/gitlab/current_settings.rb +++ b/lib/gitlab/current_settings.rb @@ -10,7 +10,7 @@ module Gitlab delegate :sidekiq_throttling_enabled?, to: :current_application_settings - def fake_application_settings(defaults = ApplicationSetting.defaults) + def fake_application_settings(defaults = ::ApplicationSetting.defaults) FakeApplicationSettings.new(defaults) end @@ -24,7 +24,7 @@ module Gitlab def cached_application_settings begin - ApplicationSetting.cached + ::ApplicationSetting.cached rescue ::Redis::BaseError, ::Errno::ENOENT # In case Redis isn't running or the Redis UNIX socket file is not available end @@ -35,7 +35,7 @@ module Gitlab # This loads from the database into the cache, so handle Redis errors begin - db_settings = ApplicationSetting.current + db_settings = ::ApplicationSetting.current rescue ::Redis::BaseError, ::Errno::ENOENT # In case Redis isn't running or the Redis UNIX socket file is not available end @@ -45,14 +45,14 @@ module Gitlab # and other callers from failing, use any loaded settings and return # defaults for missing columns. if ActiveRecord::Migrator.needs_migration? - defaults = ApplicationSetting.defaults + defaults = ::ApplicationSetting.defaults defaults.merge!(db_settings.attributes.symbolize_keys) if db_settings.present? return fake_application_settings(defaults) end return db_settings if db_settings.present? - ApplicationSetting.create_from_defaults || in_memory_application_settings + ::ApplicationSetting.create_from_defaults || in_memory_application_settings end def in_memory_application_settings diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb index bb04731f08c..d5d149f1423 100644 --- a/lib/gitlab/git/commit.rb +++ b/lib/gitlab/git/commit.rb @@ -4,7 +4,7 @@ module Gitlab class Commit include Gitlab::EncodingHelper - attr_accessor :raw_commit, :head, :refs + attr_accessor :raw_commit, :head SERIALIZE_KEYS = [ :id, :message, :parent_ids, diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb index 2343446bf22..f605c06dfc3 100644 --- a/lib/gitlab/gitaly_client.rb +++ b/lib/gitlab/gitaly_client.rb @@ -1,3 +1,5 @@ +require 'base64' + require 'gitaly' module Gitlab @@ -48,6 +50,26 @@ module Gitlab address end + # All Gitaly RPC call sites should use GitalyClient.call. This method + # makes sure that per-request authentication headers are set. + def self.call(storage, service, rpc, request) + metadata = request_metadata(storage) + metadata = yield(metadata) if block_given? + stub(service, storage).send(rpc, request, metadata) + end + + def self.request_metadata(storage) + encoded_token = Base64.strict_encode64(token(storage).to_s) + { metadata: { 'authorization' => "Bearer #{encoded_token}" } } + end + + def self.token(storage) + params = Gitlab.config.repositories.storages[storage] + raise "storage not found: #{storage.inspect}" if params.nil? + + params['gitaly_token'].presence || Gitlab.config.gitaly['token'] + end + def self.enabled? Gitlab.config.gitaly.enabled end diff --git a/lib/gitlab/gitaly_client/commit.rb b/lib/gitlab/gitaly_client/commit.rb index ba3da781dad..73c1848c95f 100644 --- a/lib/gitlab/gitaly_client/commit.rb +++ b/lib/gitlab/gitaly_client/commit.rb @@ -11,28 +11,26 @@ module Gitlab end def is_ancestor(ancestor_id, child_id) - stub = GitalyClient.stub(:commit, @repository.storage) request = Gitaly::CommitIsAncestorRequest.new( repository: @gitaly_repo, ancestor_id: ancestor_id, child_id: child_id ) - stub.commit_is_ancestor(request).value + GitalyClient.call(@repository.storage, :commit, :commit_is_ancestor, request).value end def diff_from_parent(commit, options = {}) request_params = commit_diff_request_params(commit, options) request_params[:ignore_whitespace_change] = options.fetch(:ignore_whitespace_change, false) - - response = diff_service_stub.commit_diff(Gitaly::CommitDiffRequest.new(request_params)) + request = Gitaly::CommitDiffRequest.new(request_params) + response = GitalyClient.call(@repository.storage, :diff, :commit_diff, request) Gitlab::Git::DiffCollection.new(GitalyClient::DiffStitcher.new(response), options) end def commit_deltas(commit) - request_params = commit_diff_request_params(commit) - - response = diff_service_stub.commit_delta(Gitaly::CommitDeltaRequest.new(request_params)) + request = Gitaly::CommitDeltaRequest.new(commit_diff_request_params(commit)) + response = GitalyClient.call(@repository.storage, :diff, :commit_delta, request) response.flat_map do |msg| msg.deltas.map { |d| Gitlab::Git::Diff.new(d) } end @@ -50,10 +48,6 @@ module Gitlab paths: options.fetch(:paths, []) } end - - def diff_service_stub - GitalyClient.stub(:diff, @repository.storage) - end end end end diff --git a/lib/gitlab/gitaly_client/notifications.rb b/lib/gitlab/gitaly_client/notifications.rb index 719554eac52..78ed433e6b8 100644 --- a/lib/gitlab/gitaly_client/notifications.rb +++ b/lib/gitlab/gitaly_client/notifications.rb @@ -1,17 +1,19 @@ module Gitlab module GitalyClient class Notifications - attr_accessor :stub - # 'repository' is a Gitlab::Git::Repository def initialize(repository) @gitaly_repo = repository.gitaly_repository - @stub = GitalyClient.stub(:notifications, repository.storage) + @storage = repository.storage end def post_receive - request = Gitaly::PostReceiveRequest.new(repository: @gitaly_repo) - @stub.post_receive(request) + GitalyClient.call( + @storage, + :notifications, + :post_receive, + Gitaly::PostReceiveRequest.new(repository: @gitaly_repo) + ) end end end diff --git a/lib/gitlab/gitaly_client/ref.rb b/lib/gitlab/gitaly_client/ref.rb index 227fe45642e..6d5f54dd959 100644 --- a/lib/gitlab/gitaly_client/ref.rb +++ b/lib/gitlab/gitaly_client/ref.rb @@ -1,29 +1,28 @@ module Gitlab module GitalyClient class Ref - attr_accessor :stub - # 'repository' is a Gitlab::Git::Repository def initialize(repository) @gitaly_repo = repository.gitaly_repository - @stub = GitalyClient.stub(:ref, repository.storage) + @storage = repository.storage end def default_branch_name request = Gitaly::FindDefaultBranchNameRequest.new(repository: @gitaly_repo) - branch_name = stub.find_default_branch_name(request).name - - Gitlab::Git.branch_name(branch_name) + response = GitalyClient.call(@storage, :ref, :find_default_branch_name, request) + Gitlab::Git.branch_name(response.name) end def branch_names request = Gitaly::FindAllBranchNamesRequest.new(repository: @gitaly_repo) - consume_refs_response(stub.find_all_branch_names(request), prefix: 'refs/heads/') + response = GitalyClient.call(@storage, :ref, :find_all_branch_names, request) + consume_refs_response(response, prefix: 'refs/heads/') end def tag_names request = Gitaly::FindAllTagNamesRequest.new(repository: @gitaly_repo) - consume_refs_response(stub.find_all_tag_names(request), prefix: 'refs/tags/') + response = GitalyClient.call(@storage, :ref, :find_all_tag_names, request) + consume_refs_response(response, prefix: 'refs/tags/') end def find_ref_name(commit_id, ref_prefix) @@ -32,8 +31,7 @@ module Gitlab commit_id: commit_id, prefix: ref_prefix ) - - stub.find_ref_name(request).name + GitalyClient.call(@storage, :ref, :find_ref_name, request).name end def count_tag_names @@ -47,7 +45,8 @@ module Gitlab def local_branches(sort_by: nil) request = Gitaly::FindLocalBranchesRequest.new(repository: @gitaly_repo) request.sort_by = sort_by_param(sort_by) if sort_by - consume_branches_response(stub.find_local_branches(request)) + response = GitalyClient.call(@storage, :ref, :find_local_branches, request) + consume_branches_response(response) end private diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb index 7f27317775c..f96ee69096d 100644 --- a/lib/gitlab/workhorse.rb +++ b/lib/gitlab/workhorse.rb @@ -26,7 +26,10 @@ module Gitlab } if Gitlab.config.gitaly.enabled - address = Gitlab::GitalyClient.address(project.repository_storage) + server = { + address: Gitlab::GitalyClient.address(project.repository_storage), + token: Gitlab::GitalyClient.token(project.repository_storage) + } params[:Repository] = repository.gitaly_repository.to_h feature_enabled = case action.to_s @@ -39,8 +42,10 @@ module Gitlab else raise "Unsupported action: #{action}" end - - params[:GitalyAddress] = address if feature_enabled + if feature_enabled + params[:GitalyAddress] = server[:address] # This field will be deprecated + params[:GitalyServer] = server + end end params diff --git a/lib/tasks/gitlab/gitaly.rake b/lib/tasks/gitlab/gitaly.rake index e88111c3725..a8db5701d0b 100644 --- a/lib/tasks/gitlab/gitaly.rake +++ b/lib/tasks/gitlab/gitaly.rake @@ -58,8 +58,9 @@ namespace :gitlab do storages << { name: key, path: val['path'] } end - - TOML.dump(socket_path: address.sub(%r{\Aunix:}, ''), storage: storages) + config = { socket_path: address.sub(%r{\Aunix:}, ''), storage: storages } + config[:auth] = { token: 'secret' } if Rails.env.test? + TOML.dump(config) end def create_gitaly_configuration diff --git a/spec/features/issues/bulk_assignment_labels_spec.rb b/spec/features/issues/bulk_assignment_labels_spec.rb index 2eb04df3cb3..a99c19cb787 100644 --- a/spec/features/issues/bulk_assignment_labels_spec.rb +++ b/spec/features/issues/bulk_assignment_labels_spec.rb @@ -16,6 +16,21 @@ feature 'Issues > Labels bulk assignment', feature: true do gitlab_sign_in user end + context 'sidebar' do + before do + enable_bulk_update + end + + it 'is present when bulk edit is enabled' do + expect(page).to have_css('.issuable-sidebar') + end + + it 'is not present when bulk edit is disabled' do + disable_bulk_update + expect(page).not_to have_css('.issuable-sidebar') + end + end + context 'can bulk assign' do before do enable_bulk_update @@ -398,4 +413,8 @@ feature 'Issues > Labels bulk assignment', feature: true do visit namespace_project_issues_path(project.namespace, project) click_button 'Edit Issues' end + + def disable_bulk_update + click_button 'Cancel' + end end diff --git a/spec/lib/gitlab/gitaly_client/commit_spec.rb b/spec/lib/gitlab/gitaly_client/commit_spec.rb index cf1bc74779e..dff5b25c712 100644 --- a/spec/lib/gitlab/gitaly_client/commit_spec.rb +++ b/spec/lib/gitlab/gitaly_client/commit_spec.rb @@ -16,7 +16,7 @@ describe Gitlab::GitalyClient::Commit do right_commit_id: commit.id ) - expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_diff).with(request) + expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_diff).with(request, kind_of(Hash)) described_class.new(repository).diff_from_parent(commit) end @@ -31,7 +31,7 @@ describe Gitlab::GitalyClient::Commit do right_commit_id: initial_commit.id ) - expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_diff).with(request) + expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_diff).with(request, kind_of(Hash)) described_class.new(repository).diff_from_parent(initial_commit) end @@ -61,7 +61,7 @@ describe Gitlab::GitalyClient::Commit do right_commit_id: commit.id ) - expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_delta).with(request).and_return([]) + expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_delta).with(request, kind_of(Hash)).and_return([]) described_class.new(repository).commit_deltas(commit) end @@ -76,7 +76,7 @@ describe Gitlab::GitalyClient::Commit do right_commit_id: initial_commit.id ) - expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_delta).with(request).and_return([]) + expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_delta).with(request, kind_of(Hash)).and_return([]) described_class.new(repository).commit_deltas(initial_commit) end diff --git a/spec/lib/gitlab/gitaly_client/notifications_spec.rb b/spec/lib/gitlab/gitaly_client/notifications_spec.rb index e5c9e06a15e..c2b8ca9f501 100644 --- a/spec/lib/gitlab/gitaly_client/notifications_spec.rb +++ b/spec/lib/gitlab/gitaly_client/notifications_spec.rb @@ -9,7 +9,7 @@ describe Gitlab::GitalyClient::Notifications do it 'sends a post_receive message' do expect_any_instance_of(Gitaly::Notifications::Stub). - to receive(:post_receive).with(gitaly_request_with_path(storage_name, relative_path)) + to receive(:post_receive).with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) subject.post_receive end diff --git a/spec/lib/gitlab/gitaly_client/ref_spec.rb b/spec/lib/gitlab/gitaly_client/ref_spec.rb index 2ea44ef74b0..3272333bb33 100644 --- a/spec/lib/gitlab/gitaly_client/ref_spec.rb +++ b/spec/lib/gitlab/gitaly_client/ref_spec.rb @@ -21,7 +21,7 @@ describe Gitlab::GitalyClient::Ref do it 'sends a find_all_branch_names message' do expect_any_instance_of(Gitaly::Ref::Stub). to receive(:find_all_branch_names). - with(gitaly_request_with_path(storage_name, relative_path)). + with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)). and_return([]) client.branch_names @@ -32,7 +32,7 @@ describe Gitlab::GitalyClient::Ref do it 'sends a find_all_tag_names message' do expect_any_instance_of(Gitaly::Ref::Stub). to receive(:find_all_tag_names). - with(gitaly_request_with_path(storage_name, relative_path)). + with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)). and_return([]) client.tag_names @@ -43,7 +43,7 @@ describe Gitlab::GitalyClient::Ref do it 'sends a find_default_branch_name message' do expect_any_instance_of(Gitaly::Ref::Stub). to receive(:find_default_branch_name). - with(gitaly_request_with_path(storage_name, relative_path)). + with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)). and_return(double(name: 'foo')) client.default_branch_name @@ -54,7 +54,7 @@ describe Gitlab::GitalyClient::Ref do it 'sends a find_local_branches message' do expect_any_instance_of(Gitaly::Ref::Stub). to receive(:find_local_branches). - with(gitaly_request_with_path(storage_name, relative_path)). + with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)). and_return([]) client.local_branches @@ -63,7 +63,7 @@ describe Gitlab::GitalyClient::Ref do it 'parses and sends the sort parameter' do expect_any_instance_of(Gitaly::Ref::Stub). to receive(:find_local_branches). - with(gitaly_request_with_params(sort_by: :UPDATED_DESC)). + with(gitaly_request_with_params(sort_by: :UPDATED_DESC), kind_of(Hash)). and_return([]) client.local_branches(sort_by: 'updated_desc') diff --git a/spec/lib/gitlab/workhorse_spec.rb b/spec/lib/gitlab/workhorse_spec.rb index ad19998dff4..a3e8166cb70 100644 --- a/spec/lib/gitlab/workhorse_spec.rb +++ b/spec/lib/gitlab/workhorse_spec.rb @@ -202,7 +202,11 @@ describe Gitlab::Workhorse, lib: true do context 'when Gitaly is enabled' do let(:gitaly_params) do { - GitalyAddress: Gitlab::GitalyClient.address('default') + GitalyAddress: Gitlab::GitalyClient.address('default'), + GitalyServer: { + address: Gitlab::GitalyClient.address('default'), + token: Gitlab::GitalyClient.token('default') + } } end diff --git a/spec/tasks/gitlab/gitaly_rake_spec.rb b/spec/tasks/gitlab/gitaly_rake_spec.rb index cfa6c9ca8ce..c9a0f1cb144 100644 --- a/spec/tasks/gitlab/gitaly_rake_spec.rb +++ b/spec/tasks/gitlab/gitaly_rake_spec.rb @@ -89,6 +89,7 @@ describe 'gitlab:gitaly namespace rake task' do } } allow(Gitlab.config.repositories).to receive(:storages).and_return(config) + allow(Rails.env).to receive(:test?).and_return(false) expected_output = '' Timecop.freeze do |