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

Add latest changes from gitlab-org/gitlab@master

parent 87af6f2e
No related branches found
No related tags found
No related merge requests found
Showing
with 267 additions and 170 deletions
doc/user/project/issues/img/issue_health_status_v12_9.png

10.3 KiB

Loading
Loading
@@ -50,7 +50,8 @@ must be set.
</ul>
<li>State</li>
<ul>
<li>Status (open/closed)</li>
<li>State (open or closed)</li>
<li>Status (On track, Needs attention, or At risk)</li>
<li>Confidentiality</li>
<li>Tasks (completed vs. outstanding)</li>
</ul>
Loading
Loading
@@ -109,8 +110,7 @@ view, you can also make certain changes [in bulk](../bulk_editing.md) to the dis
For more information, see the [Issue Data and Actions](issue_data_and_actions.md) page
for a rundown of all the fields and information in an issue.
 
You can sort a list of issues several ways, including by issue creation date, milestone due date,
etc. For more information, see the [Sorting and Ordering Issue Lists](sorting_issue_lists.md) page.
You can sort a list of issues in several ways, for example by issue creation date, milestone due date. For more information, see the [Sorting and Ordering Issue Lists](sorting_issue_lists.md) page.
 
### Issue boards
 
Loading
Loading
@@ -157,12 +157,38 @@ To prevent duplication of issues for the same topic, GitLab searches for similar
when new issues are being created.
 
When typing in the title in the **New Issue** page, GitLab searches titles and descriptions
across all issues the user has access to in the current project. Up 5 similar issues,
across all issues the user has access to in the current project. Up to five similar issues,
sorted by most recently updated, are displayed below the title box. Note that this feature
requires [GraphQL](../../../api/graphql/index.md) to be enabled.
 
![Similar issues](img/similar_issues.png)
 
---
### Status **(ULTIMATE)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/36427) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 12.9.
To help you track the status of your issues, you can assign a status to each issue to flag work that's progressing as planned or needs attention to keep on schedule:
- `On track` (green)
- `Needs attention` (amber)
- `At risk` (red)
!["On track" health status on an issue](img/issue_health_status_v12_9.png)
---
#### Enable issue health status
This feature comes with the `:save_issuable_health_status` feature flag disabled by default. However, in some cases
this feature is incompatible with old configuration. To turn on the feature while configuration is
migrated, ask a GitLab administrator with Rails console access to run the following command:
```ruby
Feature.enable(:save_issuable_health_status)
```
## Other Issue actions
 
