Commit 0d1661c2 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents e377ac7a 5c9acb69
.detail-page-description .detail-page-description
%h2.title %h2.title.qa-title
= markdown_field(@merge_request, :title) = markdown_field(@merge_request, :title)
%div %div
- if @merge_request.description.present? - if @merge_request.description.present?
.description{ class: can?(current_user, :update_merge_request, @merge_request) ? 'js-task-list-container' : '' } .description.qa-description{ class: can?(current_user, :update_merge_request, @merge_request) ? 'js-task-list-container' : '' }
.md .md
= markdown_field(@merge_request, :description) = markdown_field(@merge_request, :description)
%textarea.hidden.js-task-list-field %textarea.hidden.js-task-list-field
......
...@@ -2620,6 +2620,24 @@ test: ...@@ -2620,6 +2620,24 @@ test:
- pwd - pwd
``` ```
### Nested paths
The value of `GIT_CLONE_PATH` is expanded once and nesting variables
within it is not supported.
For example, you define both the variables below in your
`.gitlab-ci.yml` file:
```yml
variables:
GOPATH: $CI_BUILDS_DIR/go
GIT_CLONE_PATH: $GOPATH/src/namespace/project
```
The value of `GIT_CLONE_PATH` is expanded once into
`$CI_BUILDS_DIR/go/src/namespace/project`, and results in failure
because `$CI_BUILDS_DIR` is not expanded.
## Special YAML features ## Special YAML features
It's possible to use special YAML features like anchors (`&`), aliases (`*`) It's possible to use special YAML features like anchors (`&`), aliases (`*`)
......
...@@ -112,6 +112,14 @@ module QA ...@@ -112,6 +112,14 @@ module QA
end end
end end
def has_title?(title)
has_element?(:title, text: title)
end
def has_description?(description)
has_element?(:description, text: description)
end
def merge! def merge!
# The merge button is disabled on load # The merge button is disabled on load
wait do wait do
......
...@@ -46,7 +46,7 @@ module QA ...@@ -46,7 +46,7 @@ module QA
end end
def api_post_path def api_post_path
"/projects/#{project}/labels" "/projects/#{project.id}/labels"
end end
def api_post_body def api_post_body
......
...@@ -31,6 +31,21 @@ module QA ...@@ -31,6 +31,21 @@ module QA
milestone_new.click_milestone_create_button milestone_new.click_milestone_create_button
end end
end end
def api_get_path
"/projects/#{project.id}/milestones/#{id}"
end
def api_post_path
"/projects/#{project.id}/milestones"
end
def api_post_body
{
description: @description,
title: @title
}
end
end end
end end
end end
...@@ -12,13 +12,26 @@ module QA ...@@ -12,13 +12,26 @@ module QA
# The environment variables used to indicate if the environment under test # The environment variables used to indicate if the environment under test
# supports the given feature # supports the given feature
SUPPORTED_FEATURES = { SUPPORTED_FEATURES = {
git_protocol_v2: 'QA_CAN_TEST_GIT_PROTOCOL_V2' git_protocol_v2: 'QA_CAN_TEST_GIT_PROTOCOL_V2',
admin: 'QA_CAN_TEST_ADMIN_FEATURES'
}.freeze }.freeze
def supported_features def supported_features
SUPPORTED_FEATURES SUPPORTED_FEATURES
end end
def admin_password
ENV['GITLAB_ADMIN_PASSWORD']
end
def admin_username
ENV['GITLAB_ADMIN_USERNAME']
end
def admin_personal_access_token
ENV['GITLAB_QA_ADMIN_ACCESS_TOKEN']
end
def debug? def debug?
enabled?(ENV['QA_DEBUG'], default: false) enabled?(ENV['QA_DEBUG'], default: false)
end end
...@@ -94,14 +107,6 @@ module QA ...@@ -94,14 +107,6 @@ module QA
ENV['GITLAB_PASSWORD'] ENV['GITLAB_PASSWORD']
end end
def admin_username
ENV['GITLAB_ADMIN_USERNAME']
end
def admin_password
ENV['GITLAB_ADMIN_PASSWORD']
end
def github_username def github_username
ENV['GITHUB_USERNAME'] ENV['GITHUB_USERNAME']
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
# Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/50 context 'Create' do
context 'Create', :quarantine do describe 'Create a new merge request' do
describe 'Merge request creation' do before do
it 'user creates a new merge request', :smoke do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials } Page::Main::Login.perform(&:sign_in_using_credentials)
current_project = Resource::Project.fabricate! do |project| @project = Resource::Project.fabricate_via_api! do |project|
project.name = 'project-with-merge-request' project.name = 'project'
end end
merge_request_title = 'This is a merge request' @merge_request_title = 'One merge request to rule them all'
merge_request_description = 'Great feature' @merge_request_description = '... to find them, to bring them all, and in the darkness bind them'
end
Resource::MergeRequest.fabricate! do |merge_request| it 'creates a basic merge request', :smoke do
merge_request.title = merge_request_title Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request|
merge_request.description = merge_request_description merge_request.project = @project
merge_request.project = current_project merge_request.title = @merge_request_title
merge_request.description = @merge_request_description
end end
expect(page).to have_content(merge_request_title) Page::MergeRequest::Show.perform do |merge_request|
expect(page).to have_content(merge_request_description) expect(merge_request).to have_title(@merge_request_title)
expect(page).to have_content('Opened just now') expect(merge_request).to have_description(@merge_request_description)
end
end end
it 'user creates a new merge request with a milestone and label' do it 'creates a merge request with a milestone and label' do
gitlab_account_username = "@#{Runtime::User.username}" gitlab_account_username = "@#{Runtime::User.username}"
Runtime::Browser.visit(:gitlab, Page::Main::Login) milestone = Resource::ProjectMilestone.fabricate_via_api! do |milestone|
Page::Main::Login.act { sign_in_using_credentials } milestone.project = @project
milestone.title = 'milestone'
current_project = Resource::Project.fabricate! do |project|
project.name = 'project-with-merge-request-and-milestone'
end
current_milestone = Resource::ProjectMilestone.fabricate! do |milestone|
milestone.title = 'unique-milestone'
milestone.project = current_project
end end
new_label = Resource::Label.fabricate_via_browser_ui! do |label| label = Resource::Label.fabricate_via_api! do |label|
label.project = current_project label.project = @project
label.title = 'qa-mr-test-label' label.title = 'label'
label.description = 'Merge Request label'
end end
merge_request_title = 'This is a merge request with a milestone and a label' Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request|
merge_request_description = 'Great feature with milestone' merge_request.title = @merge_request_title
merge_request.description = @merge_request_description
Resource::MergeRequest.fabricate! do |merge_request| merge_request.project = @project
merge_request.title = merge_request_title merge_request.milestone = milestone
merge_request.description = merge_request_description
merge_request.project = current_project
merge_request.milestone = current_milestone
merge_request.assignee = 'me' merge_request.assignee = 'me'
merge_request.labels.push(new_label) merge_request.labels.push(label)
end end
Page::MergeRequest::Show.perform do |merge_request| Page::MergeRequest::Show.perform do |merge_request|
expect(merge_request).to have_content(merge_request_title) expect(merge_request).to have_title(@merge_request_title)
expect(merge_request).to have_content(merge_request_description) expect(merge_request).to have_description(@merge_request_description)
expect(merge_request).to have_content('Opened just now')
expect(merge_request).to have_assignee(gitlab_account_username) expect(merge_request).to have_assignee(gitlab_account_username)
expect(merge_request).to have_label(new_label.title) expect(merge_request).to have_label(label.title)
end end
Page::Issuable::Sidebar.perform do |sidebar| Page::Issuable::Sidebar.perform do |sidebar|
expect(sidebar).to have_milestone(current_milestone.title) expect(sidebar).to have_milestone(milestone.title)
end end
end end
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
# Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/37 context 'Create', :requires_admin do
context 'Create', :quarantine do
describe 'push after setting the file size limit via admin/application_settings' do describe 'push after setting the file size limit via admin/application_settings' do
before(:all) do before(:context) do
push = Resource::Repository::ProjectPush.fabricate! do |p| @project = Resource::Project.fabricate_via_api! do |p|
p.file_name = 'README.md' p.name = 'project-test-push-limit'
p.file_content = '# This is a test project' p.initialize_with_readme = true
p.commit_message = 'Add README.md'
end end
@project = push.project @api_client = Runtime::API::Client.new(:gitlab, personal_access_token: Runtime::Env.admin_personal_access_token)
end end
before do after(:context) do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
end
after(:all) do
# need to set the default value after test # need to set the default value after test
# default value for file size limit is empty # default value for file size limit is empty
Runtime::Browser.visit(:gitlab, Page::Main::Login) set_file_size_limit(nil)
Page::Main::Login.perform(&:sign_in_using_credentials)
set_file_size_limit('')
Page::Main::Menu.perform(&:sign_out)
end end
it 'push successful when the file size is under the limit' do it 'push successful when the file size is under the limit' do
set_file_size_limit(5) set_file_size_limit(5)
expect(page).to have_content("Application settings saved successfully")
push = push_new_file('oversize_file_1.bin', wait_for_push: true) push = push_new_file('oversize_file_1.bin', wait_for_push: true)
expect(push.output).not_to have_content 'remote: fatal: pack exceeds maximum allowed size' expect(push.output).not_to have_content 'remote: fatal: pack exceeds maximum allowed size'
end end
it 'push fails when the file size is above the limit' do it 'push fails when the file size is above the limit' do
set_file_size_limit(1) set_file_size_limit(1)
expect(page).to have_content("Application settings saved successfully")
expect { push_new_file('oversize_file_2.bin', wait_for_push: false) } expect { push_new_file('oversize_file_2.bin', wait_for_push: false) }
.to raise_error(QA::Git::Repository::RepositoryCommandError, /remote: fatal: pack exceeds maximum allowed size/) .to raise_error(QA::Git::Repository::RepositoryCommandError, /remote: fatal: pack exceeds maximum allowed size/)
end end
def set_file_size_limit(limit) def set_file_size_limit(limit)
Page::Main::Menu.perform(&:click_admin_area) request = Runtime::API::Request.new(@api_client, '/application/settings')
Page::Admin::Menu.perform(&:go_to_general_settings) put request.url, receive_max_input_size: limit
Page::Admin::Settings::General.perform do |setting| expect_status(200)
setting.expand_account_and_limit do |page| expect(json_body).to match(
page.set_max_file_size(limit) a_hash_including(receive_max_input_size: limit)
page.save_settings )
end
end
end end
def push_new_file(file_name, wait_for_push: true) def push_new_file(file_name, wait_for_push: true)
@project.visit! commit_message = 'Adding a new file'
output = Resource::Repository::Push.fabricate! do |p|
Resource::Repository::ProjectPush.fabricate! do |p| p.repository_http_uri = @project.repository_http_location.uri
p.project = @project
p.file_name = file_name p.file_name = file_name
p.file_content = SecureRandom.random_bytes(2000000) p.file_content = SecureRandom.random_bytes(2000000)
p.commit_message = 'Adding a new file' p.commit_message = commit_message
p.wait_for_push = wait_for_push
p.new_branch = false p.new_branch = false
end end
@project.wait_for_push commit_message
output
end end
end end
end end
......
...@@ -251,6 +251,12 @@ describe QA::Runtime::Env do ...@@ -251,6 +251,12 @@ describe QA::Runtime::Env do
env_key: 'QA_CAN_TEST_GIT_PROTOCOL_V2', env_key: 'QA_CAN_TEST_GIT_PROTOCOL_V2',
default: true default: true
it_behaves_like 'boolean method with parameter',
method: :can_test?,
param: :admin,
env_key: 'QA_CAN_TEST_ADMIN_FEATURES',
default: true
it 'raises ArgumentError if feature is unknown' do it 'raises ArgumentError if feature is unknown' do
expect { described_class.can_test? :foo }.to raise_error(ArgumentError, 'Unknown feature "foo"') expect { described_class.can_test? :foo }.to raise_error(ArgumentError, 'Unknown feature "foo"')
end end
......
# frozen_string_literal: true # frozen_string_literal: true
require 'active_support/core_ext/hash'
describe QA::Specs::Runner do describe QA::Specs::Runner do
shared_examples 'excludes orchestrated' do
it 'excludes the orchestrated tag and includes default args' do
expect_rspec_runner_arguments(['--tag', '~orchestrated', *described_class::DEFAULT_TEST_PATH_ARGS])
subject.perform
end
end
context '#perform' do context '#perform' do
before do before do
allow(QA::Runtime::Browser).to receive(:configure!) allow(QA::Runtime::Browser).to receive(:configure!)
end end
it 'excludes the orchestrated tag by default' do it_behaves_like 'excludes orchestrated'
expect_rspec_runner_arguments(['--tag', '~orchestrated', *described_class::DEFAULT_TEST_PATH_ARGS])
subject.perform
end
context 'when tty is set' do context 'when tty is set' do
subject { described_class.new.tap { |runner| runner.tty = true } } subject { described_class.new.tap { |runner| runner.tty = true } }
...@@ -67,8 +73,6 @@ describe QA::Specs::Runner do ...@@ -67,8 +73,6 @@ describe QA::Specs::Runner do
allow(QA::Runtime::Env).to receive(:signup_disabled?).and_return(true) allow(QA::Runtime::Env).to receive(:signup_disabled?).and_return(true)
end end
subject { described_class.new }
it 'includes default args and excludes the skip_signup_disabled tag' do it 'includes default args and excludes the skip_signup_disabled tag' do
expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~skip_signup_disabled', *described_class::DEFAULT_TEST_PATH_ARGS]) expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~skip_signup_disabled', *described_class::DEFAULT_TEST_PATH_ARGS])
...@@ -76,18 +80,54 @@ describe QA::Specs::Runner do ...@@ -76,18 +80,54 @@ describe QA::Specs::Runner do
end end
end end
context 'when git protocol v2 is not supported' do context 'testable features' do
before do shared_examples 'one supported feature' do |feature|
allow(QA::Runtime::Env).to receive(:can_test?).with(:git_protocol_v2).and_return(false) before do
QA::Runtime::Env.supported_features.each do |tag, _|
allow(QA::Runtime::Env).to receive(:can_test?).with(tag).and_return(false)
end
allow(QA::Runtime::Env).to receive(:can_test?).with(feature).and_return(true) unless feature.nil?
end
it 'includes default args and excludes all unsupported tags' do
expect_rspec_runner_arguments(['--tag', '~orchestrated', *excluded_feature_tags_except(feature), *described_class::DEFAULT_TEST_PATH_ARGS])
subject.perform
end
end end
subject { described_class.new } context 'when only git protocol 2 is supported' do
it_behaves_like 'one supported feature', :git_protocol_v2
end
it 'includes default args and excludes the requires_git_protocol_v2 tag' do context 'when only admin features are supported' do
expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~requires_git_protocol_v2', *described_class::DEFAULT_TEST_PATH_ARGS]) it_behaves_like 'one supported feature', :admin
end
subject.perform context 'when no features are supported' do
it_behaves_like 'one supported feature', nil
end end
context 'when all features are supported' do
before do
QA::Runtime::Env.supported_features.each do |tag, _|
allow(QA::Runtime::Env).to receive(:can_test?).with(tag).and_return(true)
end
end
it_behaves_like 'excludes orchestrated'
end
context 'when features are not specified' do
it_behaves_like 'excludes orchestrated'
end
end
def excluded_feature_tags_except(tag)
QA::Runtime::Env.supported_features.except(tag).map do |tag, _|
['--tag', "~requires_#{tag}"]
end.flatten
end end
def expect_rspec_runner_arguments(arguments) def expect_rspec_runner_arguments(arguments)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment