Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-09-30 12:12:36 +00:00
parent 5b80d465ae
commit 4e8c8922da
24 changed files with 135 additions and 127 deletions

View file

@ -128,13 +128,11 @@ update-storybook-yarn-cache:
- tmp/tests/frontend/ - tmp/tests/frontend/
- knapsack/ - knapsack/
# In gitlab-foss, generates FOSS fixtures. In gitlab, generates FOSS & EE fixtures. rspec frontend_fixture:
# That way, we don't need to have two separate jobs.
rspec-all frontend_fixture:
extends: extends:
- .frontend-fixtures-base - .frontend-fixtures-base
- .frontend:rules:default-frontend-jobs - .frontend:rules:default-frontend-jobs
parallel: 5 parallel: 2
rspec frontend_fixture as-if-foss: rspec frontend_fixture as-if-foss:
extends: extends:
@ -142,6 +140,12 @@ rspec frontend_fixture as-if-foss:
- .frontend:rules:default-frontend-jobs-as-if-foss - .frontend:rules:default-frontend-jobs-as-if-foss
- .as-if-foss - .as-if-foss
rspec-ee frontend_fixture:
extends:
- .frontend-fixtures-base
- .frontend:rules:default-frontend-jobs-ee
parallel: 3
graphql-schema-dump: graphql-schema-dump:
variables: variables:
SETUP_DB: "false" SETUP_DB: "false"
@ -192,7 +196,9 @@ jest:
- .frontend:rules:jest - .frontend:rules:jest
needs: needs:
- job: "detect-tests" - job: "detect-tests"
- job: "rspec-all frontend_fixture" - job: "rspec frontend_fixture"
- job: "rspec-ee frontend_fixture"
optional: true
artifacts: artifacts:
name: coverage-frontend name: coverage-frontend
expire_in: 31d expire_in: 31d
@ -219,7 +225,9 @@ jest-integration:
script: script:
- run_timed_command "yarn jest:integration --ci" - run_timed_command "yarn jest:integration --ci"
needs: needs:
- job: "rspec-all frontend_fixture" - job: "rspec frontend_fixture"
- job: "rspec-ee frontend_fixture"
optional: true
- job: "graphql-schema-dump" - job: "graphql-schema-dump"
jest-as-if-foss: jest-as-if-foss:
@ -333,7 +341,9 @@ startup-css-check:
- .frontend:rules:default-frontend-jobs - .frontend:rules:default-frontend-jobs
needs: needs:
- job: "compile-test-assets" - job: "compile-test-assets"
- job: "rspec-all frontend_fixture" - job: "rspec frontend_fixture"
- job: "rspec-ee frontend_fixture"
optional: true
startup-css-check as-if-foss: startup-css-check as-if-foss:
extends: extends:

View file

@ -495,6 +495,13 @@
- <<: *if-default-refs - <<: *if-default-refs
changes: *code-backstage-patterns changes: *code-backstage-patterns
.frontend:rules:default-frontend-jobs-ee:
rules:
- <<: *if-not-ee
when: never
- <<: *if-default-refs
changes: *code-backstage-patterns
.frontend:rules:default-frontend-jobs-as-if-foss: .frontend:rules:default-frontend-jobs-as-if-foss:
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee

View file

@ -29,7 +29,8 @@ update-tests-metadata:
- retrieve-tests-metadata - retrieve-tests-metadata
- setup-test-env - setup-test-env
- rspec migration pg12 - rspec migration pg12
- rspec-all frontend_fixture - rspec frontend_fixture
- rspec-ee frontend_fixture
- rspec unit pg12 - rspec unit pg12
- rspec integration pg12 - rspec integration pg12
- rspec system pg12 - rspec system pg12

View file