- [Create an issue from a template](../../project/description_templates.md#using-the-templates)
Loading
Loading
Loading
Loading
@@ -16,7 +16,7 @@ Code Quality:
subscription.
- Runs in [pipelines](../../../ci/pipelines/index.md) using a Docker image built in the
[GitLab Code
Quality](https://gitlab.com/gitlab-org/security-products/codequality) project using [default Code Climate configurations](https://gitlab.com/gitlab-org/security-products/codequality/-/tree/master/codeclimate_defaults).
Quality](https://gitlab.com/gitlab-org/ci-cd/codequality) project using [default Code Climate configurations](https://gitlab.com/gitlab-org/ci-cd/codequality/-/tree/master/codeclimate_defaults).
- Can make use of a [template](#example-configuration).
- Is available with [Auto
DevOps](../../../topics/autodevops/index.md#auto-code-quality-starter).
Loading
Loading
@@ -135,14 +135,14 @@ code_quality:
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
"registry.gitlab.com/gitlab-org/ci-cd/codequality:$SP_VERSION" /code
artifacts:
reports:
codequality: gl-code-quality-report.json
```
 
In GitLab 12.6, Code Quality switched to the
[new versioning scheme](https://gitlab.com/gitlab-org/security-products/codequality/-/merge_requests/38).
[new versioning scheme](https://gitlab.com/gitlab-org/ci-cd/codequality#versioning-and-release-cycle).
It is highly recommended to include the Code Quality template as shown in the
[example configuration](#example-configuration), which uses the new versioning scheme.
If not using the template, the `SP_VERSION` variable can be hardcoded to use the
Loading
Loading
@@ -162,7 +162,7 @@ code_quality:
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
"registry.gitlab.com/gitlab-org/ci-cd/codequality:$SP_VERSION" /code
artifacts:
reports:
codequality: gl-code-quality-report.json
Loading
Loading
@@ -184,7 +184,7 @@ code_quality:
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
"registry.gitlab.com/gitlab-org/ci-cd/codequality:$SP_VERSION" /code
artifacts:
paths: [gl-code-quality-report.json]
```
Loading
Loading
@@ -216,7 +216,7 @@ The Code Quality job supports environment variables that users can set to
configure job execution at runtime.
 
For a list of available environment variables, see
[Environment variables](https://gitlab.com/gitlab-org/security-products/codequality/blob/master/README.md#environment-variables).
[Environment variables](https://gitlab.com/gitlab-org/ci-cd/codequality#environment-variables).
 
## Implementing a custom tool
 
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@ code_quality:
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
CODE_QUALITY_IMAGE: "registry.gitlab.com/gitlab-org/security-products/codequality:0.85.9"
CODE_QUALITY_IMAGE: "registry.gitlab.com/gitlab-org/ci-cd/codequality:0.85.9"
script:
- |
if ! docker info &>/dev/null; then
Loading
Loading
Loading
Loading
@@ -46,7 +46,7 @@ module Gitlab
@metrics[:sidekiq_jobs_cpu_seconds].observe(labels, job_thread_cputime)
@metrics[:sidekiq_jobs_completion_seconds].observe(labels, monotonic_time)
@metrics[:sidekiq_jobs_db_seconds].observe(labels, ActiveRecord::LogSubscriber.runtime / 1000)
@metrics[:sidekiq_jobs_gitaly_seconds].observe(labels, Gitlab::GitalyClient.query_time)
@metrics[:sidekiq_jobs_gitaly_seconds].observe(labels, get_gitaly_time(job))
end
end
 
Loading
Loading
@@ -69,6 +69,10 @@ module Gitlab
def get_thread_cputime
defined?(Process::CLOCK_THREAD_CPUTIME_ID) ? Process.clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID) : 0
end
def get_gitaly_time(job)
job.fetch(:gitaly_duration, 0) / 1000.0
end
end
end
end
Loading
Loading
@@ -164,6 +164,10 @@ FactoryBot.define do
attachment { fixture_file_upload("spec/fixtures/git-cheat-sheet.pdf", "application/pdf") }
end
 
trait :confidential do
confidential { true }
end
transient do
in_reply_to { nil }
end
Loading
Loading
Loading
Loading
@@ -7,39 +7,11 @@ FactoryBot.define do
enabled_until { 1.week.from_now }
 
certificate do
'-----BEGIN CERTIFICATE-----
MIICGzCCAYSgAwIBAgIBATANBgkqhkiG9w0BAQUFADAbMRkwFwYDVQQDExB0ZXN0
LWNlcnRpZmljYXRlMB4XDTE2MDIxMjE0MzIwMFoXDTIwMDQxMjE0MzIwMFowGzEZ
MBcGA1UEAxMQdGVzdC1jZXJ0aWZpY2F0ZTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
gYkCgYEApL4J9L0ZxFJ1hI1LPIflAlAGvm6ZEvoT4qKU5Xf2JgU7/2geNR1qlNFa
SvCc08Knupp5yTgmvyK/Xi09U0N82vvp4Zvr/diSc4A/RA6Mta6egLySNT438kdT
nY2tR5feoTLwQpX0t4IMlwGQGT5h6Of2fKmDxzuwuyffcIHqLdsCAwEAAaNvMG0w
DAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUxl9WSxBprB0z0ibJs3rXEk0+95AwCwYD
VR0PBAQDAgXgMBEGCWCGSAGG+EIBAQQEAwIGQDAeBglghkgBhvhCAQ0EERYPeGNh
IGNlcnRpZmljYXRlMA0GCSqGSIb3DQEBBQUAA4GBAGC4T8SlFHK0yPSa+idGLQFQ
joZp2JHYvNlTPkRJ/J4TcXxBTJmArcQgTIuNoBtC+0A/SwdK4MfTCUY4vNWNdese
5A4K65Nb7Oh1AdQieTBHNXXCdyFsva9/ScfQGEl7p55a52jOPs0StPd7g64uvjlg
YHi2yesCrOvVXt+lgPTd
-----END CERTIFICATE-----'
File.read(Rails.root.join('spec/fixtures/', 'ssl_certificate.pem'))
end
 
key do
'-----BEGIN PRIVATE KEY-----
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKS+CfS9GcRSdYSN
SzyH5QJQBr5umRL6E+KilOV39iYFO/9oHjUdapTRWkrwnNPCp7qaeck4Jr8iv14t
PVNDfNr76eGb6/3YknOAP0QOjLWunoC8kjU+N/JHU52NrUeX3qEy8EKV9LeCDJcB
kBk+Yejn9nypg8c7sLsn33CB6i3bAgMBAAECgYA2D26w80T7WZvazYr86BNMePpd
j2mIAqx32KZHzt/lhh40J/SRtX9+Kl0Y7nBoRR5Ja9u/HkAIxNxLiUjwg9r6cpg/
uITEF5nMt7lAk391BuI+7VOZZGbJDsq2ulPd6lO+C8Kq/PI/e4kXcIjeH6KwQsuR
5vrXfBZ3sQfflaiN4QJBANBt8JY2LIGQF8o89qwUpRL5vbnKQ4IzZ5+TOl4RLR7O
AQpJ81tGuINghO7aunctb6rrcKJrxmEH1whzComybrMCQQDKV49nOBudRBAIgG4K
EnLzsRKISUHMZSJiYTYnablof8cKw1JaQduw7zgrUlLwnroSaAGX88+Jw1f5n2Lh
Vlg5AkBDdUGnrDLtYBCDEQYZHblrkc7ZAeCllDOWjxUV+uMqlCv8A4Ey6omvY57C
m6I8DkWVAQx8VPtozhvHjUw80rZHAkB55HWHAM3h13axKG0htCt7klhPsZHpx6MH
EPjGlXIT+aW2XiPmK3ZlCDcWIenE+lmtbOpI159Wpk8BGXs/s/xBAkEAlAY3ymgx
63BDJEwvOb2IaP8lDDxNsXx9XJNVvQbv5n15vNsLHbjslHfAhAbxnLQ1fLhUPqSi
nNp/xedE1YxutQ==
-----END PRIVATE KEY-----'
File.read(Rails.root.join('spec/fixtures/', 'ssl_key.pem'))
end
 
trait :disabled do
Loading
Loading
Loading
Loading
@@ -7,39 +7,11 @@ FactoryBot.define do
creator { create(:user) }
 
certificate do
'-----BEGIN CERTIFICATE-----
MIICGzCCAYSgAwIBAgIBATANBgkqhkiG9w0BAQUFADAbMRkwFwYDVQQDExB0ZXN0
LWNlcnRpZmljYXRlMB4XDTE2MDIxMjE0MzIwMFoXDTIwMDQxMjE0MzIwMFowGzEZ
MBcGA1UEAxMQdGVzdC1jZXJ0aWZpY2F0ZTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
gYkCgYEApL4J9L0ZxFJ1hI1LPIflAlAGvm6ZEvoT4qKU5Xf2JgU7/2geNR1qlNFa
SvCc08Knupp5yTgmvyK/Xi09U0N82vvp4Zvr/diSc4A/RA6Mta6egLySNT438kdT
nY2tR5feoTLwQpX0t4IMlwGQGT5h6Of2fKmDxzuwuyffcIHqLdsCAwEAAaNvMG0w
DAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUxl9WSxBprB0z0ibJs3rXEk0+95AwCwYD
VR0PBAQDAgXgMBEGCWCGSAGG+EIBAQQEAwIGQDAeBglghkgBhvhCAQ0EERYPeGNh
IGNlcnRpZmljYXRlMA0GCSqGSIb3DQEBBQUAA4GBAGC4T8SlFHK0yPSa+idGLQFQ
joZp2JHYvNlTPkRJ/J4TcXxBTJmArcQgTIuNoBtC+0A/SwdK4MfTCUY4vNWNdese
5A4K65Nb7Oh1AdQieTBHNXXCdyFsva9/ScfQGEl7p55a52jOPs0StPd7g64uvjlg
YHi2yesCrOvVXt+lgPTd
-----END CERTIFICATE-----'
File.read(Rails.root.join('spec/fixtures/', 'ssl_certificate.pem'))
end
 
key do
'-----BEGIN PRIVATE KEY-----
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKS+CfS9GcRSdYSN
SzyH5QJQBr5umRL6E+KilOV39iYFO/9oHjUdapTRWkrwnNPCp7qaeck4Jr8iv14t
PVNDfNr76eGb6/3YknOAP0QOjLWunoC8kjU+N/JHU52NrUeX3qEy8EKV9LeCDJcB
kBk+Yejn9nypg8c7sLsn33CB6i3bAgMBAAECgYA2D26w80T7WZvazYr86BNMePpd
j2mIAqx32KZHzt/lhh40J/SRtX9+Kl0Y7nBoRR5Ja9u/HkAIxNxLiUjwg9r6cpg/
uITEF5nMt7lAk391BuI+7VOZZGbJDsq2ulPd6lO+C8Kq/PI/e4kXcIjeH6KwQsuR
5vrXfBZ3sQfflaiN4QJBANBt8JY2LIGQF8o89qwUpRL5vbnKQ4IzZ5+TOl4RLR7O
AQpJ81tGuINghO7aunctb6rrcKJrxmEH1whzComybrMCQQDKV49nOBudRBAIgG4K
EnLzsRKISUHMZSJiYTYnablof8cKw1JaQduw7zgrUlLwnroSaAGX88+Jw1f5n2Lh
Vlg5AkBDdUGnrDLtYBCDEQYZHblrkc7ZAeCllDOWjxUV+uMqlCv8A4Ey6omvY57C
m6I8DkWVAQx8VPtozhvHjUw80rZHAkB55HWHAM3h13axKG0htCt7klhPsZHpx6MH
EPjGlXIT+aW2XiPmK3ZlCDcWIenE+lmtbOpI159Wpk8BGXs/s/xBAkEAlAY3ymgx
63BDJEwvOb2IaP8lDDxNsXx9XJNVvQbv5n15vNsLHbjslHfAhAbxnLQ1fLhUPqSi
nNp/xedE1YxutQ==
-----END PRIVATE KEY-----'
File.read(Rails.root.join('spec/fixtures/', 'ssl_key.pem'))
end
end
end
Loading
Loading
@@ -48,6 +48,7 @@ FactoryBot.define do
trait :secret do
visibility_level { Snippet::PUBLIC }
secret { true }
project { nil }
end
end
end
Loading
Loading
@@ -135,43 +135,11 @@ shared_examples 'pages settings editing' do
 
context 'when pages are exposed on external HTTPS address', :https_pages_enabled, :js do
let(:certificate_pem) do
<<~PEM
-----BEGIN CERTIFICATE-----
MIICGzCCAYSgAwIBAgIBATANBgkqhkiG9w0BAQUFADAbMRkwFwYDVQQDExB0ZXN0
LWNlcnRpZmljYXRlMB4XDTE2MDIxMjE0MzIwMFoXDTIwMDQxMjE0MzIwMFowGzEZ
MBcGA1UEAxMQdGVzdC1jZXJ0aWZpY2F0ZTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
gYkCgYEApL4J9L0ZxFJ1hI1LPIflAlAGvm6ZEvoT4qKU5Xf2JgU7/2geNR1qlNFa
SvCc08Knupp5yTgmvyK/Xi09U0N82vvp4Zvr/diSc4A/RA6Mta6egLySNT438kdT
nY2tR5feoTLwQpX0t4IMlwGQGT5h6Of2fKmDxzuwuyffcIHqLdsCAwEAAaNvMG0w
DAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUxl9WSxBprB0z0ibJs3rXEk0+95AwCwYD
VR0PBAQDAgXgMBEGCWCGSAGG+EIBAQQEAwIGQDAeBglghkgBhvhCAQ0EERYPeGNh
IGNlcnRpZmljYXRlMA0GCSqGSIb3DQEBBQUAA4GBAGC4T8SlFHK0yPSa+idGLQFQ
joZp2JHYvNlTPkRJ/J4TcXxBTJmArcQgTIuNoBtC+0A/SwdK4MfTCUY4vNWNdese
5A4K65Nb7Oh1AdQieTBHNXXCdyFsva9/ScfQGEl7p55a52jOPs0StPd7g64uvjlg
YHi2yesCrOvVXt+lgPTd
-----END CERTIFICATE-----
PEM
attributes_for(:pages_domain)[:certificate]
end
 
let(:certificate_key) do
<<~KEY
-----BEGIN PRIVATE KEY-----
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKS+CfS9GcRSdYSN
SzyH5QJQBr5umRL6E+KilOV39iYFO/9oHjUdapTRWkrwnNPCp7qaeck4Jr8iv14t
PVNDfNr76eGb6/3YknOAP0QOjLWunoC8kjU+N/JHU52NrUeX3qEy8EKV9LeCDJcB
kBk+Yejn9nypg8c7sLsn33CB6i3bAgMBAAECgYA2D26w80T7WZvazYr86BNMePpd
j2mIAqx32KZHzt/lhh40J/SRtX9+Kl0Y7nBoRR5Ja9u/HkAIxNxLiUjwg9r6cpg/
uITEF5nMt7lAk391BuI+7VOZZGbJDsq2ulPd6lO+C8Kq/PI/e4kXcIjeH6KwQsuR
5vrXfBZ3sQfflaiN4QJBANBt8JY2LIGQF8o89qwUpRL5vbnKQ4IzZ5+TOl4RLR7O
AQpJ81tGuINghO7aunctb6rrcKJrxmEH1whzComybrMCQQDKV49nOBudRBAIgG4K
EnLzsRKISUHMZSJiYTYnablof8cKw1JaQduw7zgrUlLwnroSaAGX88+Jw1f5n2Lh
Vlg5AkBDdUGnrDLtYBCDEQYZHblrkc7ZAeCllDOWjxUV+uMqlCv8A4Ey6omvY57C
m6I8DkWVAQx8VPtozhvHjUw80rZHAkB55HWHAM3h13axKG0htCt7klhPsZHpx6MH
EPjGlXIT+aW2XiPmK3ZlCDcWIenE+lmtbOpI159Wpk8BGXs/s/xBAkEAlAY3ymgx
63BDJEwvOb2IaP8lDDxNsXx9XJNVvQbv5n15vNsLHbjslHfAhAbxnLQ1fLhUPqSi
nNp/xedE1YxutQ==
-----END PRIVATE KEY-----
KEY
attributes_for(:pages_domain)[:key]
end
 
it 'adds new domain with certificate' do
Loading
Loading
Loading
Loading
@@ -20,6 +20,11 @@ describe AwardEmojisFinder do
)
end
 
it 'does not raise an error if `name` is numeric' do
subject = described_class.new(issue_1, { name: 100 })
expect { subject.execute }.not_to raise_error
end
it 'raises an error if `awarded_by` is invalid' do
expectation = [ArgumentError, 'Invalid awarded_by param']
 
Loading
Loading
-----BEGIN CERTIFICATE-----
MIIBrzCCARgCCQDbfQx2zdkNYTANBgkqhkiG9w0BAQsFADAbMRkwFwYDVQQDDBB0
ZXN0LWNlcnRpZmljYXRlMCAXDTIwMDMxNjE0MjAzNFoYDzIyMjAwMTI4MTQyMDM0
WjAbMRkwFwYDVQQDDBB0ZXN0LWNlcnRpZmljYXRlMIGfMA0GCSqGSIb3DQEBAQUA
A4GNADCBiQKBgQCkvgn0vRnEUnWEjUs8h+UCUAa+bpkS+hPiopTld/YmBTv/aB41
HWqU0VpK8JzTwqe6mnnJOCa/Ir9eLT1TQ3za++nhm+v92JJzgD9EDoy1rp6AvJI1
PjfyR1Odja1Hl96hMvBClfS3ggyXAZAZPmHo5/Z8qYPHO7C7J99wgeot2wIDAQAB
MA0GCSqGSIb3DQEBCwUAA4GBACc+chrTAuvnMBTedc4/dy16pEesK6oGjywYUd/0
/FBr8Vry7QUXMSgfraza9S0V+JvFvZFqkkOyJKW+m30kThWzyc/2e+BRxTh/QrxP
0j84QXtmnVtW4jsAwfBBfg78ST27eyp/WhruI6F/kZlXhfAed0RcPbRnbi3yvUPL
Lo4T
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKS+CfS9GcRSdYSN
SzyH5QJQBr5umRL6E+KilOV39iYFO/9oHjUdapTRWkrwnNPCp7qaeck4Jr8iv14t
PVNDfNr76eGb6/3YknOAP0QOjLWunoC8kjU+N/JHU52NrUeX3qEy8EKV9LeCDJcB
kBk+Yejn9nypg8c7sLsn33CB6i3bAgMBAAECgYA2D26w80T7WZvazYr86BNMePpd
j2mIAqx32KZHzt/lhh40J/SRtX9+Kl0Y7nBoRR5Ja9u/HkAIxNxLiUjwg9r6cpg/
uITEF5nMt7lAk391BuI+7VOZZGbJDsq2ulPd6lO+C8Kq/PI/e4kXcIjeH6KwQsuR
5vrXfBZ3sQfflaiN4QJBANBt8JY2LIGQF8o89qwUpRL5vbnKQ4IzZ5+TOl4RLR7O
AQpJ81tGuINghO7aunctb6rrcKJrxmEH1whzComybrMCQQDKV49nOBudRBAIgG4K
EnLzsRKISUHMZSJiYTYnablof8cKw1JaQduw7zgrUlLwnroSaAGX88+Jw1f5n2Lh
Vlg5AkBDdUGnrDLtYBCDEQYZHblrkc7ZAeCllDOWjxUV+uMqlCv8A4Ey6omvY57C
m6I8DkWVAQx8VPtozhvHjUw80rZHAkB55HWHAM3h13axKG0htCt7klhPsZHpx6MH
EPjGlXIT+aW2XiPmK3ZlCDcWIenE+lmtbOpI159Wpk8BGXs/s/xBAkEAlAY3ymgx
63BDJEwvOb2IaP8lDDxNsXx9XJNVvQbv5n15vNsLHbjslHfAhAbxnLQ1fLhUPqSi
nNp/xedE1YxutQ==
-----END PRIVATE KEY-----
Loading
Loading
@@ -67,7 +67,7 @@ describe Gitlab::SidekiqMiddleware::ServerMetrics do
allow(Gitlab::Metrics::System).to receive(:monotonic_time).and_return(monotonic_time_before, monotonic_time_after)
allow(Gitlab::InstrumentationHelper).to receive(:queue_duration_for_job).with(job).and_return(queue_duration_for_job)
allow(ActiveRecord::LogSubscriber).to receive(:runtime).and_return(db_duration * 1000)
allow(Gitlab::GitalyClient).to receive(:query_time).and_return(gitaly_duration)
allow(subject).to receive(:get_gitaly_time).and_return(gitaly_duration)
 
expect(running_jobs_metric).to receive(:increment).with(labels, 1)
expect(running_jobs_metric).to receive(:increment).with(labels, -1)
Loading
Loading
Loading
Loading
@@ -8,6 +8,8 @@ describe Gitlab::SidekiqMiddleware do
include Sidekiq::Worker
 
def perform(_arg)
Gitlab::SafeRequestStore['gitaly_call_actual'] = 1
Gitlab::GitalyClient.query_time = 5
end
end
 
Loading
Loading
@@ -99,6 +101,24 @@ describe Gitlab::SidekiqMiddleware do
it "passes through server middlewares" do
worker_class.perform_async(*job_args)
end
context "server metrics" do
let(:gitaly_histogram) { double(:gitaly_histogram) }
before do
allow(Gitlab::Metrics).to receive(:histogram).and_call_original
allow(Gitlab::Metrics).to receive(:histogram)
.with(:sidekiq_jobs_gitaly_seconds, anything, anything, anything)
.and_return(gitaly_histogram)
end
it "records correct Gitaly duration" do
expect(gitaly_histogram).to receive(:observe).with(anything, 5.0)
worker_class.perform_async(*job_args)
end
end
end
end
 
Loading
Loading
Loading
Loading
@@ -387,6 +387,22 @@ describe Gitlab::UsageData do
expect(described_class.count(relation, fallback: 15, batch: false)).to eq(15)
end
end
describe '#distinct_count' do
let(:relation) { double(:relation) }
it 'returns the count when counting succeeds' do
allow(relation).to receive(:distinct_count_by).and_return(1)
expect(described_class.distinct_count(relation, batch: false)).to eq(1)
end
it 'returns the fallback value when counting fails' do
allow(relation).to receive(:distinct_count_by).and_raise(ActiveRecord::StatementInvalid.new(''))
expect(described_class.distinct_count(relation, fallback: 15, batch: false)).to eq(15)
end
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe UsageStatistics do
describe '.distinct_count_by' do
let_it_be(:issue_1) { create(:issue) }
let_it_be(:issue_2) { create(:issue) }
context 'two records created by the same issue' do
let!(:models_created_by_issue) do
create(:zoom_meeting, :added_to_issue, issue: issue_1)
create(:zoom_meeting, :removed_from_issue, issue: issue_1)
end
it 'returns a count of 1' do
expect(::ZoomMeeting.distinct_count_by(:issue_id)).to eq(1)
end
context 'when given no column to count' do
it 'counts by :id and returns a count of 2' do
expect(::ZoomMeeting.distinct_count_by).to eq(2)
end
end
end
context 'one record created by each issue' do
let!(:model_created_by_issue_1) { create(:zoom_meeting, issue: issue_1) }
let!(:model_created_by_issue_2) { create(:zoom_meeting, issue: issue_2) }
it 'returns a count of 2' do
expect(::ZoomMeeting.distinct_count_by(:issue_id)).to eq(2)
end
end
context 'the count query times out' do
before do
allow_next_instance_of(ActiveRecord::Relation) do |instance|
allow(instance).to receive(:count).and_raise(ActiveRecord::StatementInvalid.new(''))
end
end
it 'does not raise an error' do
expect { ::ZoomMeeting.distinct_count_by(:issue_id) }.not_to raise_error
end
it 'returns -1' do
expect(::ZoomMeeting.distinct_count_by(:issue_id)).to eq(-1)
end
end
end
end
Loading
Loading
@@ -270,18 +270,35 @@ describe Note do
end
end
 
describe "confidential?" do
it "delegates to noteable" do
issue_note = build(:note, :on_issue)
confidential_note = build(:note, noteable: create(:issue, confidential: true))
describe '#confidential?' do
context 'when note is not confidential' do
it 'is true when a noteable is confidential' do
issue = create(:issue, :confidential)
note = build(:note, noteable: issue, project: issue.project)
 
expect(issue_note.confidential?).to be_falsy
expect(confidential_note.confidential?).to be_truthy
expect(note.confidential?).to be_truthy
end
it 'is false when a noteable is not confidential' do
issue = create(:issue, confidential: false)
note = build(:note, noteable: issue, project: issue.project)
expect(note.confidential?).to be_falsy
end
it "is falsey when noteable can't be confidential" do
commit_note = build(:note_on_commit)
expect(commit_note.confidential?).to be_falsy
end
end
context 'when note is confidential' do
it 'is true even when a noteable is not confidential' do
issue = create(:issue, confidential: false)
note = build(:note, :confidential, noteable: issue, project: issue.project)
 
it "is falsey when noteable can't be confidential" do
commit_note = build(:note_on_commit)
expect(commit_note.confidential?).to be_falsy
expect(note.confidential?).to be_truthy
end
end
end
 
Loading
Loading
@@ -1230,5 +1247,69 @@ describe Note do
expect(notes.second.id).to eq(note2.id)
end
end
describe '#noteable_assignee_or_author' do
let(:user) { create(:user) }
let(:noteable) { create(:issue) }
let(:note) { create(:note, project: noteable.project, noteable: noteable) }
subject { note.noteable_assignee_or_author?(user) }
shared_examples 'assignee check' do
context 'when the provided user is one of the assignees' do
before do
note.noteable.update(assignees: [user, create(:user)])
end
it 'returns true' do
expect(subject).to be_truthy
end
end
end
shared_examples 'author check' do
context 'when the provided user is the author' do
before do
note.noteable.update(author: user)
end
it 'returns true' do
expect(subject).to be_truthy
end
end
context 'when the provided user is neither author nor assignee' do
it 'returns true' do
expect(subject).to be_falsey
end
end
end
context 'when user is nil' do
let(:user) { nil }
it 'returns false' do
expect(subject).to be_falsey
end
end
context 'when noteable is an issue' do
it_behaves_like 'author check'
it_behaves_like 'assignee check'
end
context 'when noteable is a merge request' do
let(:noteable) { create(:merge_request) }
it_behaves_like 'author check'
it_behaves_like 'assignee check'
end
context 'when noteable is a snippet' do
let(:noteable) { create(:personal_snippet) }
it_behaves_like 'author check'
end
end
end
end
Loading
Loading
@@ -7,11 +7,6 @@ describe PagesDomain do
 
subject(:pages_domain) { described_class.new }
 
# Locking in date due to cert expiration date https://gitlab.com/gitlab-org/gitlab/-/issues/210557#note_304749257
around do |example|
Timecop.travel(Time.new(2020, 3, 12)) { example.run }
end
describe 'associations' do
it { is_expected.to belong_to(:project) }
it { is_expected.to have_many(:serverless_domain_clusters) }
Loading
Loading
@@ -102,8 +97,8 @@ describe PagesDomain do
it 'saves validity time' do
domain.save
 
expect(domain.certificate_valid_not_before).to be_like_time(Time.parse("2016-02-12 14:32:00 UTC"))
expect(domain.certificate_valid_not_after).to be_like_time(Time.parse("2020-04-12 14:32:00 UTC"))
expect(domain.certificate_valid_not_before).to be_like_time(Time.parse("2020-03-16 14:20:34 UTC"))
expect(domain.certificate_valid_not_after).to be_like_time(Time.parse("2220-01-28 14:20:34 UTC"))
end
end
 
Loading
Loading
Loading
Loading
@@ -151,51 +151,4 @@ describe ZoomMeeting do
it_behaves_like 'can remove meetings'
end
end
describe '.distinct_count_by' do
let(:issue_1) { create(:issue) }
let(:issue_2) { create(:issue) }
context 'two meetings for the same issue' do
before do
create(:zoom_meeting, issue: issue_1)
create(:zoom_meeting, :removed_from_issue, issue: issue_1)
end
it 'returns a count of 1' do
expect(described_class.distinct_count_by(:issue_id)).to eq(1)
end
context 'when given no colum to count' do
it 'counts by :id and returns a count of 2' do
expect(described_class.distinct_count_by).to eq(2)
end
end
end
context 'one meeting for each issue' do
it 'returns a count of 2' do
create(:zoom_meeting, issue: issue_1)
create(:zoom_meeting, issue: issue_2)
expect(described_class.distinct_count_by(:issue_id)).to eq(2)
end
end
context 'the count query times out' do
before do
allow_next_instance_of(ActiveRecord::Relation) do |instance|
allow(instance).to receive(:count).and_raise(ActiveRecord::StatementInvalid.new(''))
end
end
it 'does not raise an error' do
expect { described_class.distinct_count_by(:issue_id) }.not_to raise_error
end
it 'returns -1' do
expect(described_class.distinct_count_by(:issue_id)).to eq(-1)
end
end
end
end
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