summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Skarbek <jskarbek@gitlab.com>2019-12-10 21:23:10 +0000
committerJohn Skarbek <jskarbek@gitlab.com>2019-12-10 21:23:10 +0000
commitc6d2d169257ba68cbac86d369285390010359a42 (patch)
tree40c5b4e221c3465f28edf2dce6403004660586fe
parent41948c2cf0234bca5b16d5e613f718a9217bd4bb (diff)
parent8a53d47d53a6a8dbf23818a5dbc698a2931dfea1 (diff)
downloadgitlab-ce-c6d2d169257ba68cbac86d369285390010359a42.tar.gz
Merge branch '12-1-stable-backport-reliable-fetcher' into '12-1-stable'
Backport reliable fetcher to 12.1 See merge request gitlab/gitlabhq!3584
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock4
-rw-r--r--spec/controllers/projects/tags_controller_spec.rb2
-rw-r--r--spec/controllers/projects_controller_spec.rb8
-rw-r--r--spec/features/groups/settings/group_badges_spec.rb5
-rw-r--r--spec/features/projects/settings/project_badges_spec.rb4
-rw-r--r--spec/features/projects/tags/user_edits_tags_spec.rb12
-rw-r--r--spec/features/tags/developer_deletes_tag_spec.rb8
-rw-r--r--spec/features/tags/developer_updates_tag_spec.rb4
-rw-r--r--spec/finders/tags_finder_spec.rb27
-rw-r--r--spec/models/repository_spec.rb8
-rw-r--r--spec/requests/api/tags_spec.rb9
12 files changed, 47 insertions, 46 deletions
diff --git a/Gemfile b/Gemfile
index 8bffc2a973d..2dab86842b4 100644
--- a/Gemfile
+++ b/Gemfile
@@ -169,7 +169,7 @@ gem 'acts-as-taggable-on', '~> 6.0'
gem 'sidekiq', '~> 5.2.7'
gem 'sidekiq-cron', '~> 1.0'
gem 'redis-namespace', '~> 1.6.0'
-gem 'gitlab-sidekiq-fetcher', '~> 0.4.0', require: 'sidekiq-reliable-fetch'
+gem 'gitlab-sidekiq-fetcher', '0.5.2', require: 'sidekiq-reliable-fetch'
# Cron Parser
gem 'fugit', '~> 1.2.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index 60939ae918c..9a9f2cfbb44 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -320,7 +320,7 @@ GEM
jaeger-client (~> 0.10)
opentracing (~> 0.4)
gitlab-markup (1.7.0)
- gitlab-sidekiq-fetcher (0.4.0)
+ gitlab-sidekiq-fetcher (0.5.2)
sidekiq (~> 5)
gitlab-styles (2.7.0)
rubocop (~> 0.69.0)
@@ -1123,7 +1123,7 @@ DEPENDENCIES
github-markup (~> 1.7.0)
gitlab-labkit (~> 0.3.0)
gitlab-markup (~> 1.7.0)
- gitlab-sidekiq-fetcher (~> 0.4.0)
+ gitlab-sidekiq-fetcher (= 0.5.2)
gitlab-styles (~> 2.7)
gitlab_omniauth-ldap (~> 2.1.1)
gon (~> 6.2)
diff --git a/spec/controllers/projects/tags_controller_spec.rb b/spec/controllers/projects/tags_controller_spec.rb
index b99b5d611fc..8348b4f4369 100644
--- a/spec/controllers/projects/tags_controller_spec.rb
+++ b/spec/controllers/projects/tags_controller_spec.rb
@@ -13,7 +13,7 @@ describe Projects::TagsController do
end
it 'returns the tags for the page' do
- expect(assigns(:tags).map(&:name)).to eq(['v1.1.0', 'v1.0.0'])
+ expect(assigns(:tags).map(&:name)).to include('v1.1.0', 'v1.0.0')
end
it 'returns releases matching those tags' do
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index 083a1c1383a..64c152aa880 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -740,10 +740,10 @@ describe ProjectsController do
it 'gets a list of branches and tags' do
get :refs, params: { namespace_id: project.namespace, id: project, sort: 'updated_desc' }
- expect(json_response['Branches']).to include('master')
- expect(json_response['Tags'].first).to eq('v1.1.0')
- expect(json_response['Tags'].last).to eq('v1.0.0')
- expect(json_response['Commits']).to be_nil
+ parsed_body = JSON.parse(response.body)
+ expect(parsed_body['Branches']).to include('master')
+ expect(json_response['Tags']).to include('v1.0.0')
+ expect(parsed_body['Commits']).to be_nil
end
it "gets a list of branches, tags and commits" do
diff --git a/spec/features/groups/settings/group_badges_spec.rb b/spec/features/groups/settings/group_badges_spec.rb
index a5c8dbf18d0..994573e0a93 100644
--- a/spec/features/groups/settings/group_badges_spec.rb
+++ b/spec/features/groups/settings/group_badges_spec.rb
@@ -5,8 +5,9 @@ describe 'Group Badges' do
let(:user) { create(:user) }
let(:group) { create(:group) }
- let(:badge_link_url) { 'https://gitlab.com/gitlab-org/gitlab-ee/commits/master'}
- let(:badge_image_url) { 'https://gitlab.com/gitlab-org/gitlab-ee/badges/master/build.svg'}
+ let(:project) { create(:project, namespace: group) }
+ let(:badge_link_url) { "http://#{page.server.host}:#{page.server.port}/#{project.full_path}/commits/master" }
+ let(:badge_image_url) { "http://#{page.server.host}:#{page.server.port}/#{project.full_path}/badges/master/pipeline.svg" }
let!(:badge_1) { create(:group_badge, group: group) }
let!(:badge_2) { create(:group_badge, group: group) }
diff --git a/spec/features/projects/settings/project_badges_spec.rb b/spec/features/projects/settings/project_badges_spec.rb
index 42b5547d43b..af4615b8b87 100644
--- a/spec/features/projects/settings/project_badges_spec.rb
+++ b/spec/features/projects/settings/project_badges_spec.rb
@@ -6,8 +6,8 @@ describe 'Project Badges' do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) }
- let(:badge_link_url) { 'https://gitlab.com/gitlab-org/gitlab-ee/commits/master'}
- let(:badge_image_url) { 'https://gitlab.com/gitlab-org/gitlab-ee/badges/master/build.svg'}
+ let(:badge_link_url) { "http://#{page.server.host}:#{page.server.port}/#{project.full_path}/commits/master" }
+ let(:badge_image_url) { "http://#{page.server.host}:#{page.server.port}/#{project.full_path}/badges/master/pipeline.svg" }
let!(:project_badge) { create(:project_badge, project: project) }
let!(:group_badge) { create(:group_badge, group: group) }
diff --git a/spec/features/projects/tags/user_edits_tags_spec.rb b/spec/features/projects/tags/user_edits_tags_spec.rb
index ebb2844d17f..7a0945d7393 100644
--- a/spec/features/projects/tags/user_edits_tags_spec.rb
+++ b/spec/features/projects/tags/user_edits_tags_spec.rb
@@ -21,23 +21,21 @@ describe 'Project > Tags', :js do
context 'page with tags list' do
it 'shows tag name' do
- page.within first('.tags > .content-list > li') do
- expect(page.find('.row-main-content')).to have_content 'v1.1.0 Version 1.1.0'
- end
+ expect(page).to have_content 'v1.1.0 Version 1.1.0'
end
it 'shows tag edit button' do
- page.within first('.tags > .content-list > li') do
- edit_btn = page.find('.row-fixed-content.controls a.btn-edit')
+ page.within '.tags > .content-list' do
+ edit_btn = page.find("li > .row-fixed-content.controls a.btn-edit[href='/#{project.full_path}/-/tags/v1.1.0/release/edit']")
- expect(edit_btn['href']).to have_content '/tags/v1.1.0/release/edit'
+ expect(edit_btn['href']).to end_with("/#{project.full_path}/-/tags/v1.1.0/release/edit")
end
end
end
context 'edit tag release notes' do
before do
- find('.tags > .content-list > li:first-child .row-fixed-content.controls a.btn-edit').click
+ page.find("li > .row-fixed-content.controls a.btn-edit[href='/#{project.full_path}/-/tags/v1.1.0/release/edit']").click
end
it 'shows tag name header' do
diff --git a/spec/features/tags/developer_deletes_tag_spec.rb b/spec/features/tags/developer_deletes_tag_spec.rb
index dc4c7a4fb0a..a146483d137 100644
--- a/spec/features/tags/developer_deletes_tag_spec.rb
+++ b/spec/features/tags/developer_deletes_tag_spec.rb
@@ -15,7 +15,7 @@ describe 'Developer deletes tag' do
it 'deletes the tag' do
expect(page).to have_content 'v1.1.0'
- delete_first_tag
+ delete_tag 'v1.1.0'
expect(page).not_to have_content 'v1.1.0'
end
@@ -42,15 +42,15 @@ describe 'Developer deletes tag' do
end
it 'shows the error message' do
- delete_first_tag
+ delete_tag 'v1.1.0'
expect(page).to have_content('Do not delete tags')
end
end
- def delete_first_tag
+ def delete_tag(tag)
page.within('.content') do
- accept_confirm { first('.btn-remove').click }
+ accept_confirm { find("li > .row-fixed-content.controls a.btn-remove[href='/#{project.full_path}/-/tags/#{tag}']").click }
end
end
end
diff --git a/spec/features/tags/developer_updates_tag_spec.rb b/spec/features/tags/developer_updates_tag_spec.rb
index 1e11fc9e5d5..c927cd28cdf 100644
--- a/spec/features/tags/developer_updates_tag_spec.rb
+++ b/spec/features/tags/developer_updates_tag_spec.rb
@@ -13,9 +13,7 @@ describe 'Developer updates tag' do
context 'from the tags list page' do
it 'updates the release notes' do
- page.within(first('.content-list .controls')) do
- click_link 'Edit release notes'
- end
+ find("li > .row-fixed-content.controls a.btn-edit[href='/#{project.full_path}/-/tags/v1.1.0/release/edit']").click
fill_in 'release_description', with: 'Awesome release notes'
click_button 'Save changes'
diff --git a/spec/finders/tags_finder_spec.rb b/spec/finders/tags_finder_spec.rb
index 460e278e2d3..cf9600bb413 100644
--- a/spec/finders/tags_finder_spec.rb
+++ b/spec/finders/tags_finder_spec.rb
@@ -55,24 +55,25 @@ describe TagsFinder do
end
context 'filter and sort' do
- it 'filters tags by name and sorts by recently_updated' do
- params = { sort: 'updated_desc', search: 'v1' }
- tags_finder = described_class.new(repository, params)
+ let(:tags_to_compare) { %w[v1.0.0 v1.1.0] }
+ subject { described_class.new(repository, params).execute.select { |tag| tags_to_compare.include?(tag.name) } }
- result = tags_finder.execute
+ context 'when sort by updated_desc' do
+ let(:params) { { sort: 'updated_desc', search: 'v1' } }
- expect(result.first.name).to eq('v1.1.0')
- expect(result.count).to eq(2)
+ it 'filters tags by name' do
+ expect(subject.first.name).to eq('v1.1.0')
+ expect(subject.count).to eq(2)
+ end
end
- it 'filters tags by name and sorts by last_updated' do
- params = { sort: 'updated_asc', search: 'v1' }
- tags_finder = described_class.new(repository, params)
-
- result = tags_finder.execute
+ context 'when sort by updated_asc' do
+ let(:params) { { sort: 'updated_asc', search: 'v1' } }
- expect(result.first.name).to eq('v1.0.0')
- expect(result.count).to eq(2)
+ it 'filters tags by name' do
+ expect(subject.first.name).to eq('v1.0.0')
+ expect(subject.count).to eq(2)
+ end
end
end
end
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 12dff440ce2..89691a02f49 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -66,14 +66,16 @@ describe Repository do
end
describe 'tags_sorted_by' do
+ let(:tags_to_compare) { %w[v1.0.0 v1.1.0] }
+
context 'name_desc' do
- subject { repository.tags_sorted_by('name_desc').map(&:name) }
+ subject { repository.tags_sorted_by('name_desc').map(&:name) & tags_to_compare }
it { is_expected.to eq(['v1.1.0', 'v1.0.0']) }
end
context 'name_asc' do
- subject { repository.tags_sorted_by('name_asc').map(&:name) }
+ subject { repository.tags_sorted_by('name_asc').map(&:name) & tags_to_compare }
it { is_expected.to eq(['v1.0.0', 'v1.1.0']) }
end
@@ -115,7 +117,7 @@ describe Repository do
context 'annotated tag pointing to a blob' do
let(:annotated_tag_name) { 'annotated-tag' }
- subject { repository.tags_sorted_by('updated_asc').map(&:name) }
+ subject { repository.tags_sorted_by('updated_asc').map(&:name) & (tags_to_compare + [annotated_tag_name]) }
before do
options = { message: 'test tag message\n',
diff --git a/spec/requests/api/tags_spec.rb b/spec/requests/api/tags_spec.rb
index c4f4a2cb889..e69150ad077 100644
--- a/spec/requests/api/tags_spec.rb
+++ b/spec/requests/api/tags_spec.rb
@@ -5,6 +5,7 @@ describe API::Tags do
let(:guest) { create(:user).tap { |u| project.add_guest(u) } }
let(:project) { create(:project, :repository, creator: user, path: 'my.project') }
let(:tag_name) { project.repository.find_tag('v1.1.0').name }
+ let(:tag_message) { project.repository.find_tag('v1.1.0').message }
let(:project_id) { project.id }
let(:current_user) { nil }
@@ -73,7 +74,7 @@ describe API::Tags do
expect(response).to have_gitlab_http_status(200)
expect(response).to match_response_schema('public_api/v4/tags')
expect(response).to include_pagination_headers
- expect(json_response.first['name']).to eq(tag_name)
+ expect(json_response.map { |r| r['name'] }).to include(tag_name)
end
context 'when repository is disabled' do
@@ -133,9 +134,9 @@ describe API::Tags do
expect(response).to have_gitlab_http_status(200)
expect(response).to match_response_schema('public_api/v4/tags')
expect(response).to include_pagination_headers
- expect(json_response.first['name']).to eq(tag_name)
- expect(json_response.first['message']).to eq('Version 1.1.0')
- expect(json_response.first['release']['description']).to eq(description)
+ expected_tag = json_response.find { |r| r['name'] == tag_name }
+ expect(expected_tag['message']).to eq(tag_message)
+ expect(expected_tag['release']['description']).to eq(description)
end
end
end