diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2018-05-04 12:45:16 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2018-05-07 15:10:04 +0300 |
commit | 92482e01b45c337c0b9d761efd0297fc97ffcac0 (patch) | |
tree | db5b98ede77dd50d0d0a67c49763036bdff5828e /spec | |
parent | 965d0394d371f427ad0423bda2a6dc8867b31563 (diff) |
Bump Gitaly to 0.98.0
Hooks were run for wikis, but given the internal API wasn't responding
failures happended, as seen on:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18693
Diffstat (limited to 'spec')
24 files changed, 60 insertions, 47 deletions
diff --git a/spec/factories/project_wikis.rb b/spec/factories/project_wikis.rb index db2eb4fc863..4d21ed47f39 100644 --- a/spec/factories/project_wikis.rb +++ b/spec/factories/project_wikis.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :project_wiki do skip_create - project + association :project, :wiki_repo user { project.creator } initialize_with { new(project, user) } end diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index a6128903546..9ab57af1c60 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -193,6 +193,13 @@ FactoryBot.define do trait :wiki_repo do after(:create) do |project| raise 'Failed to create wiki repository!' unless project.create_wiki + + # We delete hooks so that gitlab-shell will not try to authenticate with + # an API that isn't running + project.gitlab_shell.rm_directory( + project.repository_storage, + File.join("#{project.wiki.repository.disk_path}.git", "hooks") + ) end end diff --git a/spec/features/projects/wiki/markdown_preview_spec.rb b/spec/features/projects/wiki/markdown_preview_spec.rb index 006c15d60c5..6586ccaa400 100644 --- a/spec/features/projects/wiki/markdown_preview_spec.rb +++ b/spec/features/projects/wiki/markdown_preview_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' feature 'Projects > Wiki > User previews markdown changes', :js do let(:user) { create(:user) } - let(:project) { create(:project, namespace: user.namespace) } + let(:project) { create(:project, :wiki_repo, namespace: user.namespace) } let(:wiki_content) do <<-HEREDOC [regular link](regular) diff --git a/spec/features/projects/wiki/shortcuts_spec.rb b/spec/features/projects/wiki/shortcuts_spec.rb index f70d1e710dd..6178361082e 100644 --- a/spec/features/projects/wiki/shortcuts_spec.rb +++ b/spec/features/projects/wiki/shortcuts_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' feature 'Wiki shortcuts', :js do let(:user) { create(:user) } - let(:project) { create(:project, namespace: user.namespace) } + let(:project) { create(:project, :wiki_repo, namespace: user.namespace) } let(:wiki_page) { create(:wiki_page, wiki: project.wiki, attrs: { title: 'home', content: 'Home page' }) } before do diff --git a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb index fe6fa55fa75..9989e1ffda7 100644 --- a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb @@ -12,7 +12,7 @@ describe "User creates wiki page" do context "when wiki is empty" do context "in a user namespace" do - let(:project) { create(:project, namespace: user.namespace) } + let(:project) { create(:project, :wiki_repo, namespace: user.namespace) } it "shows validation error message" do page.within(".wiki-form") do @@ -142,7 +142,7 @@ describe "User creates wiki page" do end context "in a group namespace", :js do - let(:project) { create(:project, namespace: create(:group, :public)) } + let(:project) { create(:project, :wiki_repo, namespace: create(:group, :public)) } it "has `Create home` as a commit message" do expect(page).to have_field("wiki[message]", with: "Create home") @@ -164,11 +164,11 @@ describe "User creates wiki page" do context "when wiki is not empty", :js do before do - create(:wiki_page, wiki: create(:project, namespace: user.namespace).wiki, attrs: { title: "home", content: "Home page" }) + create(:wiki_page, wiki: create(:project, :wiki_repo, namespace: user.namespace).wiki, attrs: { title: "home", content: "Home page" }) end context "in a user namespace" do - let(:project) { create(:project, namespace: user.namespace) } + let(:project) { create(:project, :wiki_repo, namespace: user.namespace) } context "via the `new wiki page` page" do it "creates a page with a single word" do @@ -261,7 +261,7 @@ describe "User creates wiki page" do end context "in a group namespace" do - let(:project) { create(:project, namespace: create(:group, :public)) } + let(:project) { create(:project, :wiki_repo, namespace: create(:group, :public)) } context "via the `new wiki page` page" do it "creates a page" do diff --git a/spec/features/projects/wiki/user_deletes_wiki_page_spec.rb b/spec/features/projects/wiki/user_deletes_wiki_page_spec.rb index 605e332196b..ab9420fc38f 100644 --- a/spec/features/projects/wiki/user_deletes_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_deletes_wiki_page_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' feature 'User deletes wiki page' do let(:user) { create(:user) } - let(:project) { create(:project, namespace: user.namespace) } + let(:project) { create(:project, :wiki_repo, namespace: user.namespace) } let(:wiki_page) { create(:wiki_page, wiki: project.wiki) } before do diff --git a/spec/features/projects/wiki/user_git_access_wiki_page_spec.rb b/spec/features/projects/wiki/user_git_access_wiki_page_spec.rb index 37a118c34ab..823399ac3c3 100644 --- a/spec/features/projects/wiki/user_git_access_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_git_access_wiki_page_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'Projects > Wiki > User views Git access wiki page' do let(:user) { create(:user) } - let(:project) { create(:project, :public) } + let(:project) { create(:project, :wiki_repo, :public) } let(:wiki_page) { create(:wiki_page, wiki: project.wiki, attrs: { title: 'home', content: '[some link](other-page)' }) } before do diff --git a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb index ef1bb712846..e019e3ce5a5 100644 --- a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb @@ -14,7 +14,7 @@ describe 'User updates wiki page' do end context 'in a user namespace' do - let(:project) { create(:project, namespace: user.namespace) } + let(:project) { create(:project, :wiki_repo, namespace: user.namespace) } it 'redirects back to the home edit page' do page.within(:css, '.wiki-form .form-actions') do @@ -66,7 +66,7 @@ describe 'User updates wiki page' do end context 'in a user namespace' do - let(:project) { create(:project, namespace: user.namespace) } + let(:project) { create(:project, :wiki_repo, namespace: user.namespace) } it 'updates a page' do click_link('Edit') @@ -134,7 +134,7 @@ describe 'User updates wiki page' do end context 'in a group namespace' do - let(:project) { create(:project, namespace: create(:group, :public)) } + let(:project) { create(:project, :wiki_repo, namespace: create(:group, :public)) } it 'updates a page' do click_link('Edit') @@ -154,7 +154,7 @@ describe 'User updates wiki page' do end context 'when the page is in a subdir' do - let!(:project) { create(:project, namespace: user.namespace) } + let!(:project) { create(:project, :wiki_repo, namespace: user.namespace) } let(:project_wiki) { create(:project_wiki, project: project, user: project.creator) } let(:page_name) { 'page_name' } let(:page_dir) { "foo/bar/#{page_name}" } diff --git a/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb b/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb index 2682b62fa04..92b50169476 100644 --- a/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb +++ b/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb @@ -11,6 +11,7 @@ describe 'Projects > Wiki > User views wiki in project page' do context 'when repository is disabled for project' do let(:project) do create(:project, + :wiki_repo, :repository_disabled, :merge_requests_disabled, :builds_disabled) diff --git a/spec/features/projects/wiki/user_views_wiki_page_spec.rb b/spec/features/projects/wiki/user_views_wiki_page_spec.rb index 306e382119a..6661714222a 100644 --- a/spec/features/projects/wiki/user_views_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_views_wiki_page_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'User views a wiki page' do shared_examples 'wiki page user view' do let(:user) { create(:user) } - let(:project) { create(:project, namespace: user.namespace) } + let(:project) { create(:project, :wiki_repo, namespace: user.namespace) } let(:wiki_page) do create(:wiki_page, wiki: project.wiki, diff --git a/spec/features/search/user_searches_for_wiki_pages_spec.rb b/spec/features/search/user_searches_for_wiki_pages_spec.rb index 7934779058f..5098fb49ee1 100644 --- a/spec/features/search/user_searches_for_wiki_pages_spec.rb +++ b/spec/features/search/user_searches_for_wiki_pages_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'User searches for wiki pages', :js do let(:user) { create(:user) } - let(:project) { create(:project, namespace: user.namespace) } + let(:project) { create(:project, :wiki_repo, namespace: user.namespace) } let!(:wiki_page) { create(:wiki_page, wiki: project.wiki, attrs: { title: 'test_wiki', content: 'Some Wiki content' }) } before do diff --git a/spec/lib/backup/repository_spec.rb b/spec/lib/backup/repository_spec.rb index b3777be312b..b1ea9c0b622 100644 --- a/spec/lib/backup/repository_spec.rb +++ b/spec/lib/backup/repository_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Backup::Repository do let(:progress) { StringIO.new } - let!(:project) { create(:project) } + let!(:project) { create(:project, :wiki_repo) } before do allow(progress).to receive(:puts) @@ -102,7 +102,7 @@ describe Backup::Repository do it 'invalidates the emptiness cache' do expect(wiki.repository).to receive(:expire_emptiness_caches).once - wiki.empty? + described_class.new.send(:empty_repo?, wiki) end context 'wiki repo has content' do diff --git a/spec/lib/gitlab/data_builder/wiki_page_spec.rb b/spec/lib/gitlab/data_builder/wiki_page_spec.rb index a776d888c47..9c8bdf4b032 100644 --- a/spec/lib/gitlab/data_builder/wiki_page_spec.rb +++ b/spec/lib/gitlab/data_builder/wiki_page_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Gitlab::DataBuilder::WikiPage do - let(:project) { create(:project, :repository) } + set(:project) { create(:project, :repository, :wiki_repo) } let(:wiki_page) { create(:wiki_page, wiki: project.wiki) } let(:user) { create(:user) } diff --git a/spec/lib/gitlab/import_export/wiki_repo_saver_spec.rb b/spec/lib/gitlab/import_export/wiki_repo_saver_spec.rb index d2bd8ccdf3f..24bc231d5a0 100644 --- a/spec/lib/gitlab/import_export/wiki_repo_saver_spec.rb +++ b/spec/lib/gitlab/import_export/wiki_repo_saver_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Gitlab::ImportExport::WikiRepoSaver do describe 'bundle a wiki Git repo' do let(:user) { create(:user) } - let!(:project) { create(:project, :public, name: 'searchable_project') } + let!(:project) { create(:project, :public, :wiki_repo, name: 'searchable_project') } let(:export_path) { "#{Dir.tmpdir}/project_tree_saver_spec" } let(:shared) { project.import_export_shared } let(:wiki_bundler) { described_class.new(project: project, shared: shared) } diff --git a/spec/lib/gitlab/project_search_results_spec.rb b/spec/lib/gitlab/project_search_results_spec.rb index 8351b967133..a34b7d9905a 100644 --- a/spec/lib/gitlab/project_search_results_spec.rb +++ b/spec/lib/gitlab/project_search_results_spec.rb @@ -175,14 +175,14 @@ describe Gitlab::ProjectSearchResults do end describe 'wiki search' do - let(:project) { create(:project, :public) } + let(:project) { create(:project, :public, :wiki_repo) } let(:wiki) { build(:project_wiki, project: project) } let!(:wiki_page) { wiki.create_page('Title', 'Content') } subject(:results) { described_class.new(user, project, 'Content').objects('wiki_blobs') } context 'when wiki is disabled' do - let(:project) { create(:project, :public, :wiki_disabled) } + let(:project) { create(:project, :public, :wiki_repo, :wiki_disabled) } it 'hides wiki blobs from members' do project.add_reporter(user) @@ -196,7 +196,7 @@ describe Gitlab::ProjectSearchResults do end context 'when wiki is internal' do - let(:project) { create(:project, :public, :wiki_private) } + let(:project) { create(:project, :public, :wiki_repo, :wiki_private) } it 'finds wiki blobs for guest' do project.add_guest(user) diff --git a/spec/models/blob_viewer/readme_spec.rb b/spec/models/blob_viewer/readme_spec.rb index b9946c0315a..8d11d58cfca 100644 --- a/spec/models/blob_viewer/readme_spec.rb +++ b/spec/models/blob_viewer/readme_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe BlobViewer::Readme do include FakeBlobHelpers - let(:project) { create(:project, :repository) } + let(:project) { create(:project, :repository, :wiki_repo) } let(:blob) { fake_blob(path: 'README.md') } subject { described_class.new(blob) } diff --git a/spec/models/project_services/microsoft_teams_service_spec.rb b/spec/models/project_services/microsoft_teams_service_spec.rb index 733086e258f..8d9ee96227f 100644 --- a/spec/models/project_services/microsoft_teams_service_spec.rb +++ b/spec/models/project_services/microsoft_teams_service_spec.rb @@ -30,7 +30,7 @@ describe MicrosoftTeamsService do describe "#execute" do let(:user) { create(:user) } - let(:project) { create(:project, :repository) } + set(:project) { create(:project, :repository, :wiki_repo) } before do allow(chat_service).to receive_messages( diff --git a/spec/models/project_wiki_spec.rb b/spec/models/project_wiki_spec.rb index cbe7d111fcd..d6c4031329d 100644 --- a/spec/models/project_wiki_spec.rb +++ b/spec/models/project_wiki_spec.rb @@ -1,7 +1,7 @@ require "spec_helper" describe ProjectWiki do - let(:project) { create(:project) } + let(:project) { create(:project, :wiki_repo) } let(:repository) { project.repository } let(:user) { project.owner } let(:gitlab_shell) { Gitlab::Shell.new } @@ -328,6 +328,8 @@ describe ProjectWiki do end describe '#create_repo!' do + let(:project) { create(:project) } + it 'creates a repository' do expect(raw_repository.exists?).to eq(false) expect(subject.repository).to receive(:after_create) @@ -339,6 +341,8 @@ describe ProjectWiki do end describe '#ensure_repository' do + let(:project) { create(:project) } + it 'creates the repository if it not exist' do expect(raw_repository.exists?).to eq(false) diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb index 90b7e7715a8..1c765ceac2f 100644 --- a/spec/models/wiki_page_spec.rb +++ b/spec/models/wiki_page_spec.rb @@ -1,7 +1,7 @@ require "spec_helper" describe WikiPage do - let(:project) { create(:project) } + let(:project) { create(:project, :wiki_repo) } let(:user) { project.owner } let(:wiki) { ProjectWiki.new(project, user) } diff --git a/spec/requests/api/search_spec.rb b/spec/requests/api/search_spec.rb index f8d5258a8d9..aca4aa40027 100644 --- a/spec/requests/api/search_spec.rb +++ b/spec/requests/api/search_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe API::Search do set(:user) { create(:user) } set(:group) { create(:group) } - set(:project) { create(:project, :public, name: 'awesome project', group: group) } + set(:project) { create(:project, :wiki_repo, :public, name: 'awesome project', group: group) } set(:repo_project) { create(:project, :public, :repository, group: group) } shared_examples 'response is correct' do |schema:, size: 1| diff --git a/spec/requests/api/wikis_spec.rb b/spec/requests/api/wikis_spec.rb index fb0806ff9f1..850ba696098 100644 --- a/spec/requests/api/wikis_spec.rb +++ b/spec/requests/api/wikis_spec.rb @@ -143,7 +143,7 @@ describe API::Wikis do let(:url) { "/projects/#{project.id}/wikis" } context 'when wiki is disabled' do - let(:project) { create(:project, :wiki_disabled) } + let(:project) { create(:project, :wiki_repo, :wiki_disabled) } context 'when user is guest' do before do @@ -175,7 +175,7 @@ describe API::Wikis do end context 'when wiki is available only for team members' do - let(:project) { create(:project, :wiki_private) } + let(:project) { create(:project, :wiki_repo, :wiki_private) } context 'when user is guest' do before do @@ -203,7 +203,7 @@ describe API::Wikis do end context 'when wiki is available for everyone with access' do - let(:project) { create(:project) } + let(:project) { create(:project, :wiki_repo) } context 'when user is guest' do before do @@ -236,7 +236,7 @@ describe API::Wikis do let(:url) { "/projects/#{project.id}/wikis/#{page.slug}" } context 'when wiki is disabled' do - let(:project) { create(:project, :wiki_disabled) } + let(:project) { create(:project, :wiki_repo, :wiki_disabled) } context 'when user is guest' do before do @@ -268,7 +268,7 @@ describe API::Wikis do end context 'when wiki is available only for team members' do - let(:project) { create(:project, :wiki_private) } + let(:project) { create(:project, :wiki_repo, :wiki_private) } context 'when user is guest' do before do @@ -311,7 +311,7 @@ describe API::Wikis do end context 'when wiki is available for everyone with access' do - let(:project) { create(:project) } + let(:project) { create(:project, :wiki_repo) } context 'when user is guest' do before do @@ -360,7 +360,7 @@ describe API::Wikis do let(:url) { "/projects/#{project.id}/wikis" } context 'when wiki is disabled' do - let(:project) { create(:project, :wiki_disabled) } + let(:project) { create(:project, :wiki_disabled, :wiki_repo) } context 'when user is guest' do before do @@ -390,7 +390,7 @@ describe API::Wikis do end context 'when wiki is available only for team members' do - let(:project) { create(:project, :wiki_private) } + let(:project) { create(:project, :wiki_private, :wiki_repo) } context 'when user is guest' do before do @@ -418,7 +418,7 @@ describe API::Wikis do end context 'when wiki is available for everyone with access' do - let(:project) { create(:project) } + let(:project) { create(:project, :wiki_repo) } context 'when user is guest' do before do @@ -452,7 +452,7 @@ describe API::Wikis do let(:url) { "/projects/#{project.id}/wikis/#{page.slug}" } context 'when wiki is disabled' do - let(:project) { create(:project, :wiki_disabled) } + let(:project) { create(:project, :wiki_disabled, :wiki_repo) } context 'when user is guest' do before do @@ -484,7 +484,7 @@ describe API::Wikis do end context 'when wiki is available only for team members' do - let(:project) { create(:project, :wiki_private) } + let(:project) { create(:project, :wiki_private, :wiki_repo) } context 'when user is guest' do before do @@ -528,7 +528,7 @@ describe API::Wikis do end context 'when wiki is available for everyone with access' do - let(:project) { create(:project) } + let(:project) { create(:project, :wiki_repo) } context 'when user is guest' do before do @@ -572,7 +572,7 @@ describe API::Wikis do end context 'when wiki belongs to a group project' do - let(:project) { create(:project, namespace: group) } + let(:project) { create(:project, :wiki_repo, namespace: group) } before do put(api(url, user), payload) @@ -587,7 +587,7 @@ describe API::Wikis do let(:url) { "/projects/#{project.id}/wikis/#{page.slug}" } context 'when wiki is disabled' do - let(:project) { create(:project, :wiki_disabled) } + let(:project) { create(:project, :wiki_disabled, :wiki_repo) } context 'when user is guest' do before do @@ -619,7 +619,7 @@ describe API::Wikis do end context 'when wiki is available only for team members' do - let(:project) { create(:project, :wiki_private) } + let(:project) { create(:project, :wiki_private, :wiki_repo) } context 'when user is guest' do before do @@ -651,7 +651,7 @@ describe API::Wikis do end context 'when wiki is available for everyone with access' do - let(:project) { create(:project) } + let(:project) { create(:project, :wiki_repo) } context 'when user is guest' do before do @@ -689,7 +689,7 @@ describe API::Wikis do end context 'when wiki belongs to a group project' do - let(:project) { create(:project, namespace: group) } + let(:project) { create(:project, :wiki_repo, namespace: group) } before do delete(api(url, user)) diff --git a/spec/services/test_hooks/project_service_spec.rb b/spec/services/test_hooks/project_service_spec.rb index 28dfa9cf59c..962b9f40c4f 100644 --- a/spec/services/test_hooks/project_service_spec.rb +++ b/spec/services/test_hooks/project_service_spec.rb @@ -170,6 +170,7 @@ describe TestHooks::ProjectService do end context 'wiki_page_events' do + let(:project) { create(:project, :wiki_repo) } let(:trigger) { 'wiki_page_events' } let(:trigger_key) { :wiki_page_hooks } diff --git a/spec/services/wiki_pages/create_service_spec.rb b/spec/services/wiki_pages/create_service_spec.rb index b270194d9b8..259f445247e 100644 --- a/spec/services/wiki_pages/create_service_spec.rb +++ b/spec/services/wiki_pages/create_service_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe WikiPages::CreateService do - let(:project) { create(:project) } + let(:project) { create(:project, :wiki_repo) } let(:user) { create(:user) } let(:opts) do diff --git a/spec/support/shared_examples/slack_mattermost_notifications_shared_examples.rb b/spec/support/shared_examples/slack_mattermost_notifications_shared_examples.rb index 07bc3a51fd8..2228e872926 100644 --- a/spec/support/shared_examples/slack_mattermost_notifications_shared_examples.rb +++ b/spec/support/shared_examples/slack_mattermost_notifications_shared_examples.rb @@ -35,7 +35,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do describe "#execute" do let(:user) { create(:user) } - let(:project) { create(:project, :repository) } + let(:project) { create(:project, :repository, :wiki_repo) } let(:username) { 'slack_username' } let(:channel) { 'slack_channel' } let(:issue_service_options) { { title: 'Awesome issue', description: 'please fix' } } |