summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/clusters/platforms/kubernetes.rb20
-rw-r--r--app/models/error_tracking/project_error_tracking_setting.rb10
-rw-r--r--app/services/error_tracking/issue_details_service.rb25
-rw-r--r--app/services/error_tracking/issue_update_service.rb18
-rw-r--r--changelogs/unreleased/42646-include-issues-created-in-gitlab-on-sentry-error-details-page.yml5
-rw-r--r--doc/user/project/operations/error_tracking.md4
-rw-r--r--doc/user/project/operations/img/error_details_with_issue_v12_8.pngbin0 -> 32459 bytes
-rw-r--r--doc/user/project/releases/img/upcoming_release_v12_7.pngbin0 -> 87736 bytes
-rw-r--r--doc/user/project/releases/index.md23
-rw-r--r--doc/user/project/repository/forking_workflow.md56
-rw-r--r--doc/user/project/repository/img/forking_workflow_fork_button.pngbin25754 -> 27407 bytes
-rw-r--r--doc/user/project/repository/img/forking_workflow_merge_request.pngbin24625 -> 0 bytes
-rw-r--r--doc/user/project/repository/img/forking_workflow_path_taken_error.pngbin21497 -> 0 bytes
-rw-r--r--lib/gitlab/graphql/query_analyzers/recursion_analyzer.rb2
-rwxr-xr-xscripts/lint-conflicts.sh2
-rw-r--r--spec/features/task_lists_spec.rb18
-rw-r--r--spec/fixtures/api/graphql/recursive-introspection.graphql46
-rw-r--r--spec/fixtures/api/graphql/recursive-query-edges-node.graphql23
-rw-r--r--spec/fixtures/api/graphql/recursive-query-nodes.graphql19
-rw-r--r--spec/fixtures/api/graphql/recursive-query.graphql47
-rw-r--r--spec/lib/gitlab/conflict/file_spec.rb146
-rw-r--r--spec/lib/gitlab/git/conflict/parser_spec.rb148
-rw-r--r--spec/models/clusters/platforms/kubernetes_spec.rb8
-rw-r--r--spec/models/error_tracking/project_error_tracking_setting_spec.rb14
-rw-r--r--spec/requests/api/graphql/gitlab_schema_spec.rb45
-rw-r--r--spec/services/error_tracking/issue_details_service_spec.rb14
-rw-r--r--spec/services/error_tracking/issue_update_service_spec.rb10
-rw-r--r--spec/support/helpers/kubernetes_helpers.rb9
-rw-r--r--spec/support/shared_contexts/sentry_error_tracking_shared_context.rb3
29 files changed, 369 insertions, 346 deletions
diff --git a/app/models/clusters/platforms/kubernetes.rb b/app/models/clusters/platforms/kubernetes.rb
index ae720065387..444368d0ef3 100644
--- a/app/models/clusters/platforms/kubernetes.rb
+++ b/app/models/clusters/platforms/kubernetes.rb
@@ -92,7 +92,10 @@ module Clusters
def calculate_reactive_cache_for(environment)
return unless enabled?
- { pods: read_pods(environment.deployment_namespace) }
+ pods = read_pods(environment.deployment_namespace)
+
+ # extract_relevant_pod_data avoids uploading all the pod info into ReactiveCaching
+ { pods: extract_relevant_pod_data(pods) }
end
def terminals(environment, data)
@@ -203,6 +206,21 @@ module Clusters
def nullify_blank_namespace
self.namespace = nil if namespace.blank?
end
+
+ def extract_relevant_pod_data(pods)
+ pods.map do |pod|
+ {
+ 'metadata' => pod.fetch('metadata', {})
+ .slice('name', 'generateName', 'labels', 'annotations', 'creationTimestamp'),
+ 'status' => pod.fetch('status', {}).slice('phase'),
+ 'spec' => {
+ 'containers' => pod.fetch('spec', {})
+ .fetch('containers', [])
+ .map { |c| c.slice('name') }
+ }
+ }
+ end
+ end
end
end
end
diff --git a/app/models/error_tracking/project_error_tracking_setting.rb b/app/models/error_tracking/project_error_tracking_setting.rb
index 5ee6522fb9d..88a2531d649 100644
--- a/app/models/error_tracking/project_error_tracking_setting.rb
+++ b/app/models/error_tracking/project_error_tracking_setting.rb
@@ -128,10 +128,6 @@ module ErrorTracking
end
end
- def expire_issues_cache
- Rails.cache.delete_matched(expand_cache_key('list_issues'))
- end
-
# http://HOST/api/0/projects/ORG/PROJECT
# ->
# http://HOST/ORG/PROJECT
@@ -148,12 +144,6 @@ module ErrorTracking
private
- def expand_cache_key(resource_prefix)
- klass_key = self.class.reactive_cache_key.call(self).join(':')
-
- "#{klass_key}:#{resource_prefix}*"
- end
-
def add_gitlab_issue_details(issue)
issue.gitlab_commit = match_gitlab_commit(issue.first_release_version)
issue.gitlab_commit_path = project_commit_path(project, issue.gitlab_commit) if issue.gitlab_commit
diff --git a/app/services/error_tracking/issue_details_service.rb b/app/services/error_tracking/issue_details_service.rb
index ee6d556518b..0068a9e9b6d 100644
--- a/app/services/error_tracking/issue_details_service.rb
+++ b/app/services/error_tracking/issue_details_service.rb
@@ -2,12 +2,35 @@
module ErrorTracking
class IssueDetailsService < ErrorTracking::BaseService
+ include Gitlab::Routing
+ include Gitlab::Utils::StrongMemoize
+
private
def perform
response = project_error_tracking_setting.issue_details(issue_id: params[:issue_id])
- compose_response(response)
+ compose_response(response) do
+ # The gitlab_issue attribute can contain an absolute GitLab url from the Sentry Client
+ # here we overwrite that in favor of our own data if we have it
+ response[:issue].gitlab_issue = gitlab_issue_url if gitlab_issue_url
+ end
+ end
+
+ def gitlab_issue_url
+ strong_memoize(:gitlab_issue_url) do
+ # Use the absolute url to match the GitLab issue url that the Sentry api provides
+ project_issue_url(project, gitlab_issue.iid) if gitlab_issue
+ end
+ end
+
+ def gitlab_issue
+ strong_memoize(:gitlab_issue) do
+ SentryIssueFinder
+ .new(project, current_user: current_user)
+ .execute(params[:issue_id])
+ &.issue
+ end
end
def parse_response(response)
diff --git a/app/services/error_tracking/issue_update_service.rb b/app/services/error_tracking/issue_update_service.rb
index 904aed27684..e516ac95138 100644
--- a/app/services/error_tracking/issue_update_service.rb
+++ b/app/services/error_tracking/issue_update_service.rb
@@ -2,8 +2,6 @@
module ErrorTracking
class IssueUpdateService < ErrorTracking::BaseService
- include ::Gitlab::Utils::StrongMemoize
-
private
def perform
@@ -14,14 +12,14 @@ module ErrorTracking
compose_response(response) do
response[:closed_issue_iid] = update_related_issue&.iid
- project_error_tracking_setting.expire_issues_cache
end
end
def update_related_issue
- return if related_issue.nil?
+ issue = related_issue
+ return unless issue
- close_and_create_note(related_issue)
+ close_and_create_note(issue)
end
def close_and_create_note(issue)
@@ -45,12 +43,10 @@ module ErrorTracking
end
def related_issue
- strong_memoize(:related_issue) do
- SentryIssueFinder
- .new(project, current_user: current_user)
- .execute(params[:issue_id])
- &.issue
- end
+ SentryIssueFinder
+ .new(project, current_user: current_user)
+ .execute(params[:issue_id])
+ &.issue
end
def resolving?
diff --git a/changelogs/unreleased/42646-include-issues-created-in-gitlab-on-sentry-error-details-page.yml b/changelogs/unreleased/42646-include-issues-created-in-gitlab-on-sentry-error-details-page.yml
new file mode 100644
index 00000000000..a1c8361f2cb
--- /dev/null
+++ b/changelogs/unreleased/42646-include-issues-created-in-gitlab-on-sentry-error-details-page.yml
@@ -0,0 +1,5 @@
+---
+title: Include issues created in GitLab on error tracking details page
+merge_request: 23605
+author:
+type: changed
diff --git a/doc/user/project/operations/error_tracking.md b/doc/user/project/operations/error_tracking.md
index 47b153ddd7e..685fdefe0c6 100644
--- a/doc/user/project/operations/error_tracking.md
+++ b/doc/user/project/operations/error_tracking.md
@@ -61,9 +61,9 @@ By default, a **Create issue** button is displayed:
![Error Details without Issue Link](img/error_details_v12_7.png)
-If you create a GitLab issue from the error, the **Create issue** button will change to a **View issue** button:
+If you create a GitLab issue from the error, the **Create issue** button will change to a **View issue** button and a link to the GitLab issue will surface within the error detail section:
-![Error Details with Issue Link](img/error_details_with_issue_v12_7.png)
+![Error Details with Issue Link](img/error_details_with_issue_v12_8.png)
## Taking Action on errors
diff --git a/doc/user/project/operations/img/error_details_with_issue_v12_8.png b/doc/user/project/operations/img/error_details_with_issue_v12_8.png
new file mode 100644
index 00000000000..0536861b070
--- /dev/null
+++ b/doc/user/project/operations/img/error_details_with_issue_v12_8.png
Binary files differ
diff --git a/doc/user/project/releases/img/upcoming_release_v12_7.png b/doc/user/project/releases/img/upcoming_release_v12_7.png
new file mode 100644
index 00000000000..4ff8fad98f9
--- /dev/null
+++ b/doc/user/project/releases/img/upcoming_release_v12_7.png
Binary files differ
diff --git a/doc/user/project/releases/index.md b/doc/user/project/releases/index.md
index d9eda5cf6a4..04667e2adfe 100644
--- a/doc/user/project/releases/index.md
+++ b/doc/user/project/releases/index.md
@@ -107,6 +107,16 @@ For private projects, the number of Releases is displayed to users with Reporter
[permissions](../../permissions.md#releases-permissions) or higher. For public projects,
it is displayed to every user regardless of their permission level.
+### Upcoming Releases
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/issues/38105) in GitLab 12.1.
+
+A Release may be created ahead of time by specifying a future `released_at` date. Until
+the `released_at` date and time is reached, an **Upcoming Release** badge will appear next to the
+Release tag. Once the `released_at` date and time has passed, the badge is automatically removed.
+
+![An upcoming release](img/upcoming_release_v12_7.png)
+
## Editing a release
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/26016) in GitLab 12.6.
@@ -245,6 +255,19 @@ Please note that Release Evidence's data is collected regardless of this
feature flag, which only enables or disables the display of the data on the
Releases page.
+### Scheduled Evidence creation
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/23697) in GitLab 12.8.
+
+When the `released_at` date and time is not provided, the date and time of Release
+creation is used. The Evidence collection background job is immediately executed.
+
+If a future `released_at` is specified, the Release becomes an **Upcoming Release**. In this
+case, the Evidence is scheduled to be collected at the `released_at` date and time, via a
+background job.
+
+If a past `released_at` is used, no Evidence is collected for the Release.
+
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
diff --git a/doc/user/project/repository/forking_workflow.md b/doc/user/project/repository/forking_workflow.md
index cd23f0bd434..45a32655f96 100644
--- a/doc/user/project/repository/forking_workflow.md
+++ b/doc/user/project/repository/forking_workflow.md
@@ -5,60 +5,56 @@ disqus_identifier: 'https://docs.gitlab.com/ee/workflow/forking_workflow.html'
# Project forking workflow
Forking a project to your own namespace is useful if you have no write
-access to the project you want to contribute to. If you do have write
+access to the project you want to contribute to. Even if you do have write
access or can request it, we recommend working together in the same
repository since it is simpler. See our [GitLab Flow](../../../topics/gitlab_flow.md)
document more information about using branches to work together.
## Creating a fork
-Forking a project is in most cases a two-step process.
+Forking a project is, in most cases, a two-step process.
-1. Click on the fork button located in between the star and clone buttons on the project's home page.
+1. On the project's home page, in the top right, click the **Fork** button.
![Fork button](img/forking_workflow_fork_button.png)
-1. Once you do that, you'll be presented with a screen where you can choose
- the namespace to fork to. Only namespaces (groups and your own
- namespace) where you have write access to, will be shown. Click on the
- namespace to create your fork there.
+1. Click a namespace to fork to. Only namespaces you have Developer and higher [permissions](../../permissions.md) for are shown.
+
+ NOTE: **Note:**
+ The project path must be unique within the namespace.
![Choose namespace](img/forking_workflow_choose_namespace.png)
- **Note:**
- If the namespace you chose to fork the project to has another project with
- the same path name, you will be presented with a warning that the forking
- could not be completed. Try to resolve the error before repeating the forking
- process.
+The fork is created. The permissions you have in the namespace are the permissions you will have in the fork.
+
+CAUTION: **CAUTION:**
+In GitLab 12.6 and later, when project owners [reduce a project's visibility](../../../public_access/public_access.md#reducing-visibility),
+it **removes the relationship** between a project and all its forks.
- ![Path taken error](img/forking_workflow_path_taken_error.png)
+## Repository mirroring
-After the forking is done, you can start working on the newly created
-repository. There, you will have full [Owner](../../permissions.md)
-access, so you can set it up as you please.
+You can use [repository mirroring](repository_mirroring.md) to keep your fork synced with the original repository. You can also use `git remote add upstream` to achieve the same result.
-CAUTION: **CAUTION:**
-From GitLab 12.6 onward, if the [visibility of an upstream project is reduced](../../../public_access/public_access.md#reducing-visibility)
-in any way, the fork relationship with all its forks will be removed.
+The main difference is that with repository mirroring your remote fork will be automatically kept up-to-date.
+
+Without mirroring, to work locally you'll have to user `git pull` to update your local repo with the fork on GitLab. You'll have to fetch locally and push it back to the remote repo to update it.
CAUTION: **Caution:**
-[Repository mirroring](repository_mirroring.md) will help to keep your fork synced with the original repository.
-Before approving a merge request you'll likely to be asked to sync before getting approval, hence automating it is recommend.
+With mirroring, before approving a merge request you'll likely to be asked to sync, hence automating it is recommend.
+
+Read more about [How to keep your fork up to date with its origin](https://about.gitlab.com/blog/2016/12/01/how-to-keep-your-fork-up-to-date-with-its-origin/).
## Merging upstream
-Once you are ready to send your code back to the main project, you need
-to create a merge request. Choose your forked project's main branch as
-the source and the original project's main branch as the destination and
-create the [merge request](../merge_requests/index.md).
+When you are ready to send your code back to the upstream project,
+[create a merge request](../merge_requests/creating_merge_requests.md). For **Source branch**,
+choose your forked project's branch. For **Target branch**, choose the original project's branch.
![Selecting branches](img/forking_workflow_branch_select.png)
-You can then assign the merge request to someone to have them review
-your changes. Upon pressing the 'Submit Merge Request' button, your
-changes will be added to the repository and branch you're merging into.
-
-![New merge request](img/forking_workflow_merge_request.png)
+Then you can add labels, a milestone, and assign the merge request to someone who can review
+your changes. Then click **Submit merge request** to conclude the process. When successfully merged, your
+changes are added to the repository and branch you're merging into.
## Removing a fork relationship
diff --git a/doc/user/project/repository/img/forking_workflow_fork_button.png b/doc/user/project/repository/img/forking_workflow_fork_button.png
index 7fb07529b6d..74b68a7e61c 100644
--- a/doc/user/project/repository/img/forking_workflow_fork_button.png
+++ b/doc/user/project/repository/img/forking_workflow_fork_button.png
Binary files differ
diff --git a/doc/user/project/repository/img/forking_workflow_merge_request.png b/doc/user/project/repository/img/forking_workflow_merge_request.png
deleted file mode 100644
index 43851203f3f..00000000000
--- a/doc/user/project/repository/img/forking_workflow_merge_request.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/repository/img/forking_workflow_path_taken_error.png b/doc/user/project/repository/img/forking_workflow_path_taken_error.png
deleted file mode 100644
index ef62d0ab6a9..00000000000
--- a/doc/user/project/repository/img/forking_workflow_path_taken_error.png
+++ /dev/null
Binary files differ
diff --git a/lib/gitlab/graphql/query_analyzers/recursion_analyzer.rb b/lib/gitlab/graphql/query_analyzers/recursion_analyzer.rb
index ccf9e597307..79a7104a2ff 100644
--- a/lib/gitlab/graphql/query_analyzers/recursion_analyzer.rb
+++ b/lib/gitlab/graphql/query_analyzers/recursion_analyzer.rb
@@ -6,7 +6,7 @@ module Gitlab
module Graphql
module QueryAnalyzers
class RecursionAnalyzer
- IGNORED_FIELDS = %w(node edges ofType).freeze
+ IGNORED_FIELDS = %w(node edges nodes ofType).freeze
RECURSION_THRESHOLD = 2
def initial_value(query)
diff --git a/scripts/lint-conflicts.sh b/scripts/lint-conflicts.sh
index 2d04507f81e..239e227a41e 100755
--- a/scripts/lint-conflicts.sh
+++ b/scripts/lint-conflicts.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-output=`git grep -En '^<<<<<<< ' -- . ':(exclude)spec/lib/gitlab/conflict/file_spec.rb' ':(exclude)spec/lib/gitlab/git/conflict/parser_spec.rb'`
+output=`git grep -En '^<<<<<<< '`
echo $output
test -z "$output"
diff --git a/spec/features/task_lists_spec.rb b/spec/features/task_lists_spec.rb
index 0d10f6aee3b..24a183017c9 100644
--- a/spec/features/task_lists_spec.rb
+++ b/spec/features/task_lists_spec.rb
@@ -240,28 +240,30 @@ describe 'Task Lists' do
end
shared_examples 'multiple tasks' do
- it 'renders for description' do
+ it 'renders for description', :js do
visit_merge_request(project, merge)
+ wait_for_requests
expect(page).to have_selector('ul.task-list', count: 1)
expect(page).to have_selector('li.task-list-item', count: 6)
expect(page).to have_selector('ul input[checked]', count: 2)
end
- it 'contains the required selectors' do
+ it 'contains the required selectors', :js do
visit_merge_request(project, merge)
+ wait_for_requests
container = '.detail-page-description .description.js-task-list-container'
expect(page).to have_selector(container)
expect(page).to have_selector("#{container} .md .task-list .task-list-item .task-list-item-checkbox")
- expect(page).to have_selector("#{container} .js-task-list-field")
+ expect(page).to have_selector("#{container} .js-task-list-field", visible: false)
expect(page).to have_selector('form.js-issuable-update')
- expect(page).to have_selector('a.btn-close')
end
it 'is only editable by author', :js do
visit_merge_request(project, merge)
+ wait_for_requests
expect(page).to have_selector('.js-task-list-container')
expect(page).to have_selector('li.task-list-item.enabled', count: 6)
@@ -269,6 +271,7 @@ describe 'Task Lists' do
logout(:user)
login_as(user2)
visit current_path
+ wait_for_requests
expect(page).not_to have_selector('.js-task-list-container')
expect(page).to have_selector('li.task-list-item.enabled', count: 0)
@@ -297,8 +300,9 @@ describe 'Task Lists' do
describe 'single incomplete task' do
let!(:merge) { create(:merge_request, :simple, description: singleIncompleteMarkdown, author: user, source_project: project) }
- it 'renders for description' do
+ it 'renders for description', :js do
visit_merge_request(project, merge)
+ wait_for_requests
expect(page).to have_selector('ul.task-list', count: 1)
expect(page).to have_selector('li.task-list-item', count: 1)
@@ -315,8 +319,9 @@ describe 'Task Lists' do
describe 'single complete task' do
let!(:merge) { create(:merge_request, :simple, description: singleCompleteMarkdown, author: user, source_project: project) }
- it 'renders for description' do
+ it 'renders for description', :js do
visit_merge_request(project, merge)
+ wait_for_requests
expect(page).to have_selector('ul.task-list', count: 1)
expect(page).to have_selector('li.task-list-item', count: 1)
@@ -325,6 +330,7 @@ describe 'Task Lists' do
it 'provides a summary on MergeRequests#index' do
visit project_merge_requests_path(project)
+
expect(page).to have_content("1 of 1 task completed")
end
end
diff --git a/spec/fixtures/api/graphql/recursive-introspection.graphql b/spec/fixtures/api/graphql/recursive-introspection.graphql
index db970bb14b6..8346fbdde74 100644
--- a/spec/fixtures/api/graphql/recursive-introspection.graphql
+++ b/spec/fixtures/api/graphql/recursive-introspection.graphql
@@ -2,51 +2,11 @@ query allSchemaTypes {
__schema {
types {
fields {
- type{
+ type {
fields {
type {
fields {
- type {
- fields {
- type {
- fields {
- type {
- fields {
- type {
- fields {
- type {
- fields {
- type {
- fields {
- type {
- fields {
- type {
- fields {
- type {
- fields {
- type {
- fields {
- name
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
+ name
}
}
}
@@ -54,4 +14,4 @@ query allSchemaTypes {
}
}
}
-} \ No newline at end of file
+}
diff --git a/spec/fixtures/api/graphql/recursive-query-edges-node.graphql b/spec/fixtures/api/graphql/recursive-query-edges-node.graphql
new file mode 100644
index 00000000000..de790b1a6c7
--- /dev/null
+++ b/spec/fixtures/api/graphql/recursive-query-edges-node.graphql
@@ -0,0 +1,23 @@
+{
+ project(fullPath: "gitlab-org/gitlab") {
+ group {
+ projects {
+ edges {
+ node {
+ group {
+ projects {
+ edges {
+ node {
+ group {
+ description
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/spec/fixtures/api/graphql/recursive-query-nodes.graphql b/spec/fixtures/api/graphql/recursive-query-nodes.graphql
new file mode 100644
index 00000000000..c8d93f74f86
--- /dev/null
+++ b/spec/fixtures/api/graphql/recursive-query-nodes.graphql
@@ -0,0 +1,19 @@
+{
+ project(fullPath: "gitlab-org/gitlab") {
+ group {
+ projects {
+ nodes {
+ group {
+ projects {
+ nodes {
+ group {
+ description
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/spec/fixtures/api/graphql/recursive-query.graphql b/spec/fixtures/api/graphql/recursive-query.graphql
deleted file mode 100644
index d1616c4de6e..00000000000
--- a/spec/fixtures/api/graphql/recursive-query.graphql
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- project(fullPath: "gitlab-org/gitlab-ce") {
- group {
- projects {
- edges {
- node {
- group {
- projects {
- edges {
- node {
- group {
- projects {
- edges {
- node {
- group {
- projects {
- edges {
- node {
- group {
- projects {
- edges {
- node {
- group {
- description
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
-}
diff --git a/spec/lib/gitlab/conflict/file_spec.rb b/spec/lib/gitlab/conflict/file_spec.rb
index 7ecc42ea497..966648bcc5a 100644
--- a/spec/lib/gitlab/conflict/file_spec.rb
+++ b/spec/lib/gitlab/conflict/file_spec.rb
@@ -153,79 +153,79 @@ describe Gitlab::Conflict::File do
context 'with an example file' do
let(:raw_conflict_content) do
- <<FILE
- # Ensure there is no match line header here
- def username_regexp
- default_regexp
- end
-
-<<<<<<< files/ruby/regex.rb
-def project_name_regexp
- /\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z/
-end
-
-def name_regexp
- /\A[a-zA-Z0-9_\-\. ]*\z/
-=======
-def project_name_regex
- %r{\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z}
-end
-
-def name_regex
- %r{\A[a-zA-Z0-9_\-\. ]*\z}
->>>>>>> files/ruby/regex.rb
-end
-
-# Some extra lines
-# To force a match line
-# To be created
-
-def path_regexp
- default_regexp
-end
-
-<<<<<<< files/ruby/regex.rb
-def archive_formats_regexp
- /(zip|tar|7z|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)/
-=======
-def archive_formats_regex
- %r{(zip|tar|7z|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)}
->>>>>>> files/ruby/regex.rb
-end
-
-def git_reference_regexp
- # Valid git ref regexp, see:
- # https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
- %r{
- (?!
- (?# doesn't begins with)
- \/| (?# rule #6)
- (?# doesn't contain)
- .*(?:
- [\/.]\.| (?# rule #1,3)
- \/\/| (?# rule #6)
- @\{| (?# rule #8)
- \\ (?# rule #9)
- )
- )
- [^\000-\040\177~^:?*\[]+ (?# rule #4-5)
- (?# doesn't end with)
- (?<!\.lock) (?# rule #1)
- (?<![\/.]) (?# rule #6-7)
- }x
-end
-
-protected
-
-<<<<<<< files/ruby/regex.rb
-def default_regexp
- /\A[.?]?[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
-=======
-def default_regex
- %r{\A[.?]?[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(?<!\.git)\z}
->>>>>>> files/ruby/regex.rb
-end
-FILE
+ <<~FILE
+ # Ensure there is no match line header here
+ def username_regexp
+ default_regexp
+ end
+
+ <<<<<<< files/ruby/regex.rb
+ def project_name_regexp
+ /\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z/
+ end
+
+ def name_regexp
+ /\A[a-zA-Z0-9_\-\. ]*\z/
+ =======
+ def project_name_regex
+ %r{\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z}
+ end
+
+ def name_regex
+ %r{\A[a-zA-Z0-9_\-\. ]*\z}
+ >>>>>>> files/ruby/regex.rb
+ end
+
+ # Some extra lines
+ # To force a match line
+ # To be created
+
+ def path_regexp
+ default_regexp
+ end
+
+ <<<<<<< files/ruby/regex.rb
+ def archive_formats_regexp
+ /(zip|tar|7z|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)/
+ =======
+ def archive_formats_regex
+ %r{(zip|tar|7z|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)}
+ >>>>>>> files/ruby/regex.rb
+ end
+
+ def git_reference_regexp
+ # Valid git ref regexp, see:
+ # https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
+ %r{
+ (?!
+ (?# doesn't begins with)
+ \/| (?# rule #6)
+ (?# doesn't contain)
+ .*(?:
+ [\/.]\.| (?# rule #1,3)
+ \/\/| (?# rule #6)
+ @\{| (?# rule #8)
+ \\ (?# rule #9)
+ )
+ )
+ [^\000-\040\177~^:?*\[]+ (?# rule #4-5)
+ (?# doesn't end with)
+ (?<!\.lock) (?# rule #1)
+ (?<![\/.]) (?# rule #6-7)
+ }x
+ end
+
+ protected
+
+ <<<<<<< files/ruby/regex.rb
+ def default_regexp
+ /\A[.?]?[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
+ =======
+ def default_regex
+ %r{\A[.?]?[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(?<!\.git)\z}
+ >>>>>>> files/ruby/regex.rb
+ end
+ FILE
end
let(:sections) { conflict_file.sections }
diff --git a/spec/lib/gitlab/git/conflict/parser_spec.rb b/spec/lib/gitlab/git/conflict/parser_spec.rb
index 600c870acd4..92ea44394b1 100644
--- a/spec/lib/gitlab/git/conflict/parser_spec.rb
+++ b/spec/lib/gitlab/git/conflict/parser_spec.rb
@@ -10,80 +10,80 @@ describe Gitlab::Git::Conflict::Parser do
context 'when the file has valid conflicts' do
let(:text) do
- <<CONFLICT
-module Gitlab
- module Regexp
- extend self
-
- def username_regexp
- default_regexp
- end
-
-<<<<<<< files/ruby/regex.rb
- def project_name_regexp
- /\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z/
- end
-
- def name_regexp
- /\A[a-zA-Z0-9_\-\. ]*\z/
-=======
- def project_name_regex
- %r{\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z}
- end
-
- def name_regex
- %r{\A[a-zA-Z0-9_\-\. ]*\z}
->>>>>>> files/ruby/regex.rb
- end
-
- def path_regexp
- default_regexp
- end
-
-<<<<<<< files/ruby/regex.rb
- def archive_formats_regexp
- /(zip|tar|7z|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)/
-=======
- def archive_formats_regex
- %r{(zip|tar|7z|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)}
->>>>>>> files/ruby/regex.rb
- end
-
- def git_reference_regexp
- # Valid git ref regexp, see:
- # https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
- %r{
- (?!
- (?# doesn't begins with)
- \/| (?# rule #6)
- (?# doesn't contain)
- .*(?:
- [\/.]\.| (?# rule #1,3)
- \/\/| (?# rule #6)
- @\{| (?# rule #8)
- \\ (?# rule #9)
- )
- )
- [^\000-\040\177~^:?*\[]+ (?# rule #4-5)
- (?# doesn't end with)
- (?<!\.lock) (?# rule #1)
- (?<![\/.]) (?# rule #6-7)
- }x
- end
-
- protected
-
-<<<<<<< files/ruby/regex.rb
- def default_regexp
- /\A[.?]?[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
-=======
- def default_regex
- %r{\A[.?]?[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(?<!\.git)\z}
->>>>>>> files/ruby/regex.rb
- end
- end
-end
-CONFLICT
+ <<~CONFLICT
+ module Gitlab
+ module Regexp
+ extend self
+
+ def username_regexp
+ default_regexp
+ end
+
+ <<<<<<< files/ruby/regex.rb
+ def project_name_regexp
+ /\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z/
+ end
+
+ def name_regexp
+ /\A[a-zA-Z0-9_\-\. ]*\z/
+ =======
+ def project_name_regex
+ %r{\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z}
+ end
+
+ def name_regex
+ %r{\A[a-zA-Z0-9_\-\. ]*\z}
+ >>>>>>> files/ruby/regex.rb
+ end
+
+ def path_regexp
+ default_regexp
+ end
+
+ <<<<<<< files/ruby/regex.rb
+ def archive_formats_regexp
+ /(zip|tar|7z|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)/
+ =======
+ def archive_formats_regex
+ %r{(zip|tar|7z|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)}
+ >>>>>>> files/ruby/regex.rb
+ end
+
+ def git_reference_regexp
+ # Valid git ref regexp, see:
+ # https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
+ %r{
+ (?!
+ (?# doesn't begins with)
+ \/| (?# rule #6)
+ (?# doesn't contain)
+ .*(?:
+ [\/.]\.| (?# rule #1,3)
+ \/\/| (?# rule #6)
+ @\{| (?# rule #8)
+ \\ (?# rule #9)
+ )
+ )
+ [^\000-\040\177~^:?*\[]+ (?# rule #4-5)
+ (?# doesn't end with)
+ (?<!\.lock) (?# rule #1)
+ (?<![\/.]) (?# rule #6-7)
+ }x
+ end
+
+ protected
+
+ <<<<<<< files/ruby/regex.rb
+ def default_regexp
+ /\A[.?]?[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
+ =======
+ def default_regex
+ %r{\A[.?]?[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(?<!\.git)\z}
+ >>>>>>> files/ruby/regex.rb
+ end
+ end
+ end
+ CONFLICT
end
let(:lines) do
diff --git a/spec/models/clusters/platforms/kubernetes_spec.rb b/spec/models/clusters/platforms/kubernetes_spec.rb
index 4271cf9f1b3..f0e6dd53664 100644
--- a/spec/models/clusters/platforms/kubernetes_spec.rb
+++ b/spec/models/clusters/platforms/kubernetes_spec.rb
@@ -361,8 +361,10 @@ describe Clusters::Platforms::Kubernetes do
describe '#calculate_reactive_cache_for' do
let(:service) { create(:cluster_platform_kubernetes, :configured) }
- let(:pod) { kube_pod }
- let(:namespace) { pod["metadata"]["namespace"] }
+ let(:expected_pod_cached_data) do
+ kube_pod.tap { |kp| kp['metadata'].delete('namespace') }
+ end
+ let(:namespace) { "project-namespace" }
let(:environment) { instance_double(Environment, deployment_namespace: namespace) }
subject { service.calculate_reactive_cache_for(environment) }
@@ -381,7 +383,7 @@ describe Clusters::Platforms::Kubernetes do
stub_kubeclient_deployments(namespace)
end
- it { is_expected.to include(pods: [pod]) }
+ it { is_expected.to include(pods: [expected_pod_cached_data]) }
end
context 'when kubernetes responds with 500s' do
diff --git a/spec/models/error_tracking/project_error_tracking_setting_spec.rb b/spec/models/error_tracking/project_error_tracking_setting_spec.rb
index 004e8a28c12..5b402e572c3 100644
--- a/spec/models/error_tracking/project_error_tracking_setting_spec.rb
+++ b/spec/models/error_tracking/project_error_tracking_setting_spec.rb
@@ -440,18 +440,4 @@ describe ErrorTracking::ProjectErrorTrackingSetting do
end
end
end
-
- describe '#expire_issues_cache', :use_clean_rails_memory_store_caching do
- it 'clears the cache' do
- klass_key = subject.class.reactive_cache_key.call(subject).join(':')
- key = "#{klass_key}:list_issues:some_suffix"
- Rails.cache.write(key, 1)
-
- expect(Rails.cache.exist?(key)).to eq(true)
-
- subject.expire_issues_cache
-
- expect(Rails.cache.exist?(key)).to eq(false)
- end
- end
end
diff --git a/spec/requests/api/graphql/gitlab_schema_spec.rb b/spec/requests/api/graphql/gitlab_schema_spec.rb
index 2cb8436662b..e10f0732852 100644
--- a/spec/requests/api/graphql/gitlab_schema_spec.rb
+++ b/spec/requests/api/graphql/gitlab_schema_spec.rb
@@ -67,24 +67,45 @@ describe 'GitlabSchema configurations' do
end
end
- context 'a deep but simple recursive introspective query' do
- it 'fails due to recursion' do
- query = File.read(Rails.root.join('spec/fixtures/api/graphql/recursive-introspection.graphql'))
+ context 'failing queries' do
+ before do
+ allow(GitlabSchema).to receive(:max_query_recursion).and_return 1
+ end
- post_graphql(query, current_user: nil)
+ context 'a recursive introspective query' do
+ it 'fails due to recursion' do
+ query = File.read(Rails.root.join('spec/fixtures/api/graphql/recursive-introspection.graphql'))
- expect_graphql_errors_to_include [/Recursive query/]
+ post_graphql(query, current_user: nil)
+
+ expect_graphql_errors_to_include [/Recursive query/]
+ end
end
- end
- context 'a deep recursive non-introspective query' do
- it 'fails due to recursion, complexity and depth' do
- allow(GitlabSchema).to receive(:max_query_complexity).and_return 1
- query = File.read(Rails.root.join('spec/fixtures/api/graphql/recursive-query.graphql'))
+ context 'a recursive non-introspective query' do
+ before do
+ allow(GitlabSchema).to receive(:max_query_complexity).and_return 1
+ allow(GitlabSchema).to receive(:max_query_depth).and_return 1
+ allow(GitlabSchema).to receive(:max_query_complexity).and_return 1
+ end
- post_graphql(query, current_user: nil)
+ shared_examples 'fails due to recursion, complexity and depth' do |fixture_file|
+ it 'fails due to recursion, complexity and depth' do
+ query = File.read(Rails.root.join(fixture_file))
+
+ post_graphql(query, current_user: nil)
+
+ expect_graphql_errors_to_include [/Recursive query/, /exceeds max complexity/, /exceeds max depth/]
+ end
+ end
- expect_graphql_errors_to_include [/Recursive query/, /exceeds max complexity/, /exceeds max depth/]
+ context 'using `nodes` notation' do
+ it_behaves_like 'fails due to recursion, complexity and depth', 'spec/fixtures/api/graphql/recursive-query-nodes.graphql'
+ end
+
+ context 'using `edges -> node` notation' do
+ it_behaves_like 'fails due to recursion, complexity and depth', 'spec/fixtures/api/graphql/recursive-query-edges-node.graphql'
+ end
end
end
end
diff --git a/spec/services/error_tracking/issue_details_service_spec.rb b/spec/services/error_tracking/issue_details_service_spec.rb
index 26bb3b44126..60d6172ef64 100644
--- a/spec/services/error_tracking/issue_details_service_spec.rb
+++ b/spec/services/error_tracking/issue_details_service_spec.rb
@@ -9,6 +9,7 @@ describe ErrorTracking::IssueDetailsService do
context 'with authorized user' do
context 'when issue_details returns a detailed error' do
let(:detailed_error) { build(:detailed_error_tracking_error) }
+ let(:params) { { issue_id: detailed_error.id } }
before do
expect(error_tracking_setting)
@@ -18,6 +19,19 @@ describe ErrorTracking::IssueDetailsService do
it 'returns the detailed error' do
expect(result).to eq(status: :success, issue: detailed_error)
end
+
+ it 'returns the gitlab_issue when the error has a sentry_issue' do
+ gitlab_issue = create(:issue, project: project)
+ create(:sentry_issue, issue: gitlab_issue, sentry_issue_identifier: detailed_error.id)
+
+ expect(result[:issue].gitlab_issue).to include(
+ "http", "/#{project.full_path}/issues/#{gitlab_issue.iid}"
+ )
+ end
+
+ it 'returns the gitlab_issue path from sentry when the error has no sentry_issue' do
+ expect(result[:issue].gitlab_issue).to eq(detailed_error.gitlab_issue)
+ end
end
include_examples 'error tracking service data not ready', :issue_details
diff --git a/spec/services/error_tracking/issue_update_service_spec.rb b/spec/services/error_tracking/issue_update_service_spec.rb
index 4500c7c4f75..ad1dafe6ccc 100644
--- a/spec/services/error_tracking/issue_update_service_spec.rb
+++ b/spec/services/error_tracking/issue_update_service_spec.rb
@@ -40,16 +40,6 @@ describe ErrorTracking::IssueUpdateService do
result
end
- it 'clears the reactive cache' do
- allow(error_tracking_setting)
- .to receive(:expire_issues_cache)
-
- result
-
- expect(error_tracking_setting)
- .to have_received(:expire_issues_cache)
- end
-
context 'related issue and resolving' do
let(:issue) { create(:issue, project: project) }
let(:sentry_issue) { create(:sentry_issue, issue: issue) }
diff --git a/spec/support/helpers/kubernetes_helpers.rb b/spec/support/helpers/kubernetes_helpers.rb
index 8e5042e2ad3..0d312575e91 100644
--- a/spec/support/helpers/kubernetes_helpers.rb
+++ b/spec/support/helpers/kubernetes_helpers.rb
@@ -494,7 +494,7 @@ module KubernetesHelpers
"metadata" => {
"name" => name,
"namespace" => namespace,
- "generate_name" => "generated-name-with-suffix",
+ "generateName" => "generated-name-with-suffix",
"creationTimestamp" => "2016-11-25T19:55:19Z",
"annotations" => {
"app.gitlab.com/env" => environment_slug,
@@ -520,7 +520,7 @@ module KubernetesHelpers
"metadata" => {
"name" => name,
"namespace" => namespace,
- "generate_name" => "generated-name-with-suffix",
+ "generateName" => "generated-name-with-suffix",
"creationTimestamp" => "2016-11-25T19:55:19Z",
"labels" => {
"serving.knative.dev/service" => name
@@ -551,10 +551,7 @@ module KubernetesHelpers
},
"spec" => { "replicas" => 3 },
"status" => {
- "observedGeneration" => 4,
- "replicas" => 3,
- "updatedReplicas" => 3,
- "availableReplicas" => 3
+ "observedGeneration" => 4
}
}
end
diff --git a/spec/support/shared_contexts/sentry_error_tracking_shared_context.rb b/spec/support/shared_contexts/sentry_error_tracking_shared_context.rb
index ba729f21e58..ee678580fb9 100644
--- a/spec/support/shared_contexts/sentry_error_tracking_shared_context.rb
+++ b/spec/support/shared_contexts/sentry_error_tracking_shared_context.rb
@@ -6,9 +6,10 @@ shared_context 'sentry error tracking context' do
let(:sentry_url) { 'https://sentrytest.gitlab.com/api/0/projects/sentry-org/sentry-project' }
let(:token) { 'test-token' }
+ let(:params) { {} }
let(:result) { subject.execute }
- subject { described_class.new(project, user) }
+ subject { described_class.new(project, user, params) }
let(:error_tracking_setting) do
create(:project_error_tracking_setting, api_url: sentry_url, token: token, project: project)