Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
a7cb8cf352
commit
54bb6d645b
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
# Cop supports --autocorrect.
|
||||
Style/RedundantInterpolation:
|
||||
Exclude:
|
||||
- 'lib/backup/manager.rb'
|
||||
- 'lib/gitlab/application_rate_limiter.rb'
|
||||
- 'lib/gitlab/chat/responder/mattermost.rb'
|
||||
- 'lib/gitlab/ci/build/releaser.rb'
|
||||
- 'lib/gitlab/ci/reports/test_suite.rb'
|
||||
- 'lib/gitlab/ci/runner_instructions.rb'
|
||||
- 'lib/gitlab/console.rb'
|
||||
- 'lib/gitlab/metrics/web_transaction.rb'
|
||||
- 'lib/gitlab/pagination/keyset/in_operator_optimization/strategies/record_loader_strategy.rb'
|
||||
- 'lib/gitlab/prometheus_client.rb'
|
||||
- 'lib/gitlab/repository_cache.rb'
|
||||
- 'lib/gitlab/repository_cache_adapter.rb'
|
||||
- 'lib/gitlab/repository_hash_cache.rb'
|
||||
|
||||
|
|
@ -55,14 +55,14 @@ coverage in the tool's output:
|
|||
| Name | Language | Command | Example |
|
||||
|--------------|--------------|--------------|--------------|
|
||||
| Simplecov | Ruby | None | `/\(\d+.\d+\%\) covered/` |
|
||||
| pytest-cov | Python | None | `/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/` |
|
||||
| Scoverage | Scala | None | `/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/` |
|
||||
| pytest-cov | Python | None | `/TOTAL.*? (100(?:\.0+)?\%\|[1-9]?\d(?:\.\d+)?\%)$/` |
|
||||
| Scoverage | Scala | None | `/(?i)total.*? (100(?:\.0+)?\%\|[1-9]?\d(?:\.\d+)?\%)$/` |
|
||||
| pest | PHP | `pest --coverage --colors=never` | `/Statement coverage[A-Za-z\.*]\s*:\s*([^%]+)/` |
|
||||
| phpunit | PHP | `phpunit --coverage-text --colors=never` | `/^\s*Lines:\s*\d+.\d+\%/` |
|
||||
| gcovr | C/C++ | None | `/^TOTAL.*\s+(\d+\%)$/` |
|
||||
| tap | NodeJs | `tap --coverage-report=text-summary` | `/^Statements\s*:\s*([^%]+)/` |
|
||||
| nyc | NodeJs | `nyc npm test` | `/All files[^|]*\|[^|]*\s+([\d\.]+)/` |
|
||||
| jest | NodeJs | `jest --ci --coverage` | `/All files[^|]*\|[^|]*\s+([\d\.]+)/` |
|
||||
| nyc | NodeJs | `nyc npm test` | `/All files[^\|]*\|[^\|]*\s+([\d\.]+)/` |
|
||||
| jest | NodeJs | `jest --ci --coverage` | `/All files[^\|]*\|[^\|]*\s+([\d\.]+)/` |
|
||||
| excoveralls | Elixir | None | `/\[TOTAL\]\s+(\d+\.\d+)%/` |
|
||||
| mix | Elixir | `mix test --cover` | `/\d+.\d+\%\s+\|\s+Total/` |
|
||||
| JaCoCo | Java/Kotlin | None | `/Total.*?([0-9]{1,3})%/` |
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ To obtain a Google Cloud service key for local development, follow the steps bel
|
|||
|
||||
1. Set up a Google Cloud project
|
||||
1. Option 1 (recommended for GitLab team members): request access to our
|
||||
existing group Google Cloud project by using
|
||||
existing group Google Cloud project (`ai-enablement-dev-69497ba7`) by using
|
||||
[this template](https://gitlab.com/gitlab-com/it/infra/issue-tracker/-/issues/new?issuable_template=gcp_group_account_iam_update_request)
|
||||
This project has Vertex APIs and Vertex AI Search (for Duo Chat
|
||||
documentaton questions) already enabled
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ module Gitlab
|
|||
|
||||
serialized = composed_key.map do |obj|
|
||||
if obj.is_a?(String) || obj.is_a?(Symbol)
|
||||
"#{obj}"
|
||||
obj.to_s
|
||||
else
|
||||
"#{obj.class.model_name.to_s.underscore}:#{obj.id}"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ module Gitlab
|
|||
{
|
||||
short: true,
|
||||
title: "ID",
|
||||
value: "#{build_ref}"
|
||||
value: build_ref.to_s
|
||||
},
|
||||
{
|
||||
short: true,
|
||||
|
|
@ -70,7 +70,7 @@ module Gitlab
|
|||
{
|
||||
short: true,
|
||||
title: "ID",
|
||||
value: "#{build_ref}"
|
||||
value: build_ref.to_s
|
||||
},
|
||||
{
|
||||
short: true,
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def stringified_json(object)
|
||||
"#{object.to_json.to_json}"
|
||||
object.to_json.to_json.to_s
|
||||
end
|
||||
|
||||
def catalog_publish?
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
TestCase::STATUS_TYPES.each do |status_type|
|
||||
define_method("#{status_type}") do
|
||||
define_method(status_type.to_s) do
|
||||
return {} if suite_error || test_cases[status_type].nil?
|
||||
|
||||
test_cases[status_type]
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def replace_variables(expression)
|
||||
expression.sub('${GITLAB_CI_RUNNER_DOWNLOAD_LOCATION}', "#{environment[:download_locations][@arch.to_sym]}")
|
||||
expression.sub('${GITLAB_CI_RUNNER_DOWNLOAD_LOCATION}', (environment[:download_locations][@arch.to_sym]).to_s)
|
||||
end
|
||||
|
||||
def get_file(path)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ module Gitlab
|
|||
puts '-' * 80
|
||||
puts " Ruby:".ljust(justify) + RUBY_DESCRIPTION
|
||||
puts " GitLab:".ljust(justify) + "#{Gitlab::VERSION} (#{Gitlab.revision}) #{Gitlab.ee? ? 'EE' : 'FOSS'}"
|
||||
puts " GitLab Shell:".ljust(justify) + "#{Gitlab::VersionInfo.parse(Gitlab::Shell.version)}"
|
||||
puts " GitLab Shell:".ljust(justify) + Gitlab::VersionInfo.parse(Gitlab::Shell.version).to_s
|
||||
|
||||
if ApplicationRecord.database.exists?
|
||||
puts " #{ApplicationRecord.database.human_adapter_name}:".ljust(justify) + ApplicationRecord.database.version
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ module Gitlab
|
|||
def labels_from_controller
|
||||
controller = @env[CONTROLLER_KEY]
|
||||
|
||||
action = "#{controller.action_name}"
|
||||
action = controller.action_name.to_s
|
||||
|
||||
# Devise exposes a method called "request_format" that does the below.
|
||||
# However, this method is not available to all controllers (e.g. certain
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ module Gitlab
|
|||
def columns
|
||||
query = finder_query
|
||||
.call(*order_by_columns.array_lookup_expressions_by_position(QueryBuilder::RECURSIVE_CTE_NAME))
|
||||
.select("#{table_name}")
|
||||
.select(table_name.to_s)
|
||||
.limit(1)
|
||||
|
||||
["(#{query.to_sql})"]
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ module Gitlab
|
|||
# From Prometheus docs: This endpoint returns 200 when Prometheus is ready to serve traffic (i.e. respond to queries).
|
||||
response.code == 200
|
||||
rescue StandardError => e
|
||||
raise PrometheusClient::UnexpectedResponseError, "#{e.message}"
|
||||
raise PrometheusClient::UnexpectedResponseError, e.message.to_s
|
||||
end
|
||||
|
||||
def proxy(type, args)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module Gitlab
|
|||
|
||||
def initialize(repository, extra_namespace: nil, backend: self.class.store)
|
||||
@repository = repository
|
||||
@namespace = "#{repository.full_path}"
|
||||
@namespace = repository.full_path.to_s
|
||||
@namespace += ":#{repository.project.id}" if repository.project
|
||||
@namespace = "#{@namespace}:#{extra_namespace}" if extra_namespace
|
||||
@backend = backend
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ module Gitlab
|
|||
private
|
||||
|
||||
def memoizable_name(name)
|
||||
"#{name.to_s.tr('?!', '')}"
|
||||
name.to_s.tr('?!', '').to_s
|
||||
end
|
||||
|
||||
def expire_request_store_method_caches(methods)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ module Gitlab
|
|||
# @param expires_in [Integer] expiry time for hash store keys
|
||||
def initialize(repository, extra_namespace: nil, expires_in: 1.day)
|
||||
@repository = repository
|
||||
@namespace = "#{repository.full_path}"
|
||||
@namespace = repository.full_path.to_s
|
||||
@namespace += ":#{repository.project.id}" if repository.project
|
||||
@namespace = "#{@namespace}:#{extra_namespace}" if extra_namespace
|
||||
@expires_in = expires_in
|
||||
|
|
|
|||
|
|
@ -20,7 +20,17 @@ module QA
|
|||
end
|
||||
|
||||
def has_file?(file_name)
|
||||
has_element?("div[aria-label='#{file_name}']")
|
||||
within_vscode_editor do
|
||||
has_element?("div[aria-label='#{file_name}']")
|
||||
end
|
||||
end
|
||||
|
||||
def has_pending_changes?
|
||||
within_vscode_editor do
|
||||
all_elements('.action-item', minimum: 1).any? do |item|
|
||||
item[:'aria-label'] =~ /Source Control .* \d+ pending changes/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def open_file_from_explorer(file_name)
|
||||
|
|
@ -36,7 +46,7 @@ module QA
|
|||
end
|
||||
|
||||
def has_right_click_menu_item?
|
||||
has_element?('div.menu-item-check')
|
||||
has_element?('.action-menu-item')
|
||||
end
|
||||
|
||||
def click_menu_item(item)
|
||||
|
|
@ -44,7 +54,11 @@ module QA
|
|||
end
|
||||
|
||||
def click_upload_menu_item
|
||||
click_element('span[aria-label="Upload..."]')
|
||||
selector = 'span[aria-label="Upload..."]'
|
||||
Support::Waiter.wait_until do
|
||||
click_element(selector)
|
||||
has_no_element?(selector, wait: 1)
|
||||
end
|
||||
end
|
||||
|
||||
def enter_text_for_input(name)
|
||||
|
|
@ -56,8 +70,8 @@ module QA
|
|||
find_element('input[type="file"]', visible: false).send_keys(file)
|
||||
end
|
||||
|
||||
def has_commit_pending_tab?
|
||||
has_element?('.scm-viewlet-label')
|
||||
def has_commit_pending_tab?(wait: Capybara.default_max_wait_time)
|
||||
has_element?('.scm-viewlet-label', wait: wait)
|
||||
end
|
||||
|
||||
def click_commit_pending_tab
|
||||
|
|
@ -104,7 +118,9 @@ module QA
|
|||
end
|
||||
|
||||
def has_committed_successfully?
|
||||
has_element?('.span[title="Success! Your changes have been committed."]')
|
||||
within_vscode_editor do
|
||||
has_text?('Success! Your changes have been committed.')
|
||||
end
|
||||
end
|
||||
|
||||
def has_message?(content)
|
||||
|
|
@ -117,10 +133,8 @@ module QA
|
|||
page.execute_script "window.close();" if page.current_url.include?('ide')
|
||||
end
|
||||
|
||||
def ide_tab_closed?
|
||||
within_vscode_editor do
|
||||
has_file_explorer?
|
||||
end
|
||||
def ide_tab_closed?(wait: Capybara.default_max_wait_time)
|
||||
has_no_element?('#ide iframe', wait: wait)
|
||||
end
|
||||
|
||||
def within_vscode_editor(&block)
|
||||
|
|
@ -183,16 +197,18 @@ module QA
|
|||
def commit_and_push_to_new_branch(file_name)
|
||||
commit_toggle(file_name)
|
||||
push_to_new_branch
|
||||
Support::Waiter.wait_until { !has_text?("Loading GitLab Web IDE...", wait: 1) }
|
||||
end
|
||||
|
||||
def commit_and_push_to_existing_branch(file_name)
|
||||
commit_toggle(file_name)
|
||||
push_to_existing_branch
|
||||
Support::Waiter.wait_until { !has_text?("Loading GitLab Web IDE...", wait: 1) }
|
||||
end
|
||||
|
||||
def commit_toggle(message)
|
||||
within_vscode_editor do
|
||||
if has_commit_pending_tab?
|
||||
if has_commit_pending_tab?(wait: 0)
|
||||
click_commit_pending_tab
|
||||
else
|
||||
click_commit_tab
|
||||
|
|
@ -209,8 +225,8 @@ module QA
|
|||
def push_to_existing_branch
|
||||
within_vscode_editor do
|
||||
click_continue_with_existing_branch
|
||||
has_committed_successfully?
|
||||
end
|
||||
raise "failed to push_to_existing_branch" unless has_committed_successfully?
|
||||
end
|
||||
|
||||
def push_to_new_branch
|
||||
|
|
@ -219,8 +235,8 @@ module QA
|
|||
has_branch_input_field?
|
||||
# Typing enter to 'New branch name' popup to take the default branch name
|
||||
send_keys(:enter)
|
||||
has_committed_successfully?
|
||||
end
|
||||
raise "failed to push_to_new_branch" unless has_committed_successfully?
|
||||
end
|
||||
|
||||
def create_merge_request
|
||||
|
|
@ -237,18 +253,9 @@ module QA
|
|||
# VSCode eagerly removes the input[type='file'] from click on Upload.
|
||||
# We need to execute a script on the iframe to stub out the iframes body.removeChild to add it back in.
|
||||
page.execute_script("document.body.removeChild = function(){};")
|
||||
|
||||
# Use for stability, WebIDE inside an iframe is finnicky, webdriver sometimes moves too fast
|
||||
Support::Retrier.retry_until(
|
||||
max_attempts: 5, retry_on_exception: true, sleep_interval: 2
|
||||
) do
|
||||
right_click_file_explorer
|
||||
has_right_click_menu_item?
|
||||
click_upload_menu_item
|
||||
enter_file_input(file_path)
|
||||
end
|
||||
# Wait for the file to be uploaded
|
||||
has_text?(file_path)
|
||||
right_click_file_explorer
|
||||
click_upload_menu_item
|
||||
enter_file_input(file_path)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -318,7 +325,7 @@ module QA
|
|||
click_menu_item(click_item)
|
||||
# Verify the button is triggered and textbox is waiting for input
|
||||
enter_text_for_input(item_name)
|
||||
has_text?(item_name)
|
||||
has_text?(item_name, wait: 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ module QA
|
|||
context 'when a file with the same name already exists' do
|
||||
let(:file_name) { 'README.md' }
|
||||
|
||||
it 'throws an error', :blocking, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/432899' do
|
||||
it 'throws an error', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/432899' do
|
||||
Page::Project::WebIDE::VSCode.perform do |ide|
|
||||
ide.create_new_file(file_name)
|
||||
|
||||
|
|
@ -33,8 +33,6 @@ module QA
|
|||
Page::Project::WebIDE::VSCode.perform do |ide|
|
||||
ide.create_new_file(file_name)
|
||||
ide.commit_and_push_to_existing_branch(file_name)
|
||||
|
||||
expect(ide).to have_message('Success! Your changes have been committed.')
|
||||
end
|
||||
|
||||
project.visit!
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ module QA
|
|||
Page::Project::WebIDE::VSCode.perform(&:wait_for_ide_to_load)
|
||||
end
|
||||
|
||||
it 'throws an error', :blocking, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/386760' do
|
||||
it 'throws an error', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/386760' do
|
||||
Page::Project::WebIDE::VSCode.perform do |ide|
|
||||
ide.create_new_folder(directory_name)
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ module QA
|
|||
Page::Project::WebIDE::VSCode.perform(&:wait_for_ide_to_load)
|
||||
end
|
||||
|
||||
it 'shows successfully but not able to be committed', :blocking,
|
||||
it 'shows successfully but not able to be committed',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/386761' do
|
||||
Page::Project::WebIDE::VSCode.perform do |ide|
|
||||
ide.create_new_folder(directory_name)
|
||||
|
|
|
|||
|
|
@ -13,11 +13,12 @@ module QA
|
|||
Page::Project::WebIDE::VSCode.perform(&:wait_for_ide_to_load)
|
||||
end
|
||||
|
||||
it 'shows an alert when there are unsaved changes', :blocking,
|
||||
it 'shows an alert when there are unsaved changes',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/411298' do
|
||||
Page::Project::WebIDE::VSCode.perform do |ide|
|
||||
ide.create_new_file(file_name)
|
||||
ide.has_file?(file_name)
|
||||
Support::Waiter.wait_until { ide.has_pending_changes? }
|
||||
|
||||
ide.close_ide_tab
|
||||
expect do
|
||||
ide.ide_tab_closed?
|
||||
|
|
|
|||
|
|
@ -16,12 +16,13 @@ module QA
|
|||
context 'when a file with the same name already exists' do
|
||||
let(:file_name) { 'README.md' }
|
||||
|
||||
it 'throws an error', :blocking, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/390005' do
|
||||
it 'throws an error', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/390005' do
|
||||
Page::Project::WebIDE::VSCode.perform do |ide|
|
||||
ide.upload_file(file_path)
|
||||
|
||||
expect(ide)
|
||||
.to have_message("A file or folder with the name 'README.md' already exists in the destination folder")
|
||||
expect(ide).to have_message(
|
||||
"A file or folder with the name 'README.md' already exists in the destination folder"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -30,13 +31,13 @@ module QA
|
|||
it "verifies it successfully uploads and commits to a MR" do
|
||||
Page::Project::WebIDE::VSCode.perform do |ide|
|
||||
ide.upload_file(file_path)
|
||||
Support::Waiter.wait_until { ide.has_pending_changes? }
|
||||
ide.commit_and_push_to_new_branch(file_name)
|
||||
|
||||
expect(ide).to have_message('Success! Your changes have been committed.')
|
||||
|
||||
ide.create_merge_request
|
||||
end
|
||||
|
||||
# Opens the MR in new tab and verify the file is in the MR
|
||||
page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
|
||||
|
||||
|
|
@ -46,14 +47,14 @@ module QA
|
|||
end
|
||||
end
|
||||
|
||||
context 'when the file is a text file', :blocking,
|
||||
context 'when the file is a text file',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/390006' do
|
||||
let(:file_name) { 'text_file.txt' }
|
||||
|
||||
it_behaves_like 'upload a file'
|
||||
end
|
||||
|
||||
context 'when the file is an image', :blocking,
|
||||
context 'when the file is an image',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/390007' do
|
||||
let(:file_name) { 'dk.png' }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { GlTab } from '@gitlab/ui';
|
||||
import MockAdapter from 'axios-mock-adapter';
|
||||
import { editor as monacoEditor, Range } from 'monaco-editor';
|
||||
import Vue, { nextTick } from 'vue';
|
||||
import { nextTick } from 'vue';
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import Vuex from 'vuex';
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
|
|
@ -115,6 +115,7 @@ describe('RepoEditor', () => {
|
|||
let applyExtensionSpy;
|
||||
let removeExtensionSpy;
|
||||
let extensionsStore;
|
||||
let store;
|
||||
|
||||
const waitForEditorSetup = () =>
|
||||
new Promise((resolve) => {
|
||||
|
|
@ -122,7 +123,7 @@ describe('RepoEditor', () => {
|
|||
});
|
||||
|
||||
const createComponent = async ({ state = {}, activeFile = dummyFile.text } = {}) => {
|
||||
const store = prepareStore(state, activeFile);
|
||||
store = prepareStore(state, activeFile);
|
||||
wrapper = shallowMount(RepoEditor, {
|
||||
store,
|
||||
propsData: {
|
||||
|
|
@ -562,7 +563,10 @@ describe('RepoEditor', () => {
|
|||
});
|
||||
|
||||
it('does not call initEditor if the file did not change', async () => {
|
||||
Vue.set(vm, 'file', vm.file);
|
||||
const newFile = { ...store.state.openFiles[0] };
|
||||
wrapper.setProps({
|
||||
file: newFile,
|
||||
});
|
||||
await nextTick();
|
||||
|
||||
expect(vm.initEditor).not.toHaveBeenCalled();
|
||||
|
|
@ -596,8 +600,7 @@ describe('RepoEditor', () => {
|
|||
|
||||
it('after switching viewer from edit to diff', async () => {
|
||||
const f = createRemoteFile('newFile');
|
||||
Vue.set(vm.$store.state.entries, f.path, f);
|
||||
|
||||
store.state.entries[f.path] = f;
|
||||
jest.spyOn(service, 'getRawFileData').mockImplementation(() => {
|
||||
expect(vm.file.loading).toBe(true);
|
||||
|
||||
|
|
@ -622,8 +625,8 @@ describe('RepoEditor', () => {
|
|||
const aContent = 'fileA-rawContent\n';
|
||||
const bContent = 'fileB-rawContent\n';
|
||||
const fileB = createRemoteFile('fileB');
|
||||
Vue.set(vm.$store.state.entries, fileA.path, fileA);
|
||||
Vue.set(vm.$store.state.entries, fileB.path, fileB);
|
||||
store.state.entries[fileA.path] = fileA;
|
||||
store.state.entries[fileB.path] = fileB;
|
||||
|
||||
jest
|
||||
.spyOn(service, 'getRawFileData')
|
||||
|
|
|
|||
Loading…
Reference in New Issue