Skip to content
Snippets Groups Projects
Commit c384315a authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent e1e017dd
No related branches found
No related tags found
No related merge requests found
Showing
with 166 additions and 12 deletions
Loading
Loading
@@ -261,10 +261,30 @@ module QA
ENV['QA_RUNTIME_SCENARIO_ATTRIBUTES']
end
 
def disable_rspec_retry?
enabled?(ENV['QA_DISABLE_RSPEC_RETRY'], default: false)
end
def simulate_slow_connection?
enabled?(ENV['QA_SIMULATE_SLOW_CONNECTION'], default: false)
end
def slow_connection_latency
ENV.fetch('QA_SLOW_CONNECTION_LATENCY_MS', 2000).to_i
end
def slow_connection_throughput
ENV.fetch('QA_SLOW_CONNECTION_THROUGHPUT_KBPS', 32).to_i
end
def gitlab_qa_loop_runner_minutes
ENV.fetch('GITLAB_QA_LOOP_RUNNER_MINUTES', 1).to_i
end
 
def mailhog_hostname
ENV['MAILHOG_HOSTNAME']
end
private
 
def remote_grid_credentials
Loading
Loading
# frozen_string_literal: true
module QA
module Runtime
module MailHog
def self.base_url
host = QA::Runtime::Env.mailhog_hostname || 'localhost'
"http://#{host}:8025"
end
def self.api_messages_url
"#{base_url}/api/v2/messages"
end
end
end
end
# frozen_string_literal: true
module QA
module Scenario
module Test
module Integration
class SMTP < Test::Instance::All
tags :smtp
end
end
end
end
end
# frozen_string_literal: true
module QA
context 'Manage', :orchestrated, :smtp do
describe 'mail notification' do
let(:user) do
Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1)
end
let(:project) do
Resource::Project.fabricate_via_api! do |resource|
resource.name = 'email-notification-test'
end
end
before do
Flow::Login.sign_in
end
it 'user receives email for project invitation' do
Flow::Project.add_member(project: project, username: user.username)
expect(page).to have_content(/@#{user.username}(\n| )?Given access/)
# Wait for Action Mailer to deliver messages
mailhog_json = Support::Retrier.retry_until(sleep_interval: 1) do
Runtime::Logger.debug(%Q[retrieving "#{QA::Runtime::MailHog.api_messages_url}"]) if Runtime::Env.debug?
mailhog_response = get QA::Runtime::MailHog.api_messages_url
mailhog_data = JSON.parse(mailhog_response.body)
# Expect at least two invitation messages: group and project
mailhog_data if mailhog_data.dig('total') >= 2
end
# Check json result from mailhog
mailhog_items = mailhog_json.dig('items')
expect(mailhog_items).to include(an_object_satisfying { |o| /project was granted/ === o.dig('Content', 'Headers', 'Subject', 0) })
end
end
end
end
Loading
Loading
@@ -62,7 +62,7 @@ RSpec.configure do |config|
# show exception that triggers a retry if verbose_retry is set to true
config.display_try_failure_messages = true
 
if ENV['CI']
if ENV['CI'] && !QA::Runtime::Env.disable_rspec_retry?
config.around do |example|
retry_times = example.metadata.key?(:quarantine) ? 1 : 2
example.run_with_retry retry: retry_times
Loading
Loading
# frozen_string_literal: true
 
FactoryBot.define do
factory :dev_ops_score_metric, class: ConversationalDevelopmentIndex::Metric do
factory :dev_ops_score_metric, class: DevOpsScore::Metric do
leader_issues { 9.256 }
instance_issues { 1.234 }
percentage_issues { 13.331 }
Loading
Loading
# frozen_string_literal: true
require 'spec_helper'
describe 'Managed-Cluster-Applications.gitlab-ci.yml' do
subject(:template) { Gitlab::Template::GitlabCiYmlTemplate.find('Managed-Cluster-Applications') }
describe 'the created pipeline' do
let_it_be(:user) { create(:user) }
let(:project) { create(:project, :custom_repo, namespace: user.namespace, files: { 'README.md' => '' }) }
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) }
let(:pipeline) { service.execute!(:push) }
let(:build_names) { pipeline.builds.pluck(:name) }
let(:pipeline_branch) { 'master' }
before do
stub_ci_pipeline_yaml_file(template.content)
end
context 'for a default branch' do
it 'creates a apply job' do
expect(build_names).to match_array('apply')
end
end
context 'outside of default branch' do
let(:pipeline_branch) { 'a_branch' }
before do
project.repository.create_branch(pipeline_branch)
end
it 'has no jobs' do
expect { pipeline }.to raise_error(Ci::CreatePipelineService::CreateError, 'No stages / jobs for this pipeline.')
end
end
end
end
Loading
Loading
@@ -2,7 +2,7 @@
 