@ -1,8 +1,8 @@
<script> <script>
import { GlLink, GlLoadingIcon, GlPagination, GlTable } from '@gitlab/ui'; import { GlLink, GlLoadingIcon, GlPagination, GlTable, GlAlert } from '@gitlab/ui';
import * as Sentry from '@sentry/browser';
import { DEFAULT_PER_PAGE } from '~/api'; import { DEFAULT_PER_PAGE } from '~/api';
import createFlash from '~/flash';
import { fetchOverrides } from '~/integrations/overrides/api'; import { fetchOverrides } from '~/integrations/overrides/api';
import { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils'; import { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils';
import { truncateNamespace } from '~/lib/utils/text_utility'; import { truncateNamespace } from '~/lib/utils/text_utility';
@ -16,6 +16,7 @@ export default {
GlLoadingIcon, GlLoadingIcon,
GlPagination, GlPagination,
GlTable, GlTable,
GlAlert,
ProjectAvatar, ProjectAvatar,
}, },
props: { props: {
@ -36,6 +37,7 @@ export default {
overrides: [], overrides: [],
page: 1, page: 1,
totalItems: 0, totalItems: 0,
errorMessage: null,
}; };
}, },
computed: { computed: {
@ -49,6 +51,7 @@ export default {
methods: { methods: {
loadOverrides(page = this.page) { loadOverrides(page = this.page) {
this.isLoading = true; this.isLoading = true;
this.errorMessage = null;
fetchOverrides(this.overridesPath, { fetchOverrides(this.overridesPath, {
page, page,
@ -61,11 +64,9 @@ export default {
this.overrides = data; this.overrides = data;
}) })
.catch((error) => { .catch((error) => {
createFlash({ this.errorMessage = this.$options.i18n.defaultErrorMessage;
message: this.$options.i18n.defaultErrorMessage,
error, Sentry.captureException(error);
captureError: true,
});
}) })
.finally(() => { .finally(() => {
this.isLoading = false; this.isLoading = false;
@ -85,7 +86,11 @@ export default {
<template> <template>
<div> <div>
<gl-alert v-if="errorMessage" variant="danger" :dismissible="false">
{{ errorMessage }}
</gl-alert>
<gl-table <gl-table
v-else
:items="overrides" :items="overrides"
:fields="$options.fields" :fields="$options.fields"
:busy="isLoading" :busy="isLoading"

View file

@ -1,5 +1,5 @@
<script> <script>
import { GlButton, GlLoadingIcon, GlIcon, GlLink, GlBadge, GlSafeHtmlDirective } from '@gitlab/ui'; import { GlButton, GlLoadingIcon, GlLink, GlBadge, GlSafeHtmlDirective } from '@gitlab/ui';
import SmartVirtualList from '~/vue_shared/components/smart_virtual_list.vue'; import SmartVirtualList from '~/vue_shared/components/smart_virtual_list.vue';
import { EXTENSION_ICON_CLASS } from '../../constants'; import { EXTENSION_ICON_CLASS } from '../../constants';
import StatusIcon from './status_icon.vue'; import StatusIcon from './status_icon.vue';
@ -14,7 +14,6 @@ export default {
components: { components: {
GlButton, GlButton,
GlLoadingIcon, GlLoadingIcon,
GlIcon,
GlLink, GlLink,
GlBadge, GlBadge,
SmartVirtualList, SmartVirtualList,
@ -139,9 +138,7 @@ export default {
class="report-block-container" class="report-block-container"
> >
<li v-for="data in fullData" :key="data.id" class="d-flex align-items-center"> <li v-for="data in fullData" :key="data.id" class="d-flex align-items-center">
<div v-if="data.icon" :class="data.icon.class" class="d-flex"> <status-icon v-if="data.icon" :icon-name="data.icon.name" :size="12" />
<gl-icon :name="data.icon.name" :size="24" />
</div>
<div <div
class="gl-mt-2 gl-mb-2 align-content-around align-items-start flex-wrap align-self-center d-flex" class="gl-mt-2 gl-mb-2 align-content-around align-items-start flex-wrap align-self-center d-flex"
> >

View file

@ -1,7 +1,7 @@
<script> <script>
import { GlLoadingIcon, GlIcon } from '@gitlab/ui'; import { GlLoadingIcon, GlIcon } from '@gitlab/ui';
import { capitalizeFirstCharacter } from '~/lib/utils/text_utility'; import { capitalizeFirstCharacter } from '~/lib/utils/text_utility';
import { EXTENSION_ICON_CLASS, EXTENSION_ICONS } from '../../constants'; import { EXTENSION_ICON_CLASS, EXTENSION_ICON_NAMES } from '../../constants';
export default { export default {
components: { components: {
@ -11,41 +11,48 @@ export default {
props: { props: {
name: { name: {
type: String, type: String,
required: true, required: false,
default: '',
}, },
isLoading: { isLoading: {
type: Boolean, type: Boolean,
required: true, required: false,
default: false,
}, },
iconName: { iconName: {
type: String, type: String,
required: false, required: false,
default: null, default: null,
}, },
size: {
type: Number,
required: false,
default: 16,
},
}, },
computed: { computed: {
iconAriaLabel() { iconAriaLabel() {
const statusLabel = Object.keys(EXTENSION_ICONS).find( return `${capitalizeFirstCharacter(this.iconName)} ${this.name}`;
(k) => EXTENSION_ICONS[k] === this.iconName,
);
return `${capitalizeFirstCharacter(statusLabel)} ${this.name}`;
}, },
}, },
EXTENSION_ICON_NAMES,
EXTENSION_ICON_CLASS, EXTENSION_ICON_CLASS,
}; };
</script> </script>
<template> <template>
<div <div
:class="[$options.EXTENSION_ICON_CLASS[iconName], { 'mr-widget-extension-icon': !isLoading }]" :class="[
$options.EXTENSION_ICON_CLASS[iconName],
{ 'mr-widget-extension-icon': !isLoading && size === 16 },
]"
class="align-self-center gl-rounded-full gl-mr-3 gl-relative gl-p-2" class="align-self-center gl-rounded-full gl-mr-3 gl-relative gl-p-2"
> >
<gl-loading-icon v-if="isLoading" size="md" inline class="gl-display-block" /> <gl-loading-icon v-if="isLoading" size="md" inline class="gl-display-block" />
<gl-icon <gl-icon
v-else v-else
:name="iconName" :name="$options.EXTENSION_ICON_NAMES[iconName]"
:size="16" :size="size"
:aria-label="iconAriaLabel" :aria-label="iconAriaLabel"
class="gl-display-block" class="gl-display-block"
/> />

View file

@ -93,17 +93,30 @@ export const stateToComponentMap = {
}; };
export const EXTENSION_ICONS = { export const EXTENSION_ICONS = {
failed: 'failed',
warning: 'warning',
success: 'success',
neutral: 'neutral',
error: 'error',
notice: 'notice',
};
export const EXTENSION_ICON_NAMES = {
failed: 'status-failed', failed: 'status-failed',
warning: 'status-alert', warning: 'status-alert',
success: 'status-success', success: 'status-success',
neutral: 'status-neutral', neutral: 'status-neutral',
error: 'status-alert',
notice: 'status-alert',
}; };
export const EXTENSION_ICON_CLASS = { export const EXTENSION_ICON_CLASS = {
[EXTENSION_ICONS.failed]: 'gl-text-red-500', failed: 'gl-text-red-500',
[EXTENSION_ICONS.warning]: 'gl-text-orange-500', warning: 'gl-text-orange-500',
[EXTENSION_ICONS.success]: 'gl-text-green-500', success: 'gl-text-green-500',
[EXTENSION_ICONS.neutral]: 'gl-text-gray-400', neutral: 'gl-text-gray-400',
error: 'gl-text-red-500',
notice: 'gl-text-gray-500',
}; };
export { STATE_MACHINE }; export { STATE_MACHINE };

View file

@ -45,10 +45,7 @@ export default {
// Icon to get rendered on the side of each row // Icon to get rendered on the side of each row
icon: { icon: {
// Required: Name maps to an icon in GitLabs SVG // Required: Name maps to an icon in GitLabs SVG
name: name: issue.state === 'closed' ? EXTENSION_ICONS.error : EXTENSION_ICONS.success,
issue.state === 'closed' ? 'status_failed_borderless' : 'status_success_borderless',
// Optional: An extra class to be added to the icon for additional styling
class: issue.state === 'closed' ? 'text-danger' : 'text-success',
}, },
// Badges get rendered next to the text on each row // Badges get rendered next to the text on each row
badge: issue.state === 'closed' && { badge: issue.state === 'closed' && {

View file

@ -206,6 +206,12 @@
padding: 0; padding: 0;
height: 100%; height: 100%;
&.with-system-header {
.login-page-broadcast {
margin-top: $system-header-height + $header-height;
}
}
// Fixes footer container to bottom of viewport // Fixes footer container to bottom of viewport
body { body {
// offset height of fixed header + 1 to avoid scroll // offset height of fixed header + 1 to avoid scroll

View file

@ -446,10 +446,10 @@ List the artifacts for a single project, sorted by artifact size. The output inc
- on-disk location of the artifact - on-disk location of the artifact
```ruby ```ruby
p = Project.find_by_id(:project ID) p = Project.find_by_id(<project_id>)
arts = Ci::JobArtifact.where(project: p) arts = Ci::JobArtifact.where(project: p)
list = arts.order('sort DESC').limit(50).each do |art| list = arts.order(size: :desc).limit(50).each do |art|
puts "Job ID: #{art.job_id} - Size: #{art.size}b - Type: #{art.file_type} - Created: #{art.created_at} - File loc: #{art.file}" puts "Job ID: #{art.job_id} - Size: #{art.size}b - Type: #{art.file_type} - Created: #{art.created_at} - File loc: #{art.file}"
end end
``` ```

View file

@ -31,8 +31,8 @@ The hard-coded rules only permit:
Furthermore, configuration in Workhorse can lead to the image scaler rejecting a request if: Furthermore, configuration in Workhorse can lead to the image scaler rejecting a request if:
- The image file is too large (controlled by [`max_filesize`](- we only rescale images that do not exceed a configured size in bytes (see [`max_filesize`](https://gitlab.com/gitlab-org/gitlab-workhorse/-/blob/67ab3a2985d2097392f93523ae1cffe0dbf01b31/config.toml.example#L17)))). - The image file is too large (controlled by [`max_filesize`](- we only rescale images that do not exceed a configured size in bytes (see [`max_filesize`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/workhorse/config.toml.example#L22)))).
- Too many image scalers are already running (controlled by [`max_scaler_procs`](https://gitlab.com/gitlab-org/gitlab-workhorse/-/blob/67ab3a2985d2097392f93523ae1cffe0dbf01b31/config.toml.example#L16)). - Too many image scalers are already running (controlled by [`max_scaler_procs`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/workhorse/config.toml.example#L21)).
For instance, here are two different URLs that serve the GitLab project avatar both in its For instance, here are two different URLs that serve the GitLab project avatar both in its
original size and scaled down to 64 pixels. Only the second request will trigger the image scaler: original size and scaled down to 64 pixels. Only the second request will trigger the image scaler:
@ -73,7 +73,7 @@ we simply follow the path we take to serve any ordinary upload.
### Workhorse ### Workhorse
Assuming Rails decided the request to be valid, Workhorse will take over. Upon receiving the `send-scaled-image` Assuming Rails decided the request to be valid, Workhorse will take over. Upon receiving the `send-scaled-image`
instruction through the Rails response, a [special response injector](https://gitlab.com/gitlab-org/gitlab-workhorse/-/blob/master/internal/imageresizer/image_resizer.go) instruction through the Rails response, a [special response injector](https://gitlab.com/gitlab-org/gitlab/-/blob/master/workhorse/internal/imageresizer/image_resizer.go)
will be invoked that knows how to rescale images. The only inputs it requires are the location of the image will be invoked that knows how to rescale images. The only inputs it requires are the location of the image
(a path if the image resides in block storage, or a URL to remote storage otherwise) and the desired width. (a path if the image resides in block storage, or a URL to remote storage otherwise) and the desired width.
Workhorse will handle the location transparently so Rails does not need to be concerned with where the image Workhorse will handle the location transparently so Rails does not need to be concerned with where the image

View file

@ -252,7 +252,7 @@ graph RL;
2_1-1 & 2_1-2 & 2_1-3 & 2_1-4 --> 1-6; 2_1-1 & 2_1-2 & 2_1-3 & 2_1-4 --> 1-6;
end end
2_2-2["rspec-all frontend_fixture (7 minutes)"]; 2_2-2["rspec frontend_fixture/rspec-ee frontend_fixture (7 minutes)"];
class 2_2-2 criticalPath; class 2_2-2 criticalPath;
click 2_2-2 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=7910143&udv=0" click 2_2-2 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=7910143&udv=0"
2_2-4["memory-on-boot (3.5 minutes)"]; 2_2-4["memory-on-boot (3.5 minutes)"];
@ -284,7 +284,7 @@ graph RL;
3_1-1["jest (14.5 minutes)"]; 3_1-1["jest (14.5 minutes)"];
class 3_1-1 criticalPath; class 3_1-1 criticalPath;
click 3_1-1 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914204&udv=0" click 3_1-1 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914204&udv=0"
subgraph "Needs `rspec-all frontend_fixture`"; subgraph "Needs `rspec frontend_fixture/rspec-ee frontend_fixture`";
3_1-1 --> 2_2-2; 3_1-1 --> 2_2-2;
end end
@ -355,7 +355,7 @@ graph RL;
2_1-1 & 2_1-2 & 2_1-3 & 2_1-4 --> 1-6; 2_1-1 & 2_1-2 & 2_1-3 & 2_1-4 --> 1-6;
end end
2_2-2["rspec-all frontend_fixture (7 minutes)"]; 2_2-2["rspec frontend_fixture/rspec-ee frontend_fixture (7 minutes)"];
class 2_2-2 criticalPath; class 2_2-2 criticalPath;
click 2_2-2 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=7910143&udv=0" click 2_2-2 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=7910143&udv=0"
2_2-4["memory-on-boot (3.5 minutes)"]; 2_2-4["memory-on-boot (3.5 minutes)"];
@ -395,7 +395,7 @@ graph RL;
3_1-1["jest (14.5 minutes)"]; 3_1-1["jest (14.5 minutes)"];
class 3_1-1 criticalPath; class 3_1-1 criticalPath;
click 3_1-1 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914204&udv=0" click 3_1-1 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914204&udv=0"
subgraph "Needs `rspec-all frontend_fixture`"; subgraph "Needs `rspec frontend_fixture/rspec-ee frontend_fixture`";
3_1-1 --> 2_2-2; 3_1-1 --> 2_2-2;
end end

View file

@ -146,7 +146,7 @@ it('does not display a dropdown if no metricTypes exist', () => {
}); });
``` ```
Keep an eye out for these kinds of tests, as they just make updating logic more fragile and tedious than it needs to be. This is also true for other libraries. A rule of thumb here is: if you are checking a `wrapper.vm` property, you should probably stop and rethink the test to check the rendered template instead. Keep an eye out for these kinds of tests, as they just make updating logic more fragile and tedious than it needs to be. This is also true for other libraries. A suggestion here is: if you are checking a `wrapper.vm` property, you should probably stop and rethink the test to check the rendered template instead.
Some more examples can be found in the [Frontend unit tests section](testing_levels.md#frontend-unit-tests) Some more examples can be found in the [Frontend unit tests section](testing_levels.md#frontend-unit-tests)

View file

@ -33,7 +33,7 @@ tags:
- windows-1809 - windows-1809
``` ```
A list of software preinstalled on the Windows images is available at: [Preinstalled software](https://gitlab.com/gitlab-org/ci-cd/shared-runners/images/gcp/windows-containers/blob/master/cookbooks/preinstalled-software/README.md). A list of software preinstalled on the Windows images is available at: [Preinstalled software](https://gitlab.com/gitlab-org/ci-cd/shared-runners/images/gcp/windows-containers/blob/main/cookbooks/preinstalled-software/README.md).
## GCP Windows image for development ## GCP Windows image for development
@ -57,7 +57,7 @@ Build a Google Cloud image with the above shared runners repository by doing the
1. Clone the repository <https://github.com/rgl/packer-provisioner-windows-update> and `cd` into the cloned directory. 1. Clone the repository <https://github.com/rgl/packer-provisioner-windows-update> and `cd` into the cloned directory.
1. Run the command `go build -o packer-provisioner-windows-update` (requires `go` to be installed). 1. Run the command `go build -o packer-provisioner-windows-update` (requires `go` to be installed).
1. Verify `packer-provisioner-windows-update` is in the `PATH` environment variable. 1. Verify `packer-provisioner-windows-update` is in the `PATH` environment variable.
1. Add all [required environment variables](https://gitlab.com/gitlab-org/ci-cd/shared-runners/images/gcp/windows-containers/-/blob/master/packer.json#L2-10) 1. Add all [required environment variables](https://gitlab.com/gitlab-org/ci-cd/shared-runners/images/gcp/windows-containers/-/blob/main/packer.json#L2-10)
in the `packer.json` file to your environment (perhaps use [`direnv`](https://direnv.net/)). in the `packer.json` file to your environment (perhaps use [`direnv`](https://direnv.net/)).
1. Build the image by running the command: `packer build packer.json`. 1. Build the image by running the command: `packer build packer.json`.

View file

@ -40,10 +40,6 @@ module Gitlab
}, },
invite_members_new_dropdown: { invite_members_new_dropdown: {
tracking_category: 'Growth::Expansion::Experiment::InviteMembersNewDropdown' tracking_category: 'Growth::Expansion::Experiment::InviteMembersNewDropdown'
},
show_trial_status_in_sidebar: {
tracking_category: 'Growth::Conversion::Experiment::ShowTrialStatusInSidebar',
rollout_strategy: :group
} }
}.freeze }.freeze

View file

@ -46,21 +46,14 @@ class GithubImport
def import! def import!
@project.import_state.force_start @project.import_state.force_start
import_success = false
timings = Benchmark.measure do timings = Benchmark.measure do
import_success = Gitlab::GithubImport::SequentialImporter Gitlab::GithubImport::SequentialImporter
.new(@project, token: @options[:token]) .new(@project, token: @options[:token])
.execute .execute
end end
if import_success
@project.after_import @project.after_import
puts "Import finished. Timings: #{timings}".color(:green) puts "Import finished. Timings: #{timings}".color(:green)
else
puts "Import was not successful. Errors were as follows:"
puts @project.import_state.last_error
end
end end
def new_project def new_project

View file

@ -9,7 +9,8 @@ module QA
element :directory_name_link element :directory_name_link
end end
def go_to_directory(name) def go_to_directory(name, retry_attempts = 1)
retry_on_exception(max_attempts: retry_attempts, reload: true, sleep_interval: 10) do
click_element(:directory_name_link, directory_name: name) click_element(:directory_name_link, directory_name: name)
end end
end end
@ -17,3 +18,4 @@ module QA
end end
end end
end end
end

View file

@ -109,18 +109,14 @@ function rspec_paralellized_job() {
local test_level="${job_name[1]}" local test_level="${job_name[1]}"
local report_name=$(echo "${CI_JOB_NAME}" | sed -E 's|[/ ]|_|g') # e.g. 'rspec unit pg12 1/24' would become 'rspec_unit_pg12_1_24' local report_name=$(echo "${CI_JOB_NAME}" | sed -E 's|[/ ]|_|g') # e.g. 'rspec unit pg12 1/24' would become 'rspec_unit_pg12_1_24'
local rspec_opts="${1}" local rspec_opts="${1}"
local spec_folder_prefixes="" local spec_folder_prefix=""
if [[ "${test_tool}" =~ "-ee" ]]; then if [[ "${test_tool}" =~ "-ee" ]]; then
spec_folder_prefixes="'ee/'" spec_folder_prefix="ee/"
fi fi
if [[ "${test_tool}" =~ "-jh" ]]; then if [[ "${test_tool}" =~ "-jh" ]]; then
spec_folder_prefixes="'jh/'" spec_folder_prefix="jh/"
fi
if [[ "${test_tool}" =~ "-all" ]]; then
spec_folder_prefixes="['', 'ee/']"
fi fi
export KNAPSACK_LOG_LEVEL="debug" export KNAPSACK_LOG_LEVEL="debug"
@ -135,7 +131,7 @@ function rspec_paralellized_job() {
cp "${KNAPSACK_RSPEC_SUITE_REPORT_PATH}" "${KNAPSACK_REPORT_PATH}" cp "${KNAPSACK_RSPEC_SUITE_REPORT_PATH}" "${KNAPSACK_REPORT_PATH}"
if [[ -z "${KNAPSACK_TEST_FILE_PATTERN}" ]]; then if [[ -z "${KNAPSACK_TEST_FILE_PATTERN}" ]]; then
pattern=$(ruby -r./tooling/quality/test_level.rb -e "puts Quality::TestLevel.new(${spec_folder_prefixes}).pattern(:${test_level})") pattern=$(ruby -r./tooling/quality/test_level.rb -e "puts Quality::TestLevel.new(%(${spec_folder_prefix})).pattern(:${test_level})")
export KNAPSACK_TEST_FILE_PATTERN="${pattern}" export KNAPSACK_TEST_FILE_PATTERN="${pattern}"
fi fi

View file

@ -1,16 +1,14 @@
import { GlTable, GlLink, GlPagination } from '@gitlab/ui'; import { GlTable, GlLink, GlPagination, GlAlert } from '@gitlab/ui';
import * as Sentry from '@sentry/browser';
import { shallowMount, mount } from '@vue/test-utils'; import { shallowMount, mount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import { DEFAULT_PER_PAGE } from '~/api'; import { DEFAULT_PER_PAGE } from '~/api';
import createFlash from '~/flash';
import IntegrationOverrides from '~/integrations/overrides/components/integration_overrides.vue'; import IntegrationOverrides from '~/integrations/overrides/components/integration_overrides.vue';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import httpStatus from '~/lib/utils/http_status'; import httpStatus from '~/lib/utils/http_status';
import ProjectAvatar from '~/vue_shared/components/project_avatar.vue'; import ProjectAvatar from '~/vue_shared/components/project_avatar.vue';
jest.mock('~/flash');
const mockOverrides = Array(DEFAULT_PER_PAGE * 3) const mockOverrides = Array(DEFAULT_PER_PAGE * 3)
.fill(1) .fill(1)
.map((_, index) => ({ .map((_, index) => ({
@ -62,6 +60,7 @@ describe('IntegrationOverrides', () => {
text: link.text(), text: link.text(),
}; };
}); });
const findAlert = () => wrapper.findComponent(GlAlert);
describe('while loading', () => { describe('while loading', () => {
it('sets GlTable `busy` attribute to `true`', () => { it('sets GlTable `busy` attribute to `true`', () => {
@ -104,18 +103,26 @@ describe('IntegrationOverrides', () => {
describe('when request fails', () => { describe('when request fails', () => {
beforeEach(async () => { beforeEach(async () => {
jest.spyOn(Sentry, 'captureException');
mockAxios.onGet(defaultProps.overridesPath).reply(httpStatus.INTERNAL_SERVER_ERROR); mockAxios.onGet(defaultProps.overridesPath).reply(httpStatus.INTERNAL_SERVER_ERROR);
createComponent(); createComponent();
await waitForPromises(); await waitForPromises();
}); });
it('calls createFlash', () => { it('displays error alert', () => {
expect(createFlash).toHaveBeenCalledTimes(1); const alert = findAlert();
expect(createFlash).toHaveBeenCalledWith({ expect(alert.exists()).toBe(true);
message: IntegrationOverrides.i18n.defaultErrorMessage, expect(alert.text()).toBe(IntegrationOverrides.i18n.defaultErrorMessage);
captureError: true,
error: expect.any(Error),
}); });
it('hides overrides table', () => {
const table = findGlTable();
expect(table.exists()).toBe(false);
});
it('captures exception in Sentry', () => {
expect(Sentry.captureException).toHaveBeenCalledWith(expect.any(Error));
}); });
}); });

View file

@ -16,20 +16,20 @@ describe('MR widget extensions status icon', () => {
}); });
it('renders loading icon', () => { it('renders loading icon', () => {
factory({ name: 'test', isLoading: true, iconName: 'status-failed' }); factory({ name: 'test', isLoading: true, iconName: 'failed' });
expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(true); expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(true);
}); });
it('renders status icon', () => { it('renders status icon', () => {
factory({ name: 'test', isLoading: false, iconName: 'status-failed' }); factory({ name: 'test', isLoading: false, iconName: 'failed' });
expect(wrapper.findComponent(GlIcon).exists()).toBe(true); expect(wrapper.findComponent(GlIcon).exists()).toBe(true);
expect(wrapper.findComponent(GlIcon).props('name')).toBe('status-failed'); expect(wrapper.findComponent(GlIcon).props('name')).toBe('status-failed');
}); });
it('sets aria-label for status icon', () => { it('sets aria-label for status icon', () => {
factory({ name: 'test', isLoading: false, iconName: 'status-failed' }); factory({ name: 'test', isLoading: false, iconName: 'failed' });
expect(wrapper.findComponent(GlIcon).props('ariaLabel')).toBe('Failed test'); expect(wrapper.findComponent(GlIcon).props('ariaLabel')).toBe('Failed test');
}); });

View file

@ -919,7 +919,7 @@ describe('MrWidgetOptions', () => {
// Renders icon in the row // Renders icon in the row
expect(collapsedSection.find(GlIcon).exists()).toBe(true); expect(collapsedSection.find(GlIcon).exists()).toBe(true);
expect(collapsedSection.find(GlIcon).props('name')).toBe('status_failed_borderless'); expect(collapsedSection.find(GlIcon).props('name')).toBe('status-failed');
// Renders badge in the row // Renders badge in the row
expect(collapsedSection.find(GlBadge).exists()).toBe(true); expect(collapsedSection.find(GlBadge).exists()).toBe(true);

View file

@ -21,8 +21,7 @@ export default {
id: 1, id: 1,
text: 'Hello world', text: 'Hello world',
icon: { icon: {
name: 'status_failed_borderless', name: EXTENSION_ICONS.failed,
class: 'text-danger',
}, },
badge: { badge: {
text: 'Closed', text: 'Closed',

View file

@ -63,14 +63,7 @@ RSpec.describe Quality::TestLevel do
context 'with a prefix' do context 'with a prefix' do
it 'returns a pattern' do it 'returns a pattern' do
expect(described_class.new('ee/').pattern(:system)) expect(described_class.new('ee/').pattern(:system))
.to eq("{ee/}spec/{features}{,/**/}*_spec.rb") .to eq("ee/spec/{features}{,/**/}*_spec.rb")
end
end
context 'with several prefixes' do
it 'returns a pattern' do
expect(described_class.new(['', 'ee/', 'jh/']).pattern(:system))
.to eq("{,ee/,jh/}spec/{features}{,/**/}*_spec.rb")
end end
end end
@ -145,14 +138,7 @@ RSpec.describe Quality::TestLevel do
context 'with a prefix' do context 'with a prefix' do
it 'returns a regexp' do it 'returns a regexp' do
expect(described_class.new('ee/').regexp(:system)) expect(described_class.new('ee/').regexp(:system))
.to eq(%r{(ee/)spec/(features)}) .to eq(%r{ee/spec/(features)})
end
end
context 'with several prefixes' do
it 'returns a regexp' do
expect(described_class.new(['', 'ee/', 'jh/']).regexp(:system))
.to eq(%r{(|ee/|jh/)spec/(features)})
end end
end end

View file

@ -60,20 +60,20 @@ module Quality
system: ['features'] system: ['features']
}.freeze }.freeze
attr_reader :prefixes attr_reader :prefix
def initialize(prefixes = nil) def initialize(prefix = nil)
@prefixes = Array(prefixes) @prefix = prefix
@patterns = {} @patterns = {}
@regexps = {} @regexps = {}
end end
def pattern(level) def pattern(level)
@patterns[level] ||= "#{prefixes_for_pattern}spec/#{folders_pattern(level)}{,/**/}*#{suffix(level)}" @patterns[level] ||= "#{prefix}spec/#{folders_pattern(level)}{,/**/}*#{suffix(level)}"
end end
def regexp(level) def regexp(level)
@regexps[level] ||= Regexp.new("#{prefixes_for_regex}spec/#{folders_regex(level)}").freeze @regexps[level] ||= Regexp.new("#{prefix}spec/#{folders_regex(level)}").freeze
end end
def level_for(file_path) def level_for(file_path)
@ -102,20 +102,6 @@ module Quality
private private
def prefixes_for_pattern
return '' if prefixes.empty?
"{#{prefixes.join(',')}}"
end
def prefixes_for_regex
return '' if prefixes.empty?
regex_prefix = prefixes.map(&Regexp.method(:escape)).join('|')
"(#{regex_prefix})"
end
def suffix(level) def suffix(level)
case level case level
when :frontend_fixture when :frontend_fixture