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

Automatic merge of gitlab-org/gitlab-ce master

parents e377ac7a 5c9acb69
No related merge requests found
.detail-page-description
%h2.title
%h2.title.qa-title
= markdown_field(@merge_request, :title)
%div
- 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
= markdown_field(@merge_request, :description)
%textarea.hidden.js-task-list-field
......
......@@ -2620,6 +2620,24 @@ test:
- 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
It's possible to use special YAML features like anchors (`&`), aliases (`*`)
......
......@@ -112,6 +112,14 @@ module QA
end
end
def has_title?(title)
has_element?(:title, text: title)
end
def has_description?(description)
has_element?(:description, text: description)
end
def merge!
# The merge button is disabled on load
wait do
......
......@@ -46,7 +46,7 @@ module QA
end
def api_post_path
"/projects/#{project}/labels"
"/projects/#{project.id}/labels"
end
def api_post_body
......
......@@ -31,6 +31,21 @@ module QA
milestone_new.click_milestone_create_button
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
......@@ -12,13 +12,26 @@ module QA
# The environment variables used to indicate if the environment under test
# supports the given feature
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
def supported_features
SUPPORTED_FEATURES
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?
enabled?(ENV['QA_DEBUG'], default: false)
end
......@@ -94,14 +107,6 @@ module QA
ENV['GITLAB_PASSWORD']
end
def admin_username
ENV['GITLAB_ADMIN_USERNAME']
end
def admin_password
ENV['GITLAB_ADMIN_PASSWORD']
end
def github_username
ENV['GITHUB_USERNAME']
end
......
# frozen_string_literal: true
module QA
# Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/50
context 'Create', :quarantine do
describe 'Merge request creation' do
it 'user creates a new merge request', :smoke do
context 'Create' do
describe 'Create a new merge request' do
before do
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.name = 'project-with-merge-request'
@project = Resource::Project.fabricate_via_api! do |project|
project.name = 'project'
end
merge_request_title = 'This is a merge request'
merge_request_description = 'Great feature'
@merge_request_title = 'One merge request to rule them all'
@merge_request_description = '... to find them, to bring them all, and in the darkness bind them'
end
Resource::MergeRequest.fabricate! do |merge_request|
merge_request.title = merge_request_title
merge_request.description = merge_request_description
merge_request.project = current_project
it 'creates a basic merge request', :smoke do
Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request|
merge_request.project = @project
merge_request.title = @merge_request_title
merge_request.description = @merge_request_description
end
expect(page).to have_content(merge_request_title)
expect(page).to have_content(merge_request_description)
expect(page).to have_content('Opened just now')
Page::MergeRequest::Show.perform do |merge_request|
expect(merge_request).to have_title(@merge_request_title)
expect(merge_request).to have_description(@merge_request_description)
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}"
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
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
milestone = Resource::ProjectMilestone.fabricate_via_api! do |milestone|
milestone.project = @project
milestone.title = 'milestone'
end
new_label = Resource::Label.fabricate_via_browser_ui! do |label|
label.project = current_project
label.title = 'qa-mr-test-label'
label.description = 'Merge Request label'
label = Resource::Label.fabricate_via_api! do |label|
label.project = @project
label.title = 'label'
end
merge_request_title = 'This is a merge request with a milestone and a label'
merge_request_description = 'Great feature with milestone'
Resource::MergeRequest.fabricate! do |merge_request|
merge_request.title = merge_request_title
merge_request.description = merge_request_description
merge_request.project = current_project
merge_request.milestone = current_milestone
Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request|
merge_request.title = @merge_request_title
merge_request.description = @merge_request_description
merge_request.project = @project
merge_request.milestone = milestone
merge_request.assignee = 'me'
merge_request.labels.push(new_label)
merge_request.labels.push(label)
end
Page::MergeRequest::Show.perform do |merge_request|
expect(merge_request).to have_content(merge_request_title)
expect(merge_request).to have_content(merge_request_description)
expect(merge_request).to have_content('Opened just now')
expect(merge_request).to have_title(@merge_request_title)
expect(merge_request).to have_description(@merge_request_description)
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
Page::Issuable::Sidebar.perform do |sidebar|
expect(sidebar).to have_milestone(current_milestone.title)
expect(sidebar).to have_milestone(milestone.title)
end
end
end
......
# frozen_string_literal: true
module QA
# Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/37
context 'Create', :quarantine do
context 'Create', :requires_admin do
describe 'push after setting the file size limit via admin/application_settings' do
before(:all) do
push = Resource::Repository::ProjectPush.fabricate! do |p|
p.file_name = 'README.md'
p.file_content = '# This is a test project'
p.commit_message = 'Add README.md'
before(:context) do
@project = Resource::Project.fabricate_via_api! do |p|
p.name = 'project-test-push-limit'
p.initialize_with_readme = true
end
@project = push.project
@api_client = Runtime::API::Client.new(:gitlab, personal_access_token: Runtime::Env.admin_personal_access_token)
end
before do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
end
after(:all) do
after(:context) do
# need to set the default value after test
# default value for file size limit is empty
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
set_file_size_limit('')
Page::Main::Menu.perform(&:sign_out)
set_file_size_limit(nil)
end
it 'push successful when the file size is under the limit' do
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)
expect(push.output).not_to have_content 'remote: fatal: pack exceeds maximum allowed size'
end
it 'push fails when the file size is above the limit' do
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) }
.to raise_error(QA::Git::Repository::RepositoryCommandError, /remote: fatal: pack exceeds maximum allowed size/)
end
def set_file_size_limit(limit)
Page::Main::Menu.perform(&:click_admin_area)
Page::Admin::Menu.perform(&:go_to_general_settings)
request = Runtime::API::Request.new(@api_client, '/application/settings')
put request.url, receive_max_input_size: limit
Page::Admin::Settings::General.perform do |setting|
setting.expand_account_and_limit do |page|
page.set_max_file_size(limit)
page.save_settings
end
end
expect_status(200)
expect(json_body).to match(
a_hash_including(receive_max_input_size: limit)
)
end
def push_new_file(file_name, wait_for_push: true)
@project.visit!
Resource::Repository::ProjectPush.fabricate! do |p|
p.project = @project
commit_message = 'Adding a new file'
output = Resource::Repository::Push.fabricate! do |p|
p.repository_http_uri = @project.repository_http_location.uri
p.file_name = file_name
p.file_content = SecureRandom.random_bytes(2000000)
p.commit_message = 'Adding a new file'
p.wait_for_push = wait_for_push
p.commit_message = commit_message
p.new_branch = false
end
@project.wait_for_push commit_message
output
end
end
end
......
......@@ -251,6 +251,12 @@ describe QA::Runtime::Env do
env_key: 'QA_CAN_TEST_GIT_PROTOCOL_V2',
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
expect { described_class.can_test? :foo }.to raise_error(ArgumentError, 'Unknown feature "foo"')
end
......
# frozen_string_literal: true
require 'active_support/core_ext/hash'
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
before do
allow(QA::Runtime::Browser).to receive(:configure!)
end
it 'excludes the orchestrated tag by default' do
expect_rspec_runner_arguments(['--tag', '~orchestrated', *described_class::DEFAULT_TEST_PATH_ARGS])
subject.perform
end
it_behaves_like 'excludes orchestrated'
context 'when tty is set' do
subject { described_class.new.tap { |runner| runner.tty = true } }
......@@ -67,8 +73,6 @@ describe QA::Specs::Runner do
allow(QA::Runtime::Env).to receive(:signup_disabled?).and_return(true)
end
subject { described_class.new }
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])
......@@ -76,18 +80,54 @@ describe QA::Specs::Runner do
end
end
context 'when git protocol v2 is not supported' do
before do
allow(QA::Runtime::Env).to receive(:can_test?).with(:git_protocol_v2).and_return(false)
context 'testable features' do
shared_examples 'one supported feature' do |feature|
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
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
expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~requires_git_protocol_v2', *described_class::DEFAULT_TEST_PATH_ARGS])
context 'when only admin features are supported' do
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
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
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