require 'spec_helper'
 
describe ConversationalDevelopmentIndex::Metric do
describe DevOpsScore::Metric do
let(:conv_dev_index) { create(:dev_ops_score_metric) }
 
describe '#percentage_score' do
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@
 
require 'spec_helper'
 
describe ConversationalDevelopmentIndex::MetricPresenter do
describe DevOpsScore::MetricPresenter do
subject { described_class.new(metric) }
 
let(:metric) { build(:dev_ops_score_metric) }
Loading
Loading
Loading
Loading
@@ -11,7 +11,7 @@ describe 'environments routing' do
end
 
let(:environments_route) do
"#{project.full_path}/environments/"
"#{project.full_path}/-/environments/"
end
 
describe 'routing environment folders' do
Loading
Loading
@@ -38,7 +38,7 @@ describe 'environments routing' do
end
 
def get_folder(folder)
get("#{project.full_path}/environments/folders/#{folder}")
get("#{project.full_path}/-/environments/folders/#{folder}")
end
 
def folder_action(**opts)
Loading
Loading
Loading
Loading
@@ -794,4 +794,28 @@ describe 'project routing' do
expect(post('/gitlab/gitlabhq/usage_ping/web_ide_clientside_preview')).to route_to('projects/usage_ping#web_ide_clientside_preview', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
end
describe Projects::EnvironmentsController, 'routing' do
describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/environments", "/gitlab/gitlabhq/-/environments"
end
end
describe Projects::ClustersController, 'routing' do
describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/clusters", "/gitlab/gitlabhq/-/clusters"
end
end
describe Projects::ErrorTrackingController, 'routing' do
describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/error_tracking", "/gitlab/gitlabhq/-/error_tracking"
end
end
describe Projects::Serverless, 'routing' do
describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/serverless", "/gitlab/gitlabhq/-/serverless"
end
end
end
Loading
Loading
@@ -24,7 +24,7 @@ describe ClusterBasicEntity do
 
it 'exposes the cluster details' do
expect(subject[:name]).to eq('the-cluster')
expect(subject[:path]).to eq("/#{project.full_path}/clusters/#{cluster.id}")
expect(subject[:path]).to eq("/#{project.full_path}/-/clusters/#{cluster.id}")
end
 
context 'when the user does not have permission to view the cluster' do
Loading
Loading
Loading
Loading
@@ -73,7 +73,7 @@ describe EnvironmentStatusEntity do
 
it 'returns metrics url' do
expect(subject[:metrics_url])
.to eq("/#{project.full_path}/environments/#{environment.id}/deployments/#{deployment.iid}/metrics")
.to eq("/#{project.full_path}/-/environments/#{environment.id}/deployments/#{deployment.iid}/metrics")
end
end
 
Loading
Loading
Loading
Loading
@@ -46,12 +46,12 @@ describe SubmitUsagePingService do
stub_response(with_conv_index_params)
 
expect { subject.execute }
.to change { ConversationalDevelopmentIndex::Metric.count }
.to change { DevOpsScore::Metric.count }
.by(1)
 
expect(ConversationalDevelopmentIndex::Metric.last.leader_issues).to eq 10.2
expect(ConversationalDevelopmentIndex::Metric.last.instance_issues).to eq 3.2
expect(ConversationalDevelopmentIndex::Metric.last.percentage_issues).to eq 31.37
expect(DevOpsScore::Metric.last.leader_issues).to eq 10.2
expect(DevOpsScore::Metric.last.instance_issues).to eq 3.2
expect(DevOpsScore::Metric.last.percentage_issues).to eq 31.37
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment