diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 11:43:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 11:43:02 +0300 |
commit | d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch) | |
tree | 2341ef426af70ad1e289c38036737e04b0aa5007 /spec/support/helpers | |
parent | d6e514dd13db8947884cd58fe2a9c2a063400a9b (diff) |
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'spec/support/helpers')
-rw-r--r-- | spec/support/helpers/dependency_proxy_helpers.rb | 14 | ||||
-rw-r--r-- | spec/support/helpers/feature_flag_helpers.rb | 2 | ||||
-rw-r--r-- | spec/support/helpers/javascript_fixtures_helpers.rb | 13 | ||||
-rw-r--r-- | spec/support/helpers/navbar_structure_helper.rb | 8 | ||||
-rw-r--r-- | spec/support/helpers/stub_gitlab_calls.rb | 12 | ||||
-rw-r--r-- | spec/support/helpers/usage_data_helpers.rb | 12 |
6 files changed, 37 insertions, 24 deletions
diff --git a/spec/support/helpers/dependency_proxy_helpers.rb b/spec/support/helpers/dependency_proxy_helpers.rb index 9413cb93199..75dc09ec159 100644 --- a/spec/support/helpers/dependency_proxy_helpers.rb +++ b/spec/support/helpers/dependency_proxy_helpers.rb @@ -34,12 +34,20 @@ module DependencyProxyHelpers def build_jwt(user = nil, expire_time: nil) JSONWebToken::HMACToken.new(::Auth::DependencyProxyAuthenticationService.secret).tap do |jwt| - jwt['user_id'] = user.id if user.is_a?(User) - jwt['deploy_token'] = user.token if user.is_a?(DeployToken) - jwt.expire_time = expire_time || jwt.issued_at + 1.minute + if block_given? + yield(jwt) + else + jwt['user_id'] = user.id if user.is_a?(User) + jwt['deploy_token'] = user.token if user.is_a?(DeployToken) + jwt.expire_time = expire_time || jwt.issued_at + 1.minute + end end end + def jwt_token_authorization_headers(jwt) + { 'AUTHORIZATION' => "Bearer #{jwt.encoded}" } + end + private def registry diff --git a/spec/support/helpers/feature_flag_helpers.rb b/spec/support/helpers/feature_flag_helpers.rb index 51ba9039b70..4e57002a7c6 100644 --- a/spec/support/helpers/feature_flag_helpers.rb +++ b/spec/support/helpers/feature_flag_helpers.rb @@ -71,7 +71,7 @@ module FeatureFlagHelpers end def add_linked_issue_button - find('.js-issue-count-badge-add-button') + find_button 'Add a related issue' end def remove_linked_issue_button diff --git a/spec/support/helpers/javascript_fixtures_helpers.rb b/spec/support/helpers/javascript_fixtures_helpers.rb index 5174c145a93..fb909008f12 100644 --- a/spec/support/helpers/javascript_fixtures_helpers.rb +++ b/spec/support/helpers/javascript_fixtures_helpers.rb @@ -3,6 +3,8 @@ require 'action_dispatch/testing/test_request' require 'fileutils' +require_relative '../../../lib/gitlab/popen' + module JavaScriptFixturesHelpers extend ActiveSupport::Concern include Gitlab::Popen @@ -25,17 +27,6 @@ module JavaScriptFixturesHelpers 'tmp/tests/frontend/fixtures' + (Gitlab.ee? ? '-ee' : '') end - # Public: Removes all fixture files from given directory - # - # directory_name - directory of the fixtures (relative to .fixture_root_path) - # - def clean_frontend_fixtures(directory_name) - full_directory_name = File.expand_path(directory_name, fixture_root_path) - Dir[File.expand_path('*.{html,json,md}', full_directory_name)].each do |file_name| - FileUtils.rm(file_name) - end - end - def remove_repository(project) Gitlab::Shell.new.remove_repository(project.repository_storage, project.disk_path) end diff --git a/spec/support/helpers/navbar_structure_helper.rb b/spec/support/helpers/navbar_structure_helper.rb index 826108a63a5..96e79427278 100644 --- a/spec/support/helpers/navbar_structure_helper.rb +++ b/spec/support/helpers/navbar_structure_helper.rb @@ -52,4 +52,12 @@ module NavbarStructureHelper new_sub_nav_item_name: _('Infrastructure Registry') ) end + + def insert_infrastructure_google_cloud_nav + insert_after_sub_nav_item( + _('Terraform'), + within: _('Infrastructure'), + new_sub_nav_item_name: _('Google Cloud') + ) + end end diff --git a/spec/support/helpers/stub_gitlab_calls.rb b/spec/support/helpers/stub_gitlab_calls.rb index 5ab778c11cb..6f530d57caf 100644 --- a/spec/support/helpers/stub_gitlab_calls.rb +++ b/spec/support/helpers/stub_gitlab_calls.rb @@ -79,6 +79,18 @@ module StubGitlabCalls end end + def stub_container_registry_info(info: {}) + allow(ContainerRegistry::Client) + .to receive(:registry_info) + .and_return(info) + end + + def stub_container_registry_network_error(client_method:) + allow_next_instance_of(ContainerRegistry::Client) do |client| + allow(client).to receive(client_method).and_raise(::Faraday::Error, nil, nil) + end + end + def stub_commonmark_sourcepos_disabled allow_any_instance_of(Banzai::Filter::MarkdownEngines::CommonMark) .to receive(:render_options) diff --git a/spec/support/helpers/usage_data_helpers.rb b/spec/support/helpers/usage_data_helpers.rb index b1a9aade043..5ead1813439 100644 --- a/spec/support/helpers/usage_data_helpers.rb +++ b/spec/support/helpers/usage_data_helpers.rb @@ -54,15 +54,8 @@ module UsageDataHelpers clusters_platforms_eks clusters_platforms_gke clusters_platforms_user - clusters_applications_helm - clusters_applications_ingress - clusters_applications_cert_managers - clusters_applications_prometheus - clusters_applications_crossplane - clusters_applications_runner - clusters_applications_knative - clusters_applications_elastic_stack - clusters_applications_jupyter + clusters_integrations_elastic_stack + clusters_integrations_prometheus clusters_management_project in_review_folder grafana_integrated_projects @@ -112,6 +105,7 @@ module UsageDataHelpers projects_with_expiration_policy_enabled_with_older_than_set_to_7d projects_with_expiration_policy_enabled_with_older_than_set_to_14d projects_with_expiration_policy_enabled_with_older_than_set_to_30d + projects_with_expiration_policy_enabled_with_older_than_set_to_60d projects_with_expiration_policy_enabled_with_older_than_set_to_90d projects_with_expiration_policy_enabled_with_cadence_set_to_1d projects_with_expiration_policy_enabled_with_cadence_set_to_7d |