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

Add latest changes from gitlab-org/gitlab@master

parent 1d388ed8
No related branches found
No related tags found
No related merge requests found
Showing
with 150 additions and 180 deletions
Loading
Loading
@@ -6,7 +6,7 @@ type: reference
 
GitLab protects the following paths with Rack Attack by default:
 
```
```plaintext
'/users/password',
'/users/sign_in',
'/api/#{API::API.version}/session.json',
Loading
Loading
@@ -23,7 +23,7 @@ that exceed 10 requests per minute per IP address.
 
This header is included in responses to blocked requests:
 
```
```plaintext
Retry-After: 60
```
 
Loading
Loading
Loading
Loading
@@ -213,7 +213,7 @@ An approval will be optional when a license report:
When including a security job template like [`SAST`](sast/index.md#configuration),
the following error can be raised, depending on your GitLab CI/CD configuration:
 
```
```plaintext
Found errors in your .gitlab-ci.yml:
 
* sast job: stage parameter should be unit-tests
Loading
Loading
Loading
Loading
@@ -27,7 +27,7 @@ that the IP address of the pods are routable within the GCP network.
 
First, we need to declare some environment variables with configuration that will be used throughout this guide:
 
```sh
```shell
export PROJECT_ID=crossplane-playground # the GCP project where all resources reside.
export NETWORK_NAME=default # the GCP network where your GKE is provisioned.
export REGION=us-central1 # the GCP region where the GKE cluster is provisioned.
Loading
Loading
@@ -43,7 +43,7 @@ NOTE: **Note:**
For a non-GitLab managed cluster, ensure that the service account for the token provided can manage resources in the `database.crossplane.io` API group.
​1. Save the following YAML as `crossplane-database-role.yaml`:
 
```sh
```shell
cat > crossplane-database-role.yaml <<EOF
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Loading
Loading
@@ -69,7 +69,7 @@ EOF
 
Once the file is created, apply it with the following command in order to create the necessary role:
 
```sh
```shell
kubectl apply -f crossplane-database-role.yaml
```
 
Loading
Loading
@@ -94,7 +94,7 @@ This can done by either:
[configuring private services access](https://cloud.google.com/vpc/docs/configure-private-services-access).
Create a GlobalAddress and Connection resources:
 
```sh
```shell
cat > network.yaml <<EOF
---
# gitlab-ad-globaladdress defines the IP range that will be allocated for cloud services connecting to the instances in the given Network.
Loading
Loading
@@ -133,14 +133,14 @@ EOF
 
Apply the settings specified in the file with the following command:
 
```sh
```shell
kubectl apply -f network.yaml
```
 
You can verify creation of the network resources with the following commands.
Verify that the status of both of these resources is ready and is synced.
 
```sh
```shell
kubectl describe connection.servicenetworking.gcp.crossplane.io gitlab-ad-connection
kubectl describe globaladdress.compute.gcp.crossplane.io gitlab-ad-globaladdress
```
Loading
Loading
@@ -154,7 +154,7 @@ Resource classes are a way of defining a configuration for the required managed
1. A default CloudSQLInstanceClass.
1. A CloudSQLInstanceClass with labels.
 
```sh
```shell
cat > gcp-postgres-standard.yaml <<EOF
apiVersion: database.gcp.crossplane.io/v1beta1
kind: CloudSQLInstanceClass
Loading
Loading
@@ -204,13 +204,13 @@ EOF
 
Apply the resource class configuration with the following command:
 
```sh
```shell
kubectl apply -f gcp-postgres-standard.yaml
```
 
Verify creation of the Resource class with the following command:
 
```sh
```shell
kubectl get cloudsqlinstanceclasses
```
 
Loading
Loading
@@ -239,13 +239,13 @@ The Auto DevOps pipeline should provision a PostgresqlInstance when it runs succ
 
Verify creation of the PostgreSQL Instance.
 
```sh
```shell
kubectl get postgresqlinstance
```
 
Sample Output: The `STATUS` field of the PostgresqlInstance transitions to `BOUND` when it is successfully provisioned.
 
```
```plaintext
NAME STATUS CLASS-KIND CLASS-NAME RESOURCE-KIND RESOURCE-NAME AGE
staging-test8 Bound CloudSQLInstanceClass cloudsqlinstancepostgresql-standard CloudSQLInstance xp-ad-demo-24-staging-staging-test8-jj55c 9m
```
Loading
Loading
@@ -254,13 +254,13 @@ The endpoint of the PostgreSQL instance, and the user credentials, are present i
 
Verify the secret with the database information is created with the following command:
 
```sh
```shell
kubectl describe secret app-postgres
```
 
Sample Output:
 
```
```plaintext
Name: app-postgres
Namespace: xp-ad-demo-24-staging
Labels: <none>
Loading
Loading
Loading
Loading
@@ -89,7 +89,7 @@ When a merge request has a large number of comments it can be difficult to track
what remains unresolved. You can jump between unresolved threads with the
Jump button next to the Reply field on a thread.
 
You can also jump to the first unresolved thread from the button next to the
You can also jump to the next unresolved thread from the button next to the
resolved threads tracker.
 
You can also use keyboard shortcuts to navigate among threads:
Loading
Loading
Loading
Loading
@@ -19,7 +19,7 @@ Below are the fingerprints for GitLab.com's SSH host keys.
Add the following to `.ssh/known_hosts` to skip manual fingerprint
confirmation in SSH:
 
```
```plaintext
gitlab.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAfuCHKVTjquxvt6CM6tdG4SLp1Btn/nOeHHE5UOzRdf
gitlab.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsj2bNKTBSpIYDEGk9KxsGh3mySTRgMtXL583qmBpzeQ+jqCMRgBqB98u3z++J1sKlXHWfM9dyhSevkMwSbhoR8XIq/U0tCNyokEi/ueaBMCvbcTHhO7FcwzY92WK4Yt0aGROY5qX2UKSeOvuP4D6TPqKF1onrSzH9bx9XUf2lEdWT/ia1NEKjunUqu1xOB/StKDHMoX4/OKyIzuS0q/T1zOATthvasJFoPrAjkohTyaDUz2LN5JoH839hViyEG82yB+MjcFV5MU3N1l1QL3cVUCh93xSaua1N85qivl+siMkPGbO5xR/En4iEY6K2XPASUEMaieWVNTRCtJ4S8H+9
gitlab.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY=
Loading
Loading
@@ -41,7 +41,7 @@ GitLab.com can be reached via a [different SSH port][altssh] for `git+ssh`.
 
An example `~/.ssh/config` is the following:
 
```
```plaintext
Host gitlab.com
Hostname altssh.gitlab.com
User git
Loading
Loading
@@ -455,7 +455,7 @@ per second per IP address.
 
The following example headers are included for all API requests:
 
```
```plaintext
RateLimit-Limit: 600
RateLimit-Observed: 6
RateLimit-Remaining: 594
Loading
Loading
@@ -481,7 +481,7 @@ user confirmation, user sign in, and password reset.
 
This header is included in responses to blocked requests:
 
```
```plaintext
Retry-After: 60
```
 
Loading
Loading
Loading
Loading
@@ -102,7 +102,7 @@ Learn how to set up GitLab CI/CD for specific use cases.
 
Supposed your repository contained the following files:
 
```
```plaintext
├── index.html
├── css
│ └── main.css
Loading
Loading
@@ -144,7 +144,7 @@ orphan branch (let's name it `pages`) that will host your static generator site.
 
You can create a new empty branch like this:
 
```bash
```shell
git checkout --orphan pages
```
 
Loading
Loading
@@ -155,7 +155,7 @@ commits. Push the source files of your static generator in the `pages` branch.
Below is a copy of `.gitlab-ci.yml` where the most significant line is the last
one, specifying to execute everything in the `pages` branch:
 
```
```yaml
image: ruby:2.6
 
pages:
Loading
Loading
@@ -188,7 +188,7 @@ compressed files, it will serve that version instead of the uncompressed one.
To take advantage of this feature, the artifact you upload to the Pages should
have this structure:
 
```
```plaintext
public/
├─┬ index.html
│ └ index.html.gz
Loading
Loading
@@ -226,7 +226,7 @@ request for a URL that does not include an extension.
 
Consider a Pages site deployed with the following files:
 
```
```plaintext
public/
├─┬ index.html
│ ├ data.html
Loading
Loading
Loading
Loading
@@ -113,13 +113,13 @@ Artifacts for other pipelines can be accessed with direct access to them.
 
The structure of the URL to download the whole artifacts archive is the following:
 
```
```plaintext
https://example.com/<namespace>/<project>/-/jobs/artifacts/<ref>/download?job=<job_name>
```
 
To download a single file from the artifacts use the following URL:
 
```
```plaintext
https://example.com/<namespace>/<project>/-/jobs/artifacts/<ref>/raw/<path_to_file>?job=<job_name>
```
 
Loading
Loading
@@ -127,40 +127,40 @@ For example, to download the latest artifacts of the job named `coverage` of
the `master` branch of the `gitlab` project that belongs to the `gitlab-org`
namespace, the URL would be:
 
```
```plaintext
https://gitlab.com/gitlab-org/gitlab/-/jobs/artifacts/master/download?job=coverage
```
 
To download the file `coverage/index.html` from the same
artifacts use the following URL:
 
```
```plaintext
https://gitlab.com/gitlab-org/gitlab/-/jobs/artifacts/master/raw/coverage/index.html?job=coverage
```
 
There is also a URL to browse the latest job artifacts:
 
```
```plaintext
https://example.com/<namespace>/<project>/-/jobs/artifacts/<ref>/browse?job=<job_name>
```
 
For example:
 
```
```plaintext
https://gitlab.com/gitlab-org/gitlab/-/jobs/artifacts/master/browse?job=coverage
```
 
There is also a URL to specific files, including html files that
are shown in [GitLab Pages](../../../administration/pages/index.md):
 
```
```plaintext
https://example.com/<namespace>/<project>/-/jobs/artifacts/<ref>/file/<path>?job=<job_name>
```
 
For example, when a job `coverage` creates the artifact `htmlcov/index.html`,
you can access it at:
 
```
```plaintext
https://gitlab.com/gitlab-org/gitlab/-/jobs/artifacts/master/file/htmlcov/index.html?job=coverage
```
 
Loading
Loading
Loading
Loading
@@ -46,7 +46,7 @@ started:
1. Generate the private/public key pair with the following command, which will
spawn a series of questions:
 
```sh
```shell
gpg --full-gen-key
```
 
Loading
Loading
@@ -57,7 +57,7 @@ started:
1. The first question is which algorithm can be used. Select the kind you want
or press <kbd>Enter</kbd> to choose the default (RSA and RSA):
 
```
```plaintext
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
Loading
Loading
@@ -68,7 +68,7 @@ started:
 
1. The next question is key length. We recommend you choose `4096`:
 
```
```plaintext
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 4096
Requested keysize is 4096 bits
Loading
Loading
@@ -77,7 +77,7 @@ started:
1. Specify the validity period of your key. This is something
subjective, and you can use the default value, which is to never expire:
 
```
```plaintext
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
Loading
Loading
@@ -90,7 +90,7 @@ started:
 
1. Confirm that the answers you gave were correct by typing `y`:
 
```
```plaintext
Is this correct? (y/N) y
```
 
Loading
Loading
@@ -98,7 +98,7 @@ started:
(should match a verified email address you use in GitLab) and an optional
comment (press <kbd>Enter</kbd> to skip):
 
```
```plaintext
GnuPG needs to construct a user ID to identify your key.
 
Real name: Mr. Robot
Loading
Loading
@@ -113,7 +113,7 @@ started:
1. Pick a strong password when asked and type it twice to confirm.
1. Use the following command to list the private GPG key you just created:
 
```
```shell
gpg --list-secret-keys --keyid-format LONG <your_email>
```
 
Loading
Loading
@@ -122,7 +122,7 @@ started:
1. Copy the GPG key ID that starts with `sec`. In the following example, that's
`30F2B65B9246B6CA`:
 
```
```plaintext
sec rsa4096/30F2B65B9246B6CA 2017-08-18 [SC]
D5E4F29F3275DC0CDA8FFC8730F2B65B9246B6CA
uid [ultimate] Mr. Robot <your_email>
Loading
Loading
@@ -131,7 +131,7 @@ started:
 
1. Export the public key of that ID (replace your key ID from the previous step):
 
```
```shell
gpg --armor --export 30F2B65B9246B6CA
```
 
Loading
Loading
@@ -167,7 +167,7 @@ key to use.
 
1. Use the following command to list the private GPG key you just created:
 
```sh
```shell
gpg --list-secret-keys --keyid-format LONG <your_email>
```
 
Loading
Loading
@@ -176,7 +176,7 @@ key to use.
1. Copy the GPG key ID that starts with `sec`. In the following example, that's
`30F2B65B9246B6CA`:
 
```
```plaintext
sec rsa4096/30F2B65B9246B6CA 2017-08-18 [SC]
D5E4F29F3275DC0CDA8FFC8730F2B65B9246B6CA
uid [ultimate] Mr. Robot <your_email>
Loading
Loading
@@ -185,7 +185,7 @@ key to use.
 
1. Tell Git to use that key to sign the commits:
 
```sh
```shell
git config --global user.signingkey 30F2B65B9246B6CA
```
 
Loading
Loading
@@ -195,7 +195,7 @@ key to use.
or `gpg: signing failed: secret key not available`, run the following command to
change to `gpg2`:
 
```sh
```shell
git config --global gpg.program gpg2
```
 
Loading
Loading
@@ -207,7 +207,7 @@ commits:
 
1. Commit like you used to, the only difference is the addition of the `-S` flag:
 
```
```shell
git commit -S -m "My commit msg"
```
 
Loading
Loading
@@ -217,7 +217,7 @@ commits:
If you don't want to type the `-S` flag every time you commit, you can tell Git
to sign your commits automatically:
 
```
```shell
git config --global commit.gpgsign true
```
 
Loading
Loading
Loading
Loading
@@ -60,26 +60,26 @@ removed from the repository.
 
1. Navigate to your repository:
 
```
```shell
cd my_repository/
```
 
1. Change to the branch you want to remove the big file from:
 
```
```shell
git checkout master
```
 
1. Create a commit removing the large file from the branch, if it still exists:
 
```
```shell
git rm path/to/big_file.mpg
git commit -m 'Remove unneeded large file'
```
 
1. Rewrite history:
 
```
```shell
bfg --delete-files path/to/big_file.mpg
```
 
Loading
Loading
@@ -88,7 +88,7 @@ removed from the repository.
 
1. Force-push the changes to GitLab:
 
```
```shell
git push --force-with-lease origin master
```
 
Loading
Loading
@@ -116,31 +116,31 @@ purposes!
 
1. Navigate to your repository:
 
```
```shell
cd my_repository/
```
 
1. Change to the branch you want to remove the big file from:
 
```
```shell
git checkout master
```
 
1. Use `filter-branch` to remove the big file:
 
```
```shell
git filter-branch --force --tree-filter 'rm -f path/to/big_file.mpg' HEAD
```
 
1. Instruct Git to purge the unwanted data:
 
```
```shell
git reflog expire --expire=now --all && git gc --prune=now --aggressive
```
 
1. Lastly, force push to the repository:
 
```
```shell
git push --force origin master
```
 
Loading
Loading
Loading
Loading
@@ -10770,10 +10770,10 @@ msgstr ""
msgid "July"
msgstr ""
 
msgid "Jump to first unresolved discussion"
msgid "Jump to first unresolved thread"
msgstr ""
 
msgid "Jump to next unresolved discussion"
msgid "Jump to next unresolved thread"
msgstr ""
 
msgid "Jun"
Loading
Loading
@@ -11787,7 +11787,7 @@ msgstr ""
msgid "MergeRequests|Failed to squash. Should be done manually."
msgstr ""
 
msgid "MergeRequests|Jump to next unresolved discussion"
msgid "MergeRequests|Jump to next unresolved thread"
msgstr ""
 
msgid "MergeRequests|Reply..."
Loading
Loading
Loading
Loading
@@ -3,10 +3,13 @@
module QA
module Resource
class ProjectMilestone < Base
attribute :id
attribute :title
 
attribute :project do
Project.fabricate!
Project.fabricate_via_api! do |resource|
resource.name = 'project-with-milestone'
end
end
 
def initialize
Loading
Loading
Loading
Loading
@@ -4,93 +4,49 @@ require 'pathname'
 
module QA
context 'Configure' do
def disable_optional_jobs(project)
# Disable code_quality check in Auto DevOps pipeline as it takes
# too long and times out the test
Resource::CiVariable.fabricate_via_api! do |resource|
resource.project = project
resource.key = 'CODE_QUALITY_DISABLED'
resource.value = '1'
resource.masked = false
end
Resource::CiVariable.fabricate_via_api! do |resource|
resource.project = project
resource.key = 'LICENSE_MANAGEMENT_DISABLED'
resource.value = '1'
resource.masked = false
end
Resource::CiVariable.fabricate_via_api! do |resource|
resource.project = project
resource.key = 'SAST_DISABLED'
resource.value = '1'
resource.masked = false
end
Resource::CiVariable.fabricate_via_api! do |resource|
resource.project = project
resource.key = 'DEPENDENCY_SCANNING_DISABLED'
resource.value = '1'
resource.masked = false
end
Resource::CiVariable.fabricate_via_api! do |resource|
resource.project = project
resource.key = 'CONTAINER_SCANNING_DISABLED'
resource.value = '1'
resource.masked = false
let(:project) do
Resource::Project.fabricate_via_api! do |p|
p.name = Runtime::Env.auto_devops_project_name || 'autodevops-project'
p.auto_devops_enabled = true
end
end
 
Resource::CiVariable.fabricate_via_api! do |resource|
resource.project = project
resource.key = 'DAST_DISABLED'
resource.value = '1'
resource.masked = false
end
before do
disable_optional_jobs(project)
end
 
describe 'Auto DevOps support', :orchestrated, :kubernetes, quarantine: 'https://gitlab.com/gitlab-org/gitlab/issues/118481' do
context 'when rbac is enabled' do
before(:all) do
@cluster = Service::KubernetesCluster.new.create!
end
let(:cluster) { Service::KubernetesCluster.new.create! }
 
after(:all) do
@cluster&.remove!
after do
cluster&.remove!
end
 
it 'runs auto devops' do
Flow::Login.sign_in
 
@project = Resource::Project.fabricate! do |p|
p.name = Runtime::Env.auto_devops_project_name || 'project-with-autodevops'
p.description = 'Project with Auto DevOps'
end
disable_optional_jobs(@project)
# Set an application secret CI variable (prefixed with K8S_SECRET_)
Resource::CiVariable.fabricate! do |resource|
resource.project = @project
resource.project = project
resource.key = 'K8S_SECRET_OPTIONAL_MESSAGE'
resource.value = 'you_can_see_this_variable'
resource.masked = false
end
 
# Connect K8s cluster
Resource::KubernetesCluster.fabricate! do |cluster|
cluster.project = @project
cluster.cluster = @cluster
cluster.install_helm_tiller = true
cluster.install_ingress = true
cluster.install_prometheus = true
cluster.install_runner = true
Resource::KubernetesCluster.fabricate! do |k8s_cluster|
k8s_cluster.project = project
k8s_cluster.cluster = cluster
k8s_cluster.install_helm_tiller = true
k8s_cluster.install_ingress = true
k8s_cluster.install_prometheus = true
k8s_cluster.install_runner = true
end
 
# Create Auto DevOps compatible repo
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = @project
push.project = project
push.directory = Pathname
.new(__dir__)
.join('../../../../../fixtures/auto_devops_rack')
Loading
Loading
@@ -145,20 +101,15 @@ module QA
before do
Flow::Login.sign_in
 
@project = Resource::Project.fabricate_via_browser_ui! do |p|
p.name = "project-with-autodevops-#{SecureRandom.hex(8)}"
p.description = 'Project with AutoDevOps'
end
project.visit!
 
Page::Project::Menu.perform(&:go_to_ci_cd_settings)
Page::Project::Settings::CICD.perform(&:expand_auto_devops)
Page::Project::Settings::AutoDevops.perform(&:enable_autodevops)
 
@project.visit!
# Create AutoDevOps repo
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = @project
push.project = project
push.directory = Pathname
.new(__dir__)
.join('../../../../../fixtures/auto_devops_rack')
Loading
Loading
@@ -175,5 +126,22 @@ module QA
end
end
end
private
def disable_optional_jobs(project)
%w[
CODE_QUALITY_DISABLED LICENSE_MANAGEMENT_DISABLED
SAST_DISABLED DAST_DISABLED DEPENDENCY_SCANNING_DISABLED
CONTAINER_SCANNING_DISABLED
].each do |key|
Resource::CiVariable.fabricate_via_api! do |resource|
resource.project = project
resource.key = key
resource.value = '1'
resource.masked = false
end
end
end
end
end
Loading
Loading
@@ -368,16 +368,6 @@ describe 'Merge request > User resolves diff notes and threads', :js do
end
end
 
it 'shows jump to next discussion button on all discussions' do
wait_for_requests
all_discussion_replies = page.all('.discussion-reply-holder')
expect(all_discussion_replies.count).to eq(2)
expect(all_discussion_replies.first.all('.discussion-next-btn').count).to eq(1)
expect(all_discussion_replies.last.all('.discussion-next-btn').count).to eq(1)
end
it 'displays next thread even if hidden' do
page.all('.note-discussion', count: 2).each do |discussion|
page.within discussion do
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@ exports[`JumpToNextDiscussionButton matches the snapshot 1`] = `
>
<button
class="btn btn-default discussion-next-btn"
title="Jump to next unresolved discussion"
title="Jump to next unresolved thread"
>
<icon-stub
name="comment-next"
Loading
Loading
Loading
Loading
@@ -120,14 +120,5 @@ describe('DiscussionActions', () => {
.trigger('click');
expect(wrapper.vm.$emit).toHaveBeenCalledWith('resolve');
});
it('emits jumpToNextDiscussion event when clicking on jump to next discussion button', () => {
jest.spyOn(wrapper.vm, '$emit');
wrapper
.find(JumpToNextDiscussionButton)
.find('button')
.trigger('click');
expect(wrapper.vm.$emit).toHaveBeenCalledWith('jumpToNextDiscussion');
});
});
});
Loading
Loading
@@ -15,15 +15,4 @@ describe('JumpToNextDiscussionButton', () => {
it('matches the snapshot', () => {
expect(wrapper.vm.$el).toMatchSnapshot();
});
it('emits onClick event on button click', () => {
const button = wrapper.find({ ref: 'button' });
button.trigger('click');
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().onClick).toBeTruthy();
expect(wrapper.emitted().onClick.length).toBe(1);
});
});
});
Loading
Loading
@@ -53,13 +53,15 @@ describe('notes/components/discussion_keyboard_navigator', () => {
});
 
describe.each`
isDiffView | expectedNextId | expectedPrevId
${true} | ${NEXT_DIFF_ID} | ${PREV_DIFF_ID}
${false} | ${NEXT_ID} | ${PREV_ID}
`('when isDiffView is $isDiffView', ({ isDiffView, expectedNextId, expectedPrevId }) => {
currentAction | expectedNextId | expectedPrevId
${'diffs'} | ${NEXT_DIFF_ID} | ${PREV_DIFF_ID}
${'show'} | ${NEXT_ID} | ${PREV_ID}
`('when isDiffView is $isDiffView', ({ currentAction, expectedNextId, expectedPrevId }) => {
beforeEach(() => {
createComponent({ propsData: { isDiffView } });
window.mrTabs = { currentAction };
createComponent();
});
afterEach(() => delete window.mrTabs);
 
it('calls jumpToNextDiscussion when pressing `n`', () => {
Mousetrap.trigger('n');
Loading
Loading
Loading
Loading
@@ -501,7 +501,6 @@ describe('Notes Store mutations', () => {
expect.objectContaining({
resolvableDiscussionsCount: 1,
unresolvedDiscussionsCount: 1,
hasUnresolvedDiscussions: false,
}),
);
});
Loading
Loading
@@ -538,7 +537,6 @@ describe('Notes Store mutations', () => {
expect.objectContaining({
resolvableDiscussionsCount: 4,
unresolvedDiscussionsCount: 2,
hasUnresolvedDiscussions: true,
}),
);
});
Loading
Loading
Loading
Loading
@@ -22,15 +22,41 @@ describe AvatarsHelper do
end
end
 
context 'when providing a project' do
it_behaves_like 'resource with a default avatar', 'project' do
let(:resource) { create(:project, name: 'foo') }
let(:helper_args) { [resource] }
shared_examples 'Gitaly exception handling' do
before do
allow(resource).to receive(:avatar_url).and_raise(error_class)
end
 
it 'handles Gitaly exception gracefully' do
expect(Gitlab::ErrorTracking).to receive(:track_exception).with(
an_instance_of(error_class), source_type: 'Project', source_id: resource.id
)
expect { project_icon(resource) }.not_to raise_error
end
it_behaves_like 'resource with a default avatar', 'project'
end
context 'when providing a project' do
let(:helper_args) { [resource] }
let(:resource) { create(:project, name: 'foo') }
it_behaves_like 'resource with a default avatar', 'project'
it_behaves_like 'resource with a custom avatar', 'project' do
let(:resource) { create(:project, :public, avatar: File.open(uploaded_image_temp_path)) }
let(:helper_args) { [resource] }
end
context 'when Gitaly is unavailable' do
let(:error_class) { GRPC::Unavailable }
include_examples 'Gitaly exception handling'
end
context 'when Gitaly request is taking too long' do
let(:error_class) { GRPC::DeadlineExceeded }
include_examples 'Gitaly exception handling'
end
end
 
Loading
Loading
Loading
Loading
@@ -7,6 +7,7 @@ import { noteableDataMock, discussionMock, notesDataMock } from '../mock_data';
describe('DiscussionCounter component', () => {
let store;
let vm;
const notes = { currentDiscussionId: null };
 
beforeEach(() => {
window.mrTabs = {};
Loading
Loading
@@ -25,7 +26,7 @@ describe('DiscussionCounter component', () => {
});
 
describe('methods', () => {
describe('jumpToFirstUnresolvedDiscussion', () => {
describe('jumpToNextDiscussion', () => {
it('expands unresolved discussion', () => {
window.mrTabs.currentAction = 'show';
 
Loading
Loading
@@ -48,13 +49,14 @@ describe('DiscussionCounter component', () => {
store.replaceState({
...store.state,
discussions,
notes,
});
vm.jumpToFirstUnresolvedDiscussion();
vm.jumpToNextDiscussion();
 
expect(vm.expandDiscussion).toHaveBeenCalledWith({ discussionId: firstDiscussionId });
});
 
it('jumps to first unresolved discussion from diff tab if all diff discussions are resolved', () => {
it('jumps to next unresolved discussion from diff tab if all diff discussions are resolved', () => {
window.mrTabs.currentAction = 'diff';
spyOn(vm, 'switchToDiscussionsTabAndJumpTo').and.stub();
 
Loading
Loading
@@ -77,8 +79,9 @@ describe('DiscussionCounter component', () => {
store.replaceState({
...store.state,
discussions,
notes,
});
vm.jumpToFirstUnresolvedDiscussion();
vm.jumpToNextDiscussion();
 
expect(vm.switchToDiscussionsTabAndJumpTo).toHaveBeenCalledWith(unresolvedId);
});
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