Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a76b3bd5
Commit
a76b3bd5
authored
May 12, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Time.now => Time.current
- Services in EE and CE - Specs included
parent
d2971491
Changes
71
Show whitespace changes
Inline
Side-by-side
Showing
71 changed files
with
99 additions
and
99 deletions
+99
-99
app/services/auth/container_registry_authentication_service.rb
...ervices/auth/container_registry_authentication_service.rb
+1
-1
app/services/ci/register_job_service.rb
app/services/ci/register_job_service.rb
+1
-1
app/services/clusters/applications/check_installation_progress_service.rb
...sters/applications/check_installation_progress_service.rb
+1
-1
app/services/clusters/applications/check_uninstall_progress_service.rb
...clusters/applications/check_uninstall_progress_service.rb
+1
-1
app/services/clusters/applications/check_upgrade_progress_service.rb
...s/clusters/applications/check_upgrade_progress_service.rb
+1
-1
app/services/clusters/applications/schedule_update_service.rb
...services/clusters/applications/schedule_update_service.rb
+3
-3
app/services/clusters/gcp/verify_provision_status_service.rb
app/services/clusters/gcp/verify_provision_status_service.rb
+1
-1
app/services/clusters/kubernetes/configure_istio_ingress_service.rb
...es/clusters/kubernetes/configure_istio_ingress_service.rb
+2
-2
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+2
-2
app/services/members/request_access_service.rb
app/services/members/request_access_service.rb
+1
-1
app/services/projects/container_repository/cleanup_tags_service.rb
...ces/projects/container_repository/cleanup_tags_service.rb
+1
-1
app/services/projects/hashed_storage/base_attachment_service.rb
...rvices/projects/hashed_storage/base_attachment_service.rb
+1
-1
app/services/projects/update_repository_storage_service.rb
app/services/projects/update_repository_storage_service.rb
+1
-1
app/services/spam/akismet_service.rb
app/services/spam/akismet_service.rb
+1
-1
app/services/terraform/remote_state_handler.rb
app/services/terraform/remote_state_handler.rb
+1
-1
app/services/verify_pages_domain_service.rb
app/services/verify_pages_domain_service.rb
+2
-2
ee/app/services/clear_namespace_shared_runners_minutes_service.rb
...ervices/clear_namespace_shared_runners_minutes_service.rb
+1
-1
ee/app/services/ee/audit_events/repository_push_audit_event_service.rb
...es/ee/audit_events/repository_push_audit_event_service.rb
+2
-2
ee/app/services/ee/issuable/common_system_notes_service.rb
ee/app/services/ee/issuable/common_system_notes_service.rb
+1
-1
ee/app/services/elastic/process_bookkeeping_service.rb
ee/app/services/elastic/process_bookkeeping_service.rb
+2
-2
ee/app/services/geo/blob_download_service.rb
ee/app/services/geo/blob_download_service.rb
+2
-2
ee/app/services/geo/blob_verification_secondary_service.rb
ee/app/services/geo/blob_verification_secondary_service.rb
+1
-1
ee/app/services/geo/design_repository_sync_service.rb
ee/app/services/geo/design_repository_sync_service.rb
+1
-1
ee/app/services/geo/file_download_service.rb
ee/app/services/geo/file_download_service.rb
+2
-2
ee/app/services/geo/repository_verification_primary_service.rb
...p/services/geo/repository_verification_primary_service.rb
+1
-1
ee/app/services/geo/repository_verification_secondary_service.rb
...services/geo/repository_verification_secondary_service.rb
+1
-1
ee/app/services/groups/mark_for_deletion_service.rb
ee/app/services/groups/mark_for_deletion_service.rb
+1
-1
ee/app/services/merge_requests/create_from_vulnerability_data_service.rb
.../merge_requests/create_from_vulnerability_data_service.rb
+1
-1
ee/app/services/projects/mark_for_deletion_service.rb
ee/app/services/projects/mark_for_deletion_service.rb
+1
-1
ee/app/services/vulnerability_exports/export_service.rb
ee/app/services/vulnerability_exports/export_service.rb
+1
-1
ee/spec/services/ci/minutes/batch_reset_service_spec.rb
ee/spec/services/ci/minutes/batch_reset_service_spec.rb
+1
-1
ee/spec/services/ci/minutes/email_notification_service_spec.rb
...ec/services/ci/minutes/email_notification_service_spec.rb
+1
-1
ee/spec/services/clear_namespace_shared_runners_minutes_service_spec.rb
...es/clear_namespace_shared_runners_minutes_service_spec.rb
+1
-1
ee/spec/services/ee/boards/issues/list_service_spec.rb
ee/spec/services/ee/boards/issues/list_service_spec.rb
+1
-1
ee/spec/services/ee/issuable/common_system_notes_service_spec.rb
.../services/ee/issuable/common_system_notes_service_spec.rb
+1
-1
ee/spec/services/ee/merge_request_metrics_service_spec.rb
ee/spec/services/ee/merge_request_metrics_service_spec.rb
+1
-1
ee/spec/services/ee/resource_events/merge_into_notes_service_spec.rb
...vices/ee/resource_events/merge_into_notes_service_spec.rb
+1
-1
ee/spec/services/ee/system_notes/epics_service_spec.rb
ee/spec/services/ee/system_notes/epics_service_spec.rb
+1
-1
ee/spec/services/geo/blob_verification_secondary_service_spec.rb
.../services/geo/blob_verification_secondary_service_spec.rb
+3
-3
ee/spec/services/geo/file_download_service_spec.rb
ee/spec/services/geo/file_download_service_spec.rb
+4
-4
ee/spec/services/geo/metrics_update_service_spec.rb
ee/spec/services/geo/metrics_update_service_spec.rb
+1
-1
ee/spec/services/geo/repository_sync_service_spec.rb
ee/spec/services/geo/repository_sync_service_spec.rb
+1
-1
ee/spec/services/geo/repository_verification_primary_service_spec.rb
...vices/geo/repository_verification_primary_service_spec.rb
+2
-2
ee/spec/services/geo/repository_verification_secondary_service_spec.rb
...ces/geo/repository_verification_secondary_service_spec.rb
+4
-4
ee/spec/services/ldap_group_reset_service_spec.rb
ee/spec/services/ldap_group_reset_service_spec.rb
+2
-2
ee/spec/services/security/waf_anomaly_summary_service_spec.rb
...pec/services/security/waf_anomaly_summary_service_spec.rb
+1
-1
ee/spec/services/vulnerability_exports/export_service_spec.rb
...pec/services/vulnerability_exports/export_service_spec.rb
+1
-1
spec/services/auth/container_registry_authentication_service_spec.rb
...es/auth/container_registry_authentication_service_spec.rb
+2
-2
spec/services/boards/issues/list_service_spec.rb
spec/services/boards/issues/list_service_spec.rb
+1
-1
spec/services/clusters/applications/schedule_update_service_spec.rb
...ces/clusters/applications/schedule_update_service_spec.rb
+3
-3
spec/services/clusters/kubernetes/configure_istio_ingress_service_spec.rb
...usters/kubernetes/configure_istio_ingress_service_spec.rb
+2
-2
spec/services/cohorts_service_spec.rb
spec/services/cohorts_service_spec.rb
+1
-1
spec/services/git/branch_push_service_spec.rb
spec/services/git/branch_push_service_spec.rb
+1
-1
spec/services/incident_management/create_issue_service_spec.rb
...services/incident_management/create_issue_service_spec.rb
+2
-2
spec/services/issues/close_service_spec.rb
spec/services/issues/close_service_spec.rb
+1
-1
spec/services/issues/update_service_spec.rb
spec/services/issues/update_service_spec.rb
+1
-1
spec/services/merge_requests/merge_service_spec.rb
spec/services/merge_requests/merge_service_spec.rb
+1
-1
spec/services/merge_requests/refresh_service_spec.rb
spec/services/merge_requests/refresh_service_spec.rb
+1
-1
spec/services/merge_requests/update_service_spec.rb
spec/services/merge_requests/update_service_spec.rb
+1
-1
spec/services/note_summary_spec.rb
spec/services/note_summary_spec.rb
+1
-1
spec/services/notes/create_service_spec.rb
spec/services/notes/create_service_spec.rb
+1
-1
spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb
...s_domains/obtain_lets_encrypt_certificate_service_spec.rb
+1
-1
spec/services/projects/alerting/notify_service_spec.rb
spec/services/projects/alerting/notify_service_spec.rb
+1
-1
spec/services/projects/hashed_storage/base_attachment_service_spec.rb
...s/projects/hashed_storage/base_attachment_service_spec.rb
+1
-1
spec/services/projects/prometheus/alerts/create_events_service_spec.rb
.../projects/prometheus/alerts/create_events_service_spec.rb
+3
-3
spec/services/projects/update_repository_storage_service_spec.rb
...rvices/projects/update_repository_storage_service_spec.rb
+1
-1
spec/services/quick_actions/interpret_service_spec.rb
spec/services/quick_actions/interpret_service_spec.rb
+2
-2
spec/services/repository_archive_clean_up_service_spec.rb
spec/services/repository_archive_clean_up_service_spec.rb
+1
-1
spec/services/resource_events/merge_into_notes_service_spec.rb
...services/resource_events/merge_into_notes_service_spec.rb
+1
-1
spec/services/update_merge_request_metrics_service_spec.rb
spec/services/update_merge_request_metrics_service_spec.rb
+2
-2
spec/services/verify_pages_domain_service_spec.rb
spec/services/verify_pages_domain_service_spec.rb
+1
-1
No files found.
app/services/auth/container_registry_authentication_service.rb
View file @
a76b3bd5
...
@@ -52,7 +52,7 @@ module Auth
...
@@ -52,7 +52,7 @@ module Auth
end
end
def
self
.
token_expire_at
def
self
.
token_expire_at
Time
.
now
+
Gitlab
::
CurrentSettings
.
container_registry_token_expire_delay
.
minutes
Time
.
current
+
Gitlab
::
CurrentSettings
.
container_registry_token_expire_delay
.
minutes
end
end
private
private
...
...
app/services/ci/register_job_service.rb
View file @
a76b3bd5
...
@@ -201,7 +201,7 @@ module Ci
...
@@ -201,7 +201,7 @@ module Ci
labels
[
:shard
]
=
shard
.
gsub
(
METRICS_SHARD_TAG_PREFIX
,
''
)
if
shard
labels
[
:shard
]
=
shard
.
gsub
(
METRICS_SHARD_TAG_PREFIX
,
''
)
if
shard
end
end
job_queue_duration_seconds
.
observe
(
labels
,
Time
.
now
-
job
.
queued_at
)
unless
job
.
queued_at
.
nil?
job_queue_duration_seconds
.
observe
(
labels
,
Time
.
current
-
job
.
queued_at
)
unless
job
.
queued_at
.
nil?
attempt_counter
.
increment
attempt_counter
.
increment
end
end
...
...
app/services/clusters/applications/check_installation_progress_service.rb
View file @
a76b3bd5
...
@@ -33,7 +33,7 @@ module Clusters
...
@@ -33,7 +33,7 @@ module Clusters
end
end
def
timed_out?
def
timed_out?
Time
.
now
.
utc
-
app
.
updated_at
.
utc
>
ClusterWaitForAppInstallationWorker
::
TIMEOUT
Time
.
current
.
utc
-
app
.
updated_at
.
utc
>
ClusterWaitForAppInstallationWorker
::
TIMEOUT
end
end
def
remove_installation_pod
def
remove_installation_pod
...
...
app/services/clusters/applications/check_uninstall_progress_service.rb
View file @
a76b3bd5
...
@@ -31,7 +31,7 @@ module Clusters
...
@@ -31,7 +31,7 @@ module Clusters
end
end
def
timed_out?
def
timed_out?
Time
.
now
.
utc
-
app
.
updated_at
.
utc
>
WaitForUninstallAppWorker
::
TIMEOUT
Time
.
current
.
utc
-
app
.
updated_at
.
utc
>
WaitForUninstallAppWorker
::
TIMEOUT
end
end
def
remove_uninstallation_pod
def
remove_uninstallation_pod
...
...
app/services/clusters/applications/check_upgrade_progress_service.rb
View file @
a76b3bd5
...
@@ -46,7 +46,7 @@ module Clusters
...
@@ -46,7 +46,7 @@ module Clusters
end
end
def
timed_out?
def
timed_out?
Time
.
now
.
utc
-
app
.
updated_at
.
to_time
.
utc
>
::
ClusterWaitForAppUpdateWorker
::
TIMEOUT
Time
.
current
.
utc
-
app
.
updated_at
.
to_time
.
utc
>
::
ClusterWaitForAppUpdateWorker
::
TIMEOUT
end
end
def
remove_pod
def
remove_pod
...
...
app/services/clusters/applications/schedule_update_service.rb
View file @
a76b3bd5
...
@@ -16,9 +16,9 @@ module Clusters
...
@@ -16,9 +16,9 @@ module Clusters
return
unless
application
return
unless
application
if
recently_scheduled?
if
recently_scheduled?
worker_class
.
perform_in
(
BACKOFF_DELAY
,
application
.
name
,
application
.
id
,
project
.
id
,
Time
.
now
)
worker_class
.
perform_in
(
BACKOFF_DELAY
,
application
.
name
,
application
.
id
,
project
.
id
,
Time
.
current
)
else
else
worker_class
.
perform_async
(
application
.
name
,
application
.
id
,
project
.
id
,
Time
.
now
)
worker_class
.
perform_async
(
application
.
name
,
application
.
id
,
project
.
id
,
Time
.
current
)
end
end
end
end
...
@@ -31,7 +31,7 @@ module Clusters
...
@@ -31,7 +31,7 @@ module Clusters
def
recently_scheduled?
def
recently_scheduled?
return
false
unless
application
.
last_update_started_at
return
false
unless
application
.
last_update_started_at
application
.
last_update_started_at
.
utc
>=
Time
.
now
.
utc
-
BACKOFF_DELAY
application
.
last_update_started_at
.
utc
>=
Time
.
current
.
utc
-
BACKOFF_DELAY
end
end
end
end
end
end
...
...
app/services/clusters/gcp/verify_provision_status_service.rb
View file @
a76b3bd5
...
@@ -35,7 +35,7 @@ module Clusters
...
@@ -35,7 +35,7 @@ module Clusters
end
end
def
elapsed_time_from_creation
(
operation
)
def
elapsed_time_from_creation
(
operation
)
Time
.
now
.
utc
-
operation
.
start_time
.
to_time
.
utc
Time
.
current
.
utc
-
operation
.
start_time
.
to_time
.
utc
end
end
def
finalize_creation
def
finalize_creation
...
...
app/services/clusters/kubernetes/configure_istio_ingress_service.rb
View file @
a76b3bd5
...
@@ -54,8 +54,8 @@ module Clusters
...
@@ -54,8 +54,8 @@ module Clusters
cert
=
OpenSSL
::
X509
::
Certificate
.
new
cert
=
OpenSSL
::
X509
::
Certificate
.
new
cert
.
version
=
2
cert
.
version
=
2
cert
.
serial
=
0
cert
.
serial
=
0
cert
.
not_before
=
Time
.
now
cert
.
not_before
=
Time
.
current
cert
.
not_after
=
Time
.
now
+
1000
.
years
cert
.
not_after
=
Time
.
current
+
1000
.
years
cert
.
public_key
=
key
.
public_key
cert
.
public_key
=
key
.
public_key
cert
.
subject
=
name
cert
.
subject
=
name
...
...
app/services/issuable_base_service.rb
View file @
a76b3bd5
...
@@ -221,7 +221,7 @@ class IssuableBaseService < BaseService
...
@@ -221,7 +221,7 @@ class IssuableBaseService < BaseService
issuable
.
assign_attributes
(
params
)
issuable
.
assign_attributes
(
params
)
if
has_title_or_description_changed?
(
issuable
)
if
has_title_or_description_changed?
(
issuable
)
issuable
.
assign_attributes
(
last_edited_at:
Time
.
now
,
last_edited_by:
current_user
)
issuable
.
assign_attributes
(
last_edited_at:
Time
.
current
,
last_edited_by:
current_user
)
end
end
before_update
(
issuable
)
before_update
(
issuable
)
...
@@ -270,7 +270,7 @@ class IssuableBaseService < BaseService
...
@@ -270,7 +270,7 @@ class IssuableBaseService < BaseService
if
issuable
.
changed?
||
params
.
present?
if
issuable
.
changed?
||
params
.
present?
issuable
.
assign_attributes
(
params
.
merge
(
updated_by:
current_user
,
issuable
.
assign_attributes
(
params
.
merge
(
updated_by:
current_user
,
last_edited_at:
Time
.
now
,
last_edited_at:
Time
.
current
,
last_edited_by:
current_user
))
last_edited_by:
current_user
))
before_update
(
issuable
,
skip_spam_check:
true
)
before_update
(
issuable
,
skip_spam_check:
true
)
...
...
app/services/members/request_access_service.rb
View file @
a76b3bd5
...
@@ -8,7 +8,7 @@ module Members
...
@@ -8,7 +8,7 @@ module Members
source
.
members
.
create
(
source
.
members
.
create
(
access_level:
Gitlab
::
Access
::
DEVELOPER
,
access_level:
Gitlab
::
Access
::
DEVELOPER
,
user:
current_user
,
user:
current_user
,
requested_at:
Time
.
now
.
utc
)
requested_at:
Time
.
current
.
utc
)
end
end
private
private
...
...
app/services/projects/container_repository/cleanup_tags_service.rb
View file @
a76b3bd5
...
@@ -33,7 +33,7 @@ module Projects
...
@@ -33,7 +33,7 @@ module Projects
end
end
def
order_by_date
(
tags
)
def
order_by_date
(
tags
)
now
=
DateTime
.
now
now
=
DateTime
.
current
tags
.
sort_by
{
|
tag
|
tag
.
created_at
||
now
}.
reverse
tags
.
sort_by
{
|
tag
|
tag
.
created_at
||
now
}.
reverse
end
end
...
...
app/services/projects/hashed_storage/base_attachment_service.rb
View file @
a76b3bd5
...
@@ -70,7 +70,7 @@ module Projects
...
@@ -70,7 +70,7 @@ module Projects
#
#
# @param [String] new_path
# @param [String] new_path
def
discard_path!
(
new_path
)
def
discard_path!
(
new_path
)
discarded_path
=
"
#{
new_path
}
-
#{
Time
.
now
.
utc
.
to_i
}
"
discarded_path
=
"
#{
new_path
}
-
#{
Time
.
current
.
utc
.
to_i
}
"
logger
.
info
(
"Moving existing empty attachments folder from '
#{
new_path
}
' to '
#{
discarded_path
}
', (PROJECT_ID=
#{
project
.
id
}
)"
)
logger
.
info
(
"Moving existing empty attachments folder from '
#{
new_path
}
' to '
#{
discarded_path
}
', (PROJECT_ID=
#{
project
.
id
}
)"
)
FileUtils
.
mv
(
new_path
,
discarded_path
)
FileUtils
.
mv
(
new_path
,
discarded_path
)
...
...
app/services/projects/update_repository_storage_service.rb
View file @
a76b3bd5
...
@@ -121,7 +121,7 @@ module Projects
...
@@ -121,7 +121,7 @@ module Projects
end
end
def
moved_path
(
path
)
def
moved_path
(
path
)
"
#{
path
}
+
#{
project
.
id
}
+moved+
#{
Time
.
now
.
to_i
}
"
"
#{
path
}
+
#{
project
.
id
}
+moved+
#{
Time
.
current
.
to_i
}
"
end
end
# The underlying FetchInternalRemote call uses a `git fetch` to move data
# The underlying FetchInternalRemote call uses a `git fetch` to move data
...
...
app/services/spam/akismet_service.rb
View file @
a76b3bd5
...
@@ -17,7 +17,7 @@ module Spam
...
@@ -17,7 +17,7 @@ module Spam
params
=
{
params
=
{
type:
'comment'
,
type:
'comment'
,
text:
text
,
text:
text
,
created_at:
DateTime
.
now
,
created_at:
DateTime
.
current
,
author:
owner_name
,
author:
owner_name
,
author_email:
owner_email
,
author_email:
owner_email
,
referrer:
options
[
:referrer
]
referrer:
options
[
:referrer
]
...
...
app/services/terraform/remote_state_handler.rb
View file @
a76b3bd5
...
@@ -42,7 +42,7 @@ module Terraform
...
@@ -42,7 +42,7 @@ module Terraform
state
.
lock_xid
=
params
[
:lock_id
]
state
.
lock_xid
=
params
[
:lock_id
]
state
.
locked_by_user
=
current_user
state
.
locked_by_user
=
current_user
state
.
locked_at
=
Time
.
now
state
.
locked_at
=
Time
.
current
state
.
save!
state
.
save!
end
end
...
...
app/services/verify_pages_domain_service.rb
View file @
a76b3bd5
...
@@ -37,7 +37,7 @@ class VerifyPagesDomainService < BaseService
...
@@ -37,7 +37,7 @@ class VerifyPagesDomainService < BaseService
# Prevent any pre-existing grace period from being truncated
# Prevent any pre-existing grace period from being truncated
reverify
=
[
domain
.
enabled_until
,
VERIFICATION_PERIOD
.
from_now
].
compact
.
max
reverify
=
[
domain
.
enabled_until
,
VERIFICATION_PERIOD
.
from_now
].
compact
.
max
domain
.
assign_attributes
(
verified_at:
Time
.
now
,
enabled_until:
reverify
,
remove_at:
nil
)
domain
.
assign_attributes
(
verified_at:
Time
.
current
,
enabled_until:
reverify
,
remove_at:
nil
)
domain
.
save!
(
validate:
false
)
domain
.
save!
(
validate:
false
)
if
was_disabled
if
was_disabled
...
@@ -73,7 +73,7 @@ class VerifyPagesDomainService < BaseService
...
@@ -73,7 +73,7 @@ class VerifyPagesDomainService < BaseService
# A domain is only expired until `disable!` has been called
# A domain is only expired until `disable!` has been called
def
expired?
def
expired?
domain
.
enabled_until
&&
domain
.
enabled_until
<
Time
.
now
domain
.
enabled_until
&&
domain
.
enabled_until
<
Time
.
current
end
end
def
dns_record_present?
def
dns_record_present?
...
...
ee/app/services/clear_namespace_shared_runners_minutes_service.rb
View file @
a76b3bd5
...
@@ -9,7 +9,7 @@ class ClearNamespaceSharedRunnersMinutesService < BaseService
...
@@ -9,7 +9,7 @@ class ClearNamespaceSharedRunnersMinutesService < BaseService
def
execute
def
execute
NamespaceStatistics
.
where
(
namespace:
@namespace
).
update_all
(
NamespaceStatistics
.
where
(
namespace:
@namespace
).
update_all
(
shared_runners_seconds:
0
,
shared_runners_seconds:
0
,
shared_runners_seconds_last_reset:
Time
.
now
shared_runners_seconds_last_reset:
Time
.
current
)
)
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
...
...
ee/app/services/ee/audit_events/repository_push_audit_event_service.rb
View file @
a76b3bd5
...
@@ -15,8 +15,8 @@ module EE
...
@@ -15,8 +15,8 @@ module EE
def
attributes
def
attributes
base_payload
.
merge
(
type:
SecurityEvent
.
to_s
,
base_payload
.
merge
(
type:
SecurityEvent
.
to_s
,
created_at:
DateTime
.
now
,
created_at:
DateTime
.
current
,
updated_at:
DateTime
.
now
,
updated_at:
DateTime
.
current
,
details:
@details
.
to_yaml
)
details:
@details
.
to_yaml
)
end
end
...
...
ee/app/services/ee/issuable/common_system_notes_service.rb
View file @
a76b3bd5
...
@@ -38,7 +38,7 @@ module EE
...
@@ -38,7 +38,7 @@ module EE
if
weight_changes_tracking_enabled?
if
weight_changes_tracking_enabled?
# Only create a resource event here if is_update is true to exclude the move issue operation.
# Only create a resource event here if is_update is true to exclude the move issue operation.
# ResourceEvents for moved issues are written within AttributesRewriter.
# ResourceEvents for moved issues are written within AttributesRewriter.
EE
::
ResourceEvents
::
ChangeWeightService
.
new
([
issuable
],
current_user
,
Time
.
now
).
execute
if
is_update
EE
::
ResourceEvents
::
ChangeWeightService
.
new
([
issuable
],
current_user
,
Time
.
current
).
execute
if
is_update
else
else
::
SystemNoteService
.
change_weight_note
(
issuable
,
issuable
.
project
,
current_user
)
::
SystemNoteService
.
change_weight_note
(
issuable
,
issuable
.
project
,
current_user
)
end
end
...
...
ee/app/services/elastic/process_bookkeeping_service.rb
View file @
a76b3bd5
...
@@ -54,7 +54,7 @@ module Elastic
...
@@ -54,7 +54,7 @@ module Elastic
private
private
def
execute_with_redis
(
redis
)
def
execute_with_redis
(
redis
)
start_time
=
Time
.
now
start_time
=
Time
.
current
specs
=
redis
.
zrangebyscore
(
REDIS_SET_KEY
,
'-inf'
,
'+inf'
,
limit:
[
0
,
LIMIT
],
with_scores:
true
)
specs
=
redis
.
zrangebyscore
(
REDIS_SET_KEY
,
'-inf'
,
'+inf'
,
limit:
[
0
,
LIMIT
],
with_scores:
true
)
return
if
specs
.
empty?
return
if
specs
.
empty?
...
@@ -85,7 +85,7 @@ module Elastic
...
@@ -85,7 +85,7 @@ module Elastic
failures_count:
failures
.
count
,
failures_count:
failures
.
count
,
first_score:
first_score
,
first_score:
first_score
,
last_score:
last_score
,
last_score:
last_score
,
bulk_execution_duration_s:
Time
.
now
-
start_time
bulk_execution_duration_s:
Time
.
current
-
start_time
)
)
end
end
...
...
ee/app/services/geo/blob_download_service.rb
View file @
a76b3bd5
...
@@ -25,7 +25,7 @@ module Geo
...
@@ -25,7 +25,7 @@ module Geo
# @return [Boolean] true if synced, false if not
# @return [Boolean] true if synced, false if not
def
execute
def
execute
try_obtain_lease
do
try_obtain_lease
do
start_time
=
Time
.
now
start_time
=
Time
.
current
registry
.
start!
registry
.
start!
...
@@ -60,7 +60,7 @@ module Geo
...
@@ -60,7 +60,7 @@ module Geo
download_success:
download_result
.
success
,
download_success:
download_result
.
success
,
bytes_downloaded:
download_result
.
bytes_downloaded
,
bytes_downloaded:
download_result
.
bytes_downloaded
,
primary_missing_file:
download_result
.
primary_missing_file
,
primary_missing_file:
download_result
.
primary_missing_file
,
download_time_s:
(
Time
.
now
-
start_time
).
to_f
.
round
(
3
),
download_time_s:
(
Time
.
current
-
start_time
).
to_f
.
round
(
3
),
reason:
download_result
.
reason
reason:
download_result
.
reason
}
}
metadata
.
merge
(
download_result
.
extra_details
)
if
download_result
.
extra_details
metadata
.
merge
(
download_result
.
extra_details
)
if
download_result
.
extra_details
...
...
ee/app/services/geo/blob_verification_secondary_service.rb
View file @
a76b3bd5
...
@@ -65,7 +65,7 @@ module Geo
...
@@ -65,7 +65,7 @@ module Geo
verification_checksum:
checksum
,
verification_checksum:
checksum
,
verification_checksum_mismatched:
mismatch
,
verification_checksum_mismatched:
mismatch
,
checksum_mismatch:
mismatch
.
present?
,
checksum_mismatch:
mismatch
.
present?
,
verified_at:
Time
.
now
,
verified_at:
Time
.
current
,
verification_failure:
failure
,
verification_failure:
failure
,
verification_retry_count:
verification_retry_count
,
verification_retry_count:
verification_retry_count
,
retry_at:
resync_retry_at
,
retry_at:
resync_retry_at
,
...
...
ee/app/services/geo/design_repository_sync_service.rb
View file @
a76b3bd5
...
@@ -75,7 +75,7 @@ module Geo
...
@@ -75,7 +75,7 @@ module Geo
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
def
download_time_in_seconds
def
download_time_in_seconds
(
Time
.
now
.
to_f
-
registry
.
last_synced_at
.
to_f
).
round
(
3
)
(
Time
.
current
.
to_f
-
registry
.
last_synced_at
.
to_f
).
round
(
3
)
end
end
def
redownload?
def
redownload?
...
...
ee/app/services/geo/file_download_service.rb
View file @
a76b3bd5
...
@@ -15,7 +15,7 @@ module Geo
...
@@ -15,7 +15,7 @@ module Geo
def
execute
def
execute
try_obtain_lease
do
try_obtain_lease
do
start_time
=
Time
.
now
start_time
=
Time
.
current
download_result
=
downloader
.
execute
download_result
=
downloader
.
execute
...
@@ -49,7 +49,7 @@ module Geo
...
@@ -49,7 +49,7 @@ module Geo
bytes_downloaded:
download_result
.
bytes_downloaded
,
bytes_downloaded:
download_result
.
bytes_downloaded
,
failed_before_transfer:
download_result
.
failed_before_transfer
,
failed_before_transfer:
download_result
.
failed_before_transfer
,
primary_missing_file:
download_result
.
primary_missing_file
,
primary_missing_file:
download_result
.
primary_missing_file
,
download_time_s:
(
Time
.
now
-
start_time
).
to_f
.
round
(
3
)
download_time_s:
(
Time
.
current
-
start_time
).
to_f
.
round
(
3
)
}
}
log_info
(
"File download"
,
metadata
)
log_info
(
"File download"
,
metadata
)
...
...
ee/app/services/geo/repository_verification_primary_service.rb
View file @
a76b3bd5
...
@@ -33,7 +33,7 @@ module Geo
...
@@ -33,7 +33,7 @@ module Geo
repository_state
.
update!
(
repository_state
.
update!
(
"
#{
type
}
_verification_checksum"
=>
checksum
,
"
#{
type
}
_verification_checksum"
=>
checksum
,
"last_
#{
type
}
_verification_ran_at"
=>
Time
.
now
,
"last_
#{
type
}
_verification_ran_at"
=>
Time
.
current
,
"last_
#{
type
}
_verification_failure"
=>
failure
,
"last_
#{
type
}
_verification_failure"
=>
failure
,
"
#{
type
}
_retry_at"
=>
retry_at
,
"
#{
type
}
_retry_at"
=>
retry_at
,
"
#{
type
}
_retry_count"
=>
retry_count
"
#{
type
}
_retry_count"
=>
retry_count
...
...
ee/app/services/geo/repository_verification_secondary_service.rb
View file @
a76b3bd5
...
@@ -74,7 +74,7 @@ module Geo
...
@@ -74,7 +74,7 @@ module Geo
"
#{
type
}
_verification_checksum_sha"
=>
checksum
,
"
#{
type
}
_verification_checksum_sha"
=>
checksum
,
"
#{
type
}
_verification_checksum_mismatched"
=>
mismatch
,
"
#{
type
}
_verification_checksum_mismatched"
=>
mismatch
,
"
#{
type
}
_checksum_mismatch"
=>
mismatch
.
present?
,
"
#{
type
}
_checksum_mismatch"
=>
mismatch
.
present?
,
"last_
#{
type
}
_verification_ran_at"
=>
Time
.
now
,
"last_
#{
type
}
_verification_ran_at"
=>
Time
.
current
,
"last_
#{
type
}
_verification_failure"
=>
failure
,
"last_
#{
type
}
_verification_failure"
=>
failure
,
"
#{
type
}
_verification_retry_count"
=>
verification_retry_count
,
"
#{
type
}
_verification_retry_count"
=>
verification_retry_count
,
"resync_
#{
type
}
"
=>
reverify
,
"resync_
#{
type
}
"
=>
reverify
,
...
...
ee/app/services/groups/mark_for_deletion_service.rb
View file @
a76b3bd5
...
@@ -27,7 +27,7 @@ module Groups
...
@@ -27,7 +27,7 @@ module Groups
end
end
def
deletion_schedule_params
def
deletion_schedule_params
{
marked_for_deletion_on:
Time
.
now
.
utc
,
deleting_user:
current_user
}
{
marked_for_deletion_on:
Time
.
current
.
utc
,
deleting_user:
current_user
}
end
end
def
log_audit_event
def
log_audit_event
...
...
ee/app/services/merge_requests/create_from_vulnerability_data_service.rb
View file @
a76b3bd5
...
@@ -12,7 +12,7 @@ module MergeRequests
...
@@ -12,7 +12,7 @@ module MergeRequests
title_slug
=
Gitlab
::
Utils
.
slugify
(
vulnerability
.
title
)
title_slug
=
Gitlab
::
Utils
.
slugify
(
vulnerability
.
title
)
source_branch
=
"remediate/%s-%s"
%
[
source_branch
=
"remediate/%s-%s"
%
[
title_slug
[
0
..
74
],
title_slug
[
0
..
74
],
Time
.
now
.
strftime
(
"D%Y%m%dT%H%M%S"
)
Time
.
current
.
strftime
(
"D%Y%m%dT%H%M%S"
)
]
]
target_branch
=
vulnerability
.
target_branch
||
@project
.
default_branch
target_branch
=
vulnerability
.
target_branch
||
@project
.
default_branch
...
...
ee/app/services/projects/mark_for_deletion_service.rb
View file @
a76b3bd5
...
@@ -10,7 +10,7 @@ module Projects
...
@@ -10,7 +10,7 @@ module Projects
project
,
project
,
current_user
,
current_user
,
{
archived:
true
,
{
archived:
true
,
marked_for_deletion_at:
Time
.
now
.
utc
,
marked_for_deletion_at:
Time
.
current
.
utc
,
deleting_user:
current_user
}
deleting_user:
current_user
}
).
execute
).
execute
log_event
if
result
[
:status
]
==
:success
log_event
if
result
[
:status
]
==
:success
...
...
ee/app/services/vulnerability_exports/export_service.rb
View file @
a76b3bd5
...
@@ -67,7 +67,7 @@ module VulnerabilityExports
...
@@ -67,7 +67,7 @@ module VulnerabilityExports
[
[
exportable
.
full_path
.
parameterize
,
exportable
.
full_path
.
parameterize
,
'_vulnerabilities_'
,
'_vulnerabilities_'
,
Time
.
now
.
utc
.
strftime
(
'%FT%H%M'
),
Time
.
current
.
utc
.
strftime
(
'%FT%H%M'
),
'.'
,
'.'
,
format
format
].
join
].
join
...
...
ee/spec/services/ci/minutes/batch_reset_service_spec.rb
View file @
a76b3bd5
...
@@ -11,7 +11,7 @@ describe Ci::Minutes::BatchResetService do
...
@@ -11,7 +11,7 @@ describe Ci::Minutes::BatchResetService do
id:
id
,
id:
id
,
shared_runners_minutes_limit:
100
,
shared_runners_minutes_limit:
100
,
extra_shared_runners_minutes_limit:
50
,
extra_shared_runners_minutes_limit:
50
,
last_ci_minutes_notification_at:
Time
.
now
,
last_ci_minutes_notification_at:
Time
.
current
,
last_ci_minutes_usage_notification_level:
30
)
last_ci_minutes_usage_notification_level:
30
)
create
(
:namespace_statistics
,
namespace:
namespace
,
shared_runners_seconds:
seconds_used
)
create
(
:namespace_statistics
,
namespace:
namespace
,
shared_runners_seconds:
seconds_used
)
...
...
ee/spec/services/ci/minutes/email_notification_service_spec.rb
View file @
a76b3bd5
...
@@ -125,7 +125,7 @@ describe Ci::Minutes::EmailNotificationService do
...
@@ -125,7 +125,7 @@ describe Ci::Minutes::EmailNotificationService do
context
'when last_ci_minutes_notification_at has a value'
do
context
'when last_ci_minutes_notification_at has a value'
do
before
do
before
do
namespace
.
update_attribute
(
:last_ci_minutes_notification_at
,
Time
.
now
)
namespace
.
update_attribute
(
:last_ci_minutes_notification_at
,
Time
.
current
)
end
end
it
'does not notify owners'
do
it
'does not notify owners'
do
...
...
ee/spec/services/clear_namespace_shared_runners_minutes_service_spec.rb
View file @
a76b3bd5
...
@@ -18,7 +18,7 @@ describe ClearNamespaceSharedRunnersMinutesService do
...
@@ -18,7 +18,7 @@ describe ClearNamespaceSharedRunnersMinutesService do
it
'resets timer'
do
it
'resets timer'
do
subject
subject
expect
(
namespace
.
namespace_statistics
.
reload
.
shared_runners_seconds_last_reset
).
to
be_like_time
(
Time
.
now
)
expect
(
namespace
.
namespace_statistics
.
reload
.
shared_runners_seconds_last_reset
).
to
be_like_time
(
Time
.
current
)
end
end
it
'successfully clears minutes'
do
it
'successfully clears minutes'
do
...
...
ee/spec/services/ee/boards/issues/list_service_spec.rb
View file @
a76b3bd5
...
@@ -32,7 +32,7 @@ describe Boards::Issues::ListService, services: true do
...
@@ -32,7 +32,7 @@ describe Boards::Issues::ListService, services: true do
let!
(
:opened_issue1
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m1
,
weight:
9
,
title:
'Issue 1'
,
labels:
[
bug
])
}
let!
(
:opened_issue1
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m1
,
weight:
9
,
title:
'Issue 1'
,
labels:
[
bug
])
}
let!
(
:opened_issue2
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m2
,
weight:
1
,
title:
'Issue 2'
,
labels:
[
p2
])
}
let!
(
:opened_issue2
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m2
,
weight:
1
,
title:
'Issue 2'
,
labels:
[
p2
])
}
let!
(
:opened_issue3
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m2
,
title:
'Assigned Issue'
,
labels:
[
p3
])
}
let!
(
:opened_issue3
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m2
,
title:
'Assigned Issue'
,
labels:
[
p3
])
}
let!
(
:reopened_issue1
)
{
create
(
:issue
,
state:
'opened'
,
project:
project
,
title:
'Issue 3'
,
closed_at:
Time
.
now
)
}
let!
(
:reopened_issue1
)
{
create
(
:issue
,
state:
'opened'
,
project:
project
,
title:
'Issue 3'
,
closed_at:
Time
.
current
)
}
let
(
:list1_issue1
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m1
,
labels:
[
p2
,
development
])
}
let
(
:list1_issue1
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m1
,
labels:
[
p2
,
development
])
}
let
(
:list1_issue2
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m2
,
labels:
[
development
])
}
let
(
:list1_issue2
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m2
,
labels:
[
development
])
}
...
...
ee/spec/services/ee/issuable/common_system_notes_service_spec.rb
View file @
a76b3bd5
...
@@ -52,7 +52,7 @@ describe Issuable::CommonSystemNotesService do
...
@@ -52,7 +52,7 @@ describe Issuable::CommonSystemNotesService do
end
end
context
'when issuable is an epic'
do
context
'when issuable is an epic'
do
let
(
:timestamp
)
{
Time
.
now
}
let
(
:timestamp
)
{
Time
.
current
}
let
(
:issuable
)
{
create
(
:epic
,
end_date:
timestamp
)
}
let
(
:issuable
)
{
create
(
:epic
,
end_date:
timestamp
)
}
subject
{
described_class
.
new
(
nil
,
user
).
execute
(
issuable
,
old_labels:
[])
}
subject
{
described_class
.
new
(
nil
,
user
).
execute
(
issuable
,
old_labels:
[])
}
...
...
ee/spec/services/ee/merge_request_metrics_service_spec.rb
View file @
a76b3bd5
...
@@ -14,7 +14,7 @@ describe EE::MergeRequestMetricsService do
...
@@ -14,7 +14,7 @@ describe EE::MergeRequestMetricsService do
describe
'#merge'
do
describe
'#merge'
do
let
(
:merge_request
)
{
create
(
:merge_request
,
:merged
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
:merged
)
}
let
(
:expected_commit_count
)
{
21
}
let
(
:expected_commit_count
)
{
21
}
let
(
:event
)
{
instance_double
(
'Event'
,
author_id:
merge_request
.
author
.
id
,
created_at:
Time
.
now
)
}
let
(
:event
)
{
instance_double
(
'Event'
,
author_id:
merge_request
.
author
.
id
,
created_at:
Time
.
current
)
}
it
'saves metrics with productivity_data'
do
it
'saves metrics with productivity_data'
do
allow
(
merge_request
).
to
receive
(
:commits_count
).
and_return
(
expected_commit_count
)
allow
(
merge_request
).
to
receive
(
:commits_count
).
and_return
(
expected_commit_count
)
...
...
ee/spec/services/ee/resource_events/merge_into_notes_service_spec.rb
View file @
a76b3bd5
...
@@ -26,7 +26,7 @@ describe ResourceEvents::MergeIntoNotesService do
...
@@ -26,7 +26,7 @@ describe ResourceEvents::MergeIntoNotesService do
let_it_be
(
:scoped_label_group2_1
)
{
create
(
:label
,
project:
project
,
title:
'key2::value'
)
}
let_it_be
(
:scoped_label_group2_1
)
{
create
(
:label
,
project:
project
,
title:
'key2::value'
)
}
let_it_be
(
:scoped_label_group2_2
)
{
create
(
:label
,
project:
project
,
title:
'key2::value2'
)
}
let_it_be
(
:scoped_label_group2_2
)
{
create
(
:label
,
project:
project
,
title:
'key2::value2'
)
}
let_it_be
(
:scoped_label_group3_1
)
{
create
(
:label
,
project:
project
,
title:
'key3::value'
)
}
let_it_be
(
:scoped_label_group3_1
)
{
create
(
:label
,
project:
project
,
title:
'key3::value'
)
}
let
(
:time
)
{
Time
.
now
}
let
(
:time
)
{
Time
.
current
}
describe
'#execute'
do
describe
'#execute'
do
it
'squashes events with same time and author into single note but scoped labels are separated'
do
it
'squashes events with same time and author into single note but scoped labels are separated'
do
...
...
ee/spec/services/ee/system_notes/epics_service_spec.rb
View file @
a76b3bd5
...
@@ -73,7 +73,7 @@ describe EE::SystemNotes::EpicsService do
...
@@ -73,7 +73,7 @@ describe EE::SystemNotes::EpicsService do
end
end
describe
'#change_epic_date_note'
do
describe
'#change_epic_date_note'
do
let
(
:timestamp
)
{
Time
.
now
}
let
(
:timestamp
)
{
Time
.
current
}
context
'when start date was changed'
do
context
'when start date was changed'
do
let
(
:noteable
)
{
create
(
:epic
)
}
let
(
:noteable
)
{
create
(
:epic
)
}
...
...
ee/spec/services/geo/blob_verification_secondary_service_spec.rb
View file @
a76b3bd5
...
@@ -67,7 +67,7 @@ describe Geo::BlobVerificationSecondaryService, :geo do
...
@@ -67,7 +67,7 @@ describe Geo::BlobVerificationSecondaryService, :geo do
expect
(
registry
.
reload
).
to
have_attributes
(
expect
(
registry
.
reload
).
to
have_attributes
(
verification_checksum:
'62fc1ec4ce60'
,
verification_checksum:
'62fc1ec4ce60'
,
checksum_mismatch:
false
,
checksum_mismatch:
false
,
verified_at:
be_within
(
1
.
minute
).
of
(
Time
.
now
),
verified_at:
be_within
(
1
.
minute
).
of
(
Time
.
current
),
verification_failure:
nil
,
verification_failure:
nil
,
verification_retry_count:
nil
,
verification_retry_count:
nil
,
retry_at:
nil
,
retry_at:
nil
,
...
@@ -87,7 +87,7 @@ describe Geo::BlobVerificationSecondaryService, :geo do
...
@@ -87,7 +87,7 @@ describe Geo::BlobVerificationSecondaryService, :geo do
verification_checksum:
nil
,
verification_checksum:
nil
,
verification_checksum_mismatched:
'99fc1ec4ce60'
,
verification_checksum_mismatched:
'99fc1ec4ce60'
,
checksum_mismatch:
true
,
checksum_mismatch:
true
,
verified_at:
be_within
(
1
.
minute
).
of
(
Time
.
now
),
verified_at:
be_within
(
1
.
minute
).
of
(
Time
.
current
),
verification_failure:
'checksum mismatch'
,
verification_failure:
'checksum mismatch'
,
verification_retry_count:
1
,
verification_retry_count:
1
,
retry_at:
be_present
,
retry_at:
be_present
,
...
@@ -119,7 +119,7 @@ describe Geo::BlobVerificationSecondaryService, :geo do
...
@@ -119,7 +119,7 @@ describe Geo::BlobVerificationSecondaryService, :geo do
verification_checksum:
nil
,
verification_checksum:
nil
,
verification_checksum_mismatched:
nil
,
verification_checksum_mismatched:
nil
,
checksum_mismatch:
false
,
checksum_mismatch:
false
,
verified_at:
be_within
(
1
.
minute
).
of
(
Time
.
now
),
verified_at:
be_within
(
1
.
minute
).
of
(
Time
.
current
),
verification_failure:
'Error calculating checksum'
,
verification_failure:
'Error calculating checksum'
,
verification_retry_count:
1
,
verification_retry_count:
1
,
retry_at:
be_present
,
retry_at:
be_present
,
...
...
ee/spec/services/geo/file_download_service_spec.rb
View file @
a76b3bd5
...
@@ -194,7 +194,7 @@ describe Geo::FileDownloadService do
...
@@ -194,7 +194,7 @@ describe Geo::FileDownloadService do
execute!
execute!
expect
(
registry
.
last
.
reload
.
retry_count
).
to
eq
(
1
)
expect
(
registry
.
last
.
reload
.
retry_count
).
to
eq
(
1
)
expect
(
registry
.
last
.
retry_at
>
Time
.
now
).
to
be_truthy
expect
(
registry
.
last
.
retry_at
>
Time
.
current
).
to
be_truthy
end
end
end
end
end
end
...
@@ -223,7 +223,7 @@ describe Geo::FileDownloadService do
...
@@ -223,7 +223,7 @@ describe Geo::FileDownloadService do
execute!
execute!
expect
(
registry
.
last
.
reload
.
retry_count
).
to
eq
(
1
)
expect
(
registry
.
last
.
reload
.
retry_count
).
to
eq
(
1
)
expect
(
registry
.
last
.
retry_at
>
Time
.
now
).
to
be_truthy
expect
(
registry
.
last
.
retry_at
>
Time
.
current
).
to
be_truthy
end
end
end
end
end
end
...
@@ -315,7 +315,7 @@ describe Geo::FileDownloadService do
...
@@ -315,7 +315,7 @@ describe Geo::FileDownloadService do
execute!
execute!
expect
(
registry_entry
.
reload
.
retry_count
).
to
eq
(
4
)
expect
(
registry_entry
.
reload
.
retry_count
).
to
eq
(
4
)
expect
(
registry_entry
.
retry_at
>
Time
.
now
).
to
be_truthy
expect
(
registry_entry
.
retry_at
>
Time
.
current
).
to
be_truthy
end
end
end
end
...
@@ -354,7 +354,7 @@ describe Geo::FileDownloadService do
...
@@ -354,7 +354,7 @@ describe Geo::FileDownloadService do
execute!
execute!
expect
(
registry_entry
.
reload
.
retry_count
).
to
eq
(
4
)
expect
(
registry_entry
.
reload
.
retry_count
).
to
eq
(
4
)
expect
(
registry_entry
.
retry_at
>
Time
.
now
).
to
be_truthy
expect
(
registry_entry
.
retry_at
>
Time
.
current
).
to
be_truthy
end
end
end
end
...
...
ee/spec/services/geo/metrics_update_service_spec.rb
View file @
a76b3bd5
...
@@ -11,7 +11,7 @@ describe Geo::MetricsUpdateService, :geo, :prometheus do
...
@@ -11,7 +11,7 @@ describe Geo::MetricsUpdateService, :geo, :prometheus do
subject
{
described_class
.
new
}
subject
{
described_class
.
new
}
let
(
:event_date
)
{
Time
.
now
.
utc
}
let
(
:event_date
)
{
Time
.
current
.
utc
}
let
(
:data
)
do
let
(
:data
)
do
{
{
...
...
ee/spec/services/geo/repository_sync_service_spec.rb
View file @
a76b3bd5
...
@@ -365,7 +365,7 @@ describe Geo::RepositorySyncService do
...
@@ -365,7 +365,7 @@ describe Geo::RepositorySyncService do
end
end
it
'successfully redownloads the repository even if the retry time exceeds max value'
do
it
'successfully redownloads the repository even if the retry time exceeds max value'
do
timestamp
=
Time
.
now
.
utc
timestamp
=
Time
.
current
.
utc
registry
=
create
(
registry
=
create
(
:geo_project_registry
,
:geo_project_registry
,
project:
project
,
project:
project
,
...
...
ee/spec/services/geo/repository_verification_primary_service_spec.rb
View file @
a76b3bd5
...
@@ -76,8 +76,8 @@ describe Geo::RepositoryVerificationPrimaryService do
...
@@ -76,8 +76,8 @@ describe Geo::RepositoryVerificationPrimaryService do
subject
.
execute
subject
.
execute
expect
(
project
.
repository_state
).
to
have_attributes
(
expect
(
project
.
repository_state
).
to
have_attributes
(
last_repository_verification_ran_at:
be_within
(
100
.
seconds
).
of
(
Time
.
now
),
last_repository_verification_ran_at:
be_within
(
100
.
seconds
).
of
(
Time
.
current
),
last_wiki_verification_ran_at:
be_within
(
100
.
seconds
).
of
(
Time
.
now
)
last_wiki_verification_ran_at:
be_within
(
100
.
seconds
).
of
(
Time
.
current
)
)
)
end
end
...
...
ee/spec/services/geo/repository_verification_secondary_service_spec.rb
View file @
a76b3bd5
...
@@ -51,7 +51,7 @@ describe Geo::RepositoryVerificationSecondaryService, :geo do
...
@@ -51,7 +51,7 @@ describe Geo::RepositoryVerificationSecondaryService, :geo do
expect
(
registry
).
to
have_attributes
(
expect
(
registry
).
to
have_attributes
(
"
#{
type
}
_verification_checksum_sha"
=>
'62fc1ec4ce60'
,
"
#{
type
}
_verification_checksum_sha"
=>
'62fc1ec4ce60'
,
"
#{
type
}
_checksum_mismatch"
=>
false
,
"
#{
type
}
_checksum_mismatch"
=>
false
,
"last_
#{
type
}
_verification_ran_at"
=>
be_within
(
1
.
minute
).
of
(
Time
.
now
),
"last_
#{
type
}
_verification_ran_at"
=>
be_within
(
1
.
minute
).
of
(
Time
.
current
),
"last_
#{
type
}
_verification_failure"
=>
nil
,
"last_
#{
type
}
_verification_failure"
=>
nil
,
"
#{
type
}
_verification_retry_count"
=>
nil
,
"
#{
type
}
_verification_retry_count"
=>
nil
,
"resync_
#{
type
}
"
=>
false
,
"resync_
#{
type
}
"
=>
false
,
...
@@ -70,7 +70,7 @@ describe Geo::RepositoryVerificationSecondaryService, :geo do
...
@@ -70,7 +70,7 @@ describe Geo::RepositoryVerificationSecondaryService, :geo do
expect
(
registry
).
to
have_attributes
(
expect
(
registry
).
to
have_attributes
(
"
#{
type
}
_verification_checksum_sha"
=>
'0000000000000000000000000000000000000000'
,
"
#{
type
}
_verification_checksum_sha"
=>
'0000000000000000000000000000000000000000'
,
"
#{
type
}
_checksum_mismatch"
=>
false
,
"
#{
type
}
_checksum_mismatch"
=>
false
,
"last_
#{
type
}
_verification_ran_at"
=>
be_within
(
1
.
minute
).
of
(
Time
.
now
),
"last_
#{
type
}
_verification_ran_at"
=>
be_within
(
1
.
minute
).
of
(
Time
.
current
),
"last_
#{
type
}
_verification_failure"
=>
nil
,
"last_
#{
type
}
_verification_failure"
=>
nil
,
"
#{
type
}
_verification_retry_count"
=>
nil
,
"
#{
type
}
_verification_retry_count"
=>
nil
,
"resync_
#{
type
}
"
=>
false
,
"resync_
#{
type
}
"
=>
false
,
...
@@ -91,7 +91,7 @@ describe Geo::RepositoryVerificationSecondaryService, :geo do
...
@@ -91,7 +91,7 @@ describe Geo::RepositoryVerificationSecondaryService, :geo do
"
#{
type
}
_verification_checksum_sha"
=>
nil
,
"
#{
type
}
_verification_checksum_sha"
=>
nil
,
"
#{
type
}
_verification_checksum_mismatched"
=>
'99fc1ec4ce60'
,
"
#{
type
}
_verification_checksum_mismatched"
=>
'99fc1ec4ce60'
,
"
#{
type
}
_checksum_mismatch"
=>
true
,
"
#{
type
}
_checksum_mismatch"
=>
true
,
"last_
#{
type
}
_verification_ran_at"
=>
be_within
(
1
.
minute
).
of
(
Time
.
now
),
"last_
#{
type
}
_verification_ran_at"
=>
be_within
(
1
.
minute
).
of
(
Time
.
current
),
"last_
#{
type
}
_verification_failure"
=>
"
#{
type
.
to_s
.
capitalize
}
checksum mismatch"
,
"last_
#{
type
}
_verification_failure"
=>
"
#{
type
.
to_s
.
capitalize
}
checksum mismatch"
,
"
#{
type
}
_verification_retry_count"
=>
1
,
"
#{
type
}
_verification_retry_count"
=>
1
,
"resync_
#{
type
}
"
=>
true
,
"resync_
#{
type
}
"
=>
true
,
...
@@ -125,7 +125,7 @@ describe Geo::RepositoryVerificationSecondaryService, :geo do
...
@@ -125,7 +125,7 @@ describe Geo::RepositoryVerificationSecondaryService, :geo do
"
#{
type
}
_verification_checksum_sha"
=>
nil
,
"
#{
type
}
_verification_checksum_sha"
=>
nil
,
"
#{
type
}
_verification_checksum_mismatched"
=>
nil
,
"
#{
type
}
_verification_checksum_mismatched"
=>
nil
,
"
#{
type
}
_checksum_mismatch"
=>
false
,
"
#{
type
}
_checksum_mismatch"
=>
false
,
"last_
#{
type
}
_verification_ran_at"
=>
be_within
(
1
.
minute
).
of
(
Time
.
now
),
"last_
#{
type
}
_verification_ran_at"
=>
be_within
(
1
.
minute
).
of
(
Time
.
current
),
"last_
#{
type
}
_verification_failure"
=>
"Error calculating
#{
type
}
checksum"
,
"last_
#{
type
}
_verification_failure"
=>
"Error calculating
#{
type
}
checksum"
,
"
#{
type
}
_verification_retry_count"
=>
1
,
"
#{
type
}
_verification_retry_count"
=>
1
,
"resync_
#{
type
}
"
=>
true
,
"resync_
#{
type
}
"
=>
true
,
...
...
ee/spec/services/ldap_group_reset_service_spec.rb
View file @
a76b3bd5
...
@@ -6,8 +6,8 @@ describe LdapGroupResetService do
...
@@ -6,8 +6,8 @@ describe LdapGroupResetService do
# TODO: refactor to multi-ldap setup
# TODO: refactor to multi-ldap setup
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:ldap_user
)
{
create
(
:omniauth_user
,
extern_uid:
'john'
,
provider:
'ldap'
,
last_credential_check_at:
Time
.
now
)
}
let
(
:ldap_user
)
{
create
(
:omniauth_user
,
extern_uid:
'john'
,
provider:
'ldap'
,
last_credential_check_at:
Time
.
current
)
}
let
(
:ldap_user_2
)
{
create
(
:omniauth_user
,
extern_uid:
'mike'
,
provider:
'ldap'
,
last_credential_check_at:
Time
.
now
)
}
let
(
:ldap_user_2
)
{
create
(
:omniauth_user
,
extern_uid:
'mike'
,
provider:
'ldap'
,
last_credential_check_at:
Time
.
current
)
}
before
do
before
do
group
.
add_owner
(
user
)
group
.
add_owner
(
user
)
...
...
ee/spec/services/security/waf_anomaly_summary_service_spec.rb
View file @
a76b3bd5
...
@@ -226,7 +226,7 @@ describe Security::WafAnomalySummaryService do
...
@@ -226,7 +226,7 @@ describe Security::WafAnomalySummaryService do
context
'with time window'
do
context
'with time window'
do
it
'passes time frame to ElasticSearch'
do
it
'passes time frame to ElasticSearch'
do
from
=
1
.
day
.
ago
from
=
1
.
day
.
ago
to
=
Time
.
now
to
=
Time
.
current
subject
=
described_class
.
new
(
subject
=
described_class
.
new
(
environment:
environment
,
environment:
environment
,
...
...
ee/spec/services/vulnerability_exports/export_service_spec.rb
View file @
a76b3bd5
...
@@ -103,7 +103,7 @@ describe VulnerabilityExports::ExportService do
...
@@ -103,7 +103,7 @@ describe VulnerabilityExports::ExportService do
let
(
:mock_relation
)
{
double
(
:relation
,
with_findings_and_scanner:
vulnerabilities
)
}
let
(
:mock_relation
)
{
double
(
:relation
,
with_findings_and_scanner:
vulnerabilities
)
}
let
(
:mock_vulnerability_finder_service_object
)
{
instance_double
(
Security
::
VulnerabilitiesFinder
,
execute:
mock_relation
)
}
let
(
:mock_vulnerability_finder_service_object
)
{
instance_double
(
Security
::
VulnerabilitiesFinder
,
execute:
mock_relation
)
}
let
(
:exportable_full_path
)
{
'foo'
}
let
(
:exportable_full_path
)
{
'foo'
}
let
(
:time_suffix
)
{
Time
.
now
.
utc
.
strftime
(
'%FT%H%M'
)
}
let
(
:time_suffix
)
{
Time
.
current
.
utc
.
strftime
(
'%FT%H%M'
)
}
let
(
:expected_file_name
)
{
"
#{
exportable_full_path
}
_vulnerabilities_
#{
time_suffix
}
.csv"
}
let
(
:expected_file_name
)
{
"
#{
exportable_full_path
}
_vulnerabilities_
#{
time_suffix
}
.csv"
}
before
do
before
do
...
...
spec/services/auth/container_registry_authentication_service_spec.rb
View file @
a76b3bd5
...
@@ -39,7 +39,7 @@ describe Auth::ContainerRegistryAuthenticationService do
...
@@ -39,7 +39,7 @@ describe Auth::ContainerRegistryAuthenticationService do
let
(
:expire_delay
)
{
10
}
let
(
:expire_delay
)
{
10
}
context
'for default configuration'
do
context
'for default configuration'
do
it
{
expect
(
expires_at
).
not_to
be_within
(
2
.
seconds
).
of
(
Time
.
now
+
expire_delay
.
minutes
)
}
it
{
expect
(
expires_at
).
not_to
be_within
(
2
.
seconds
).
of
(
Time
.
current
+
expire_delay
.
minutes
)
}
end
end
context
'for changed configuration'
do
context
'for changed configuration'
do
...
@@ -47,7 +47,7 @@ describe Auth::ContainerRegistryAuthenticationService do
...
@@ -47,7 +47,7 @@ describe Auth::ContainerRegistryAuthenticationService do
stub_application_setting
(
container_registry_token_expire_delay:
expire_delay
)
stub_application_setting
(
container_registry_token_expire_delay:
expire_delay
)
end
end
it
{
expect
(
expires_at
).
to
be_within
(
2
.
seconds
).
of
(
Time
.
now
+
expire_delay
.
minutes
)
}
it
{
expect
(
expires_at
).
to
be_within
(
2
.
seconds
).
of
(
Time
.
current
+
expire_delay
.
minutes
)
}
end
end
end
end
end
end
...
...
spec/services/boards/issues/list_service_spec.rb
View file @
a76b3bd5
...
@@ -87,7 +87,7 @@ describe Boards::Issues::ListService do
...
@@ -87,7 +87,7 @@ describe Boards::Issues::ListService do
let!
(
:opened_issue1
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m1
,
title:
'Issue 1'
,
labels:
[
bug
])
}
let!
(
:opened_issue1
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m1
,
title:
'Issue 1'
,
labels:
[
bug
])
}
let!
(
:opened_issue2
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m2
,
title:
'Issue 2'
,
labels:
[
p2
,
p2_project
])
}
let!
(
:opened_issue2
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m2
,
title:
'Issue 2'
,
labels:
[
p2
,
p2_project
])
}
let!
(
:opened_issue3
)
{
create
(
:labeled_issue
,
project:
project_archived
,
milestone:
m1
,
title:
'Issue 3'
,
labels:
[
bug
])
}
let!
(
:opened_issue3
)
{
create
(
:labeled_issue
,
project:
project_archived
,
milestone:
m1
,
title:
'Issue 3'
,
labels:
[
bug
])
}
let!
(
:reopened_issue1
)
{
create
(
:issue
,
state:
'opened'
,
project:
project
,
title:
'Reopened Issue 1'
,
closed_at:
Time
.
now
)
}
let!
(
:reopened_issue1
)
{
create
(
:issue
,
state:
'opened'
,
project:
project
,
title:
'Reopened Issue 1'
,
closed_at:
Time
.
current
)
}
let!
(
:list1_issue1
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m1
,
labels:
[
p2
,
p2_project
,
development
])
}
let!
(
:list1_issue1
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m1
,
labels:
[
p2
,
p2_project
,
development
])
}
let!
(
:list1_issue2
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m2
,
labels:
[
development
])
}
let!
(
:list1_issue2
)
{
create
(
:labeled_issue
,
project:
project
,
milestone:
m2
,
labels:
[
development
])
}
...
...
spec/services/clusters/applications/schedule_update_service_spec.rb
View file @
a76b3bd5
...
@@ -13,10 +13,10 @@ describe Clusters::Applications::ScheduleUpdateService do
...
@@ -13,10 +13,10 @@ describe Clusters::Applications::ScheduleUpdateService do
context
'when application is able to be updated'
do
context
'when application is able to be updated'
do
context
'when the application was recently scheduled'
do
context
'when the application was recently scheduled'
do
it
'schedules worker with a backoff delay'
do
it
'schedules worker with a backoff delay'
do
application
=
create
(
:clusters_applications_prometheus
,
:installed
,
last_update_started_at:
Time
.
now
+
5
.
minutes
)
application
=
create
(
:clusters_applications_prometheus
,
:installed
,
last_update_started_at:
Time
.
current
+
5
.
minutes
)
service
=
described_class
.
new
(
application
,
project
)
service
=
described_class
.
new
(
application
,
project
)
expect
(
::
ClusterUpdateAppWorker
).
to
receive
(
:perform_in
).
with
(
described_class
::
BACKOFF_DELAY
,
application
.
name
,
application
.
id
,
project
.
id
,
Time
.
now
).
once
expect
(
::
ClusterUpdateAppWorker
).
to
receive
(
:perform_in
).
with
(
described_class
::
BACKOFF_DELAY
,
application
.
name
,
application
.
id
,
project
.
id
,
Time
.
current
).
once
service
.
execute
service
.
execute
end
end
...
@@ -27,7 +27,7 @@ describe Clusters::Applications::ScheduleUpdateService do
...
@@ -27,7 +27,7 @@ describe Clusters::Applications::ScheduleUpdateService do
application
=
create
(
:clusters_applications_prometheus
,
:installed
)
application
=
create
(
:clusters_applications_prometheus
,
:installed
)
service
=
described_class
.
new
(
application
,
project
)
service
=
described_class
.
new
(
application
,
project
)
expect
(
::
ClusterUpdateAppWorker
).
to
receive
(
:perform_async
).
with
(
application
.
name
,
application
.
id
,
project
.
id
,
Time
.
now
).
once
expect
(
::
ClusterUpdateAppWorker
).
to
receive
(
:perform_async
).
with
(
application
.
name
,
application
.
id
,
project
.
id
,
Time
.
current
).
once
service
.
execute
service
.
execute
end
end
...
...
spec/services/clusters/kubernetes/configure_istio_ingress_service_spec.rb
View file @
a76b3bd5
...
@@ -120,8 +120,8 @@ describe Clusters::Kubernetes::ConfigureIstioIngressService, '#execute' do
...
@@ -120,8 +120,8 @@ describe Clusters::Kubernetes::ConfigureIstioIngressService, '#execute' do
expect
(
certificate
.
subject
.
to_s
).
to
include
(
serverless_domain_cluster
.
knative
.
hostname
)
expect
(
certificate
.
subject
.
to_s
).
to
include
(
serverless_domain_cluster
.
knative
.
hostname
)
expect
(
certificate
.
not_before
).
to
be_within
(
1
.
minute
).
of
(
Time
.
now
)
expect
(
certificate
.
not_before
).
to
be_within
(
1
.
minute
).
of
(
Time
.
current
)
expect
(
certificate
.
not_after
).
to
be_within
(
1
.
minute
).
of
(
Time
.
now
+
1000
.
years
)
expect
(
certificate
.
not_after
).
to
be_within
(
1
.
minute
).
of
(
Time
.
current
+
1000
.
years
)
expect
(
WebMock
).
to
have_requested
(
:put
,
api_url
+
'/api/v1/namespaces/istio-system/secrets/istio-ingressgateway-ca-certs'
).
with
(
expect
(
WebMock
).
to
have_requested
(
:put
,
api_url
+
'/api/v1/namespaces/istio-system/secrets/istio-ingressgateway-ca-certs'
).
with
(
body:
hash_including
(
body:
hash_including
(
...
...
spec/services/cohorts_service_spec.rb
View file @
a76b3bd5
...
@@ -13,7 +13,7 @@ describe CohortsService do
...
@@ -13,7 +13,7 @@ describe CohortsService do
6
.
times
do
|
months_ago
|
6
.
times
do
|
months_ago
|
months_ago_time
=
(
months_ago
*
2
).
months
.
ago
months_ago_time
=
(
months_ago
*
2
).
months
.
ago
create
(
:user
,
created_at:
months_ago_time
,
last_activity_on:
Time
.
now
)
create
(
:user
,
created_at:
months_ago_time
,
last_activity_on:
Time
.
current
)
create
(
:user
,
created_at:
months_ago_time
,
last_activity_on:
months_ago_time
)
create
(
:user
,
created_at:
months_ago_time
,
last_activity_on:
months_ago_time
)
end
end
...
...
spec/services/git/branch_push_service_spec.rb
View file @
a76b3bd5
...
@@ -315,7 +315,7 @@ describe Git::BranchPushService, services: true do
...
@@ -315,7 +315,7 @@ describe Git::BranchPushService, services: true do
let
(
:issue
)
{
create
:issue
,
project:
project
}
let
(
:issue
)
{
create
:issue
,
project:
project
}
let
(
:commit_author
)
{
create
:user
}
let
(
:commit_author
)
{
create
:user
}
let
(
:commit
)
{
project
.
commit
}
let
(
:commit
)
{
project
.
commit
}
let
(
:commit_time
)
{
Time
.
now
}
let
(
:commit_time
)
{
Time
.
current
}
before
do
before
do
project
.
add_developer
(
commit_author
)
project
.
add_developer
(
commit_author
)
...
...
spec/services/incident_management/create_issue_service_spec.rb
View file @
a76b3bd5
...
@@ -6,7 +6,7 @@ describe IncidentManagement::CreateIssueService do
...
@@ -6,7 +6,7 @@ describe IncidentManagement::CreateIssueService do
let
(
:project
)
{
create
(
:project
,
:repository
,
:private
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
:private
)
}
let_it_be
(
:user
)
{
User
.
alert_bot
}
let_it_be
(
:user
)
{
User
.
alert_bot
}
let
(
:service
)
{
described_class
.
new
(
project
,
alert_payload
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
alert_payload
)
}
let
(
:alert_starts_at
)
{
Time
.
now
}
let
(
:alert_starts_at
)
{
Time
.
current
}
let
(
:alert_title
)
{
'TITLE'
}
let
(
:alert_title
)
{
'TITLE'
}
let
(
:alert_annotations
)
{
{
title:
alert_title
}
}
let
(
:alert_annotations
)
{
{
title:
alert_title
}
}
...
@@ -302,7 +302,7 @@ describe IncidentManagement::CreateIssueService do
...
@@ -302,7 +302,7 @@ describe IncidentManagement::CreateIssueService do
private
private
def
build_alert_payload
(
annotations:
{},
starts_at:
Time
.
now
)
def
build_alert_payload
(
annotations:
{},
starts_at:
Time
.
current
)
{
{
'annotations'
=>
annotations
.
stringify_keys
'annotations'
=>
annotations
.
stringify_keys
}.
tap
do
|
payload
|
}.
tap
do
|
payload
|
...
...
spec/services/issues/close_service_spec.rb
View file @
a76b3bd5
...
@@ -146,7 +146,7 @@ describe Issues::CloseService do
...
@@ -146,7 +146,7 @@ describe Issues::CloseService do
context
'when `metrics.first_mentioned_in_commit_at` is already set'
do
context
'when `metrics.first_mentioned_in_commit_at` is already set'
do
before
do
before
do
issue
.
metrics
.
update!
(
first_mentioned_in_commit_at:
Time
.
now
)
issue
.
metrics
.
update!
(
first_mentioned_in_commit_at:
Time
.
current
)
end
end
it
'does not update the metrics'
do
it
'does not update the metrics'
do
...
...
spec/services/issues/update_service_spec.rb
View file @
a76b3bd5
...
@@ -510,7 +510,7 @@ describe Issues::UpdateService, :mailer do
...
@@ -510,7 +510,7 @@ describe Issues::UpdateService, :mailer do
end
end
it
'updates updated_at'
do
it
'updates updated_at'
do
expect
(
issue
.
reload
.
updated_at
).
to
be
>
Time
.
now
expect
(
issue
.
reload
.
updated_at
).
to
be
>
Time
.
current
end
end
end
end
end
end
...
...
spec/services/merge_requests/merge_service_spec.rb
View file @
a76b3bd5
...
@@ -118,7 +118,7 @@ describe MergeRequests::MergeService do
...
@@ -118,7 +118,7 @@ describe MergeRequests::MergeService do
it
'closes GitLab issue tracker issues'
do
it
'closes GitLab issue tracker issues'
do
issue
=
create
:issue
,
project:
project
issue
=
create
:issue
,
project:
project
commit
=
instance_double
(
'commit'
,
safe_message:
"Fixes
#{
issue
.
to_reference
}
"
,
date:
Time
.
now
,
authored_date:
Time
.
now
)
commit
=
instance_double
(
'commit'
,
safe_message:
"Fixes
#{
issue
.
to_reference
}
"
,
date:
Time
.
current
,
authored_date:
Time
.
current
)
allow
(
merge_request
).
to
receive
(
:commits
).
and_return
([
commit
])
allow
(
merge_request
).
to
receive
(
:commits
).
and_return
([
commit
])
merge_request
.
cache_merge_request_closes_issues!
merge_request
.
cache_merge_request_closes_issues!
...
...
spec/services/merge_requests/refresh_service_spec.rb
View file @
a76b3bd5
...
@@ -635,7 +635,7 @@ describe MergeRequests::RefreshService do
...
@@ -635,7 +635,7 @@ describe MergeRequests::RefreshService do
references:
[
issue
],
references:
[
issue
],
author_name:
commit_author
.
name
,
author_name:
commit_author
.
name
,
author_email:
commit_author
.
email
,
author_email:
commit_author
.
email
,
committed_date:
Time
.
now
committed_date:
Time
.
current
)
)
allow_any_instance_of
(
MergeRequest
).
to
receive
(
:commits
).
and_return
(
CommitCollection
.
new
(
@project
,
[
commit
],
'feature'
))
allow_any_instance_of
(
MergeRequest
).
to
receive
(
:commits
).
and_return
(
CommitCollection
.
new
(
@project
,
[
commit
],
'feature'
))
...
...
spec/services/merge_requests/update_service_spec.rb
View file @
a76b3bd5
...
@@ -453,7 +453,7 @@ describe MergeRequests::UpdateService, :mailer do
...
@@ -453,7 +453,7 @@ describe MergeRequests::UpdateService, :mailer do
end
end
it
'updates updated_at'
do
it
'updates updated_at'
do
expect
(
merge_request
.
reload
.
updated_at
).
to
be
>
Time
.
now
expect
(
merge_request
.
reload
.
updated_at
).
to
be
>
Time
.
current
end
end
end
end
...
...
spec/services/note_summary_spec.rb
View file @
a76b3bd5
...
@@ -25,7 +25,7 @@ describe NoteSummary do
...
@@ -25,7 +25,7 @@ describe NoteSummary do
it
'returns note hash'
do
it
'returns note hash'
do
Timecop
.
freeze
do
Timecop
.
freeze
do
expect
(
create_note_summary
.
note
).
to
eq
(
noteable:
noteable
,
project:
project
,
author:
user
,
note:
'note'
,
expect
(
create_note_summary
.
note
).
to
eq
(
noteable:
noteable
,
project:
project
,
author:
user
,
note:
'note'
,
created_at:
Time
.
now
)
created_at:
Time
.
current
)
end
end
end
end
...
...
spec/services/notes/create_service_spec.rb
View file @
a76b3bd5
...
@@ -425,7 +425,7 @@ describe Notes::CreateService do
...
@@ -425,7 +425,7 @@ describe Notes::CreateService do
expect
do
expect
do
existing_note
existing_note
Timecop
.
freeze
(
Time
.
now
+
1
.
minute
)
{
subject
}
Timecop
.
freeze
(
Time
.
current
+
1
.
minute
)
{
subject
}
existing_note
.
reload
existing_note
.
reload
end
.
to
change
{
existing_note
.
type
}.
from
(
nil
).
to
(
'DiscussionNote'
)
end
.
to
change
{
existing_note
.
type
}.
from
(
nil
).
to
(
'DiscussionNote'
)
...
...
spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb
View file @
a76b3bd5
...
@@ -119,7 +119,7 @@ describe PagesDomains::ObtainLetsEncryptCertificateService do
...
@@ -119,7 +119,7 @@ describe PagesDomains::ObtainLetsEncryptCertificateService do
cert
=
OpenSSL
::
X509
::
Certificate
.
new
cert
=
OpenSSL
::
X509
::
Certificate
.
new
cert
.
subject
=
cert
.
issuer
=
OpenSSL
::
X509
::
Name
.
parse
(
subject
)
cert
.
subject
=
cert
.
issuer
=
OpenSSL
::
X509
::
Name
.
parse
(
subject
)
cert
.
not_before
=
Time
.
now
cert
.
not_before
=
Time
.
current
cert
.
not_after
=
1
.
year
.
from_now
cert
.
not_after
=
1
.
year
.
from_now
cert
.
public_key
=
key
.
public_key
cert
.
public_key
=
key
.
public_key
cert
.
serial
=
0x0
cert
.
serial
=
0x0
...
...
spec/services/projects/alerting/notify_service_spec.rb
View file @
a76b3bd5
...
@@ -72,7 +72,7 @@ describe Projects::Alerting::NotifyService do
...
@@ -72,7 +72,7 @@ describe Projects::Alerting::NotifyService do
describe
'#execute'
do
describe
'#execute'
do
let
(
:token
)
{
'invalid-token'
}
let
(
:token
)
{
'invalid-token'
}
let
(
:starts_at
)
{
Time
.
now
.
change
(
usec:
0
)
}
let
(
:starts_at
)
{
Time
.
current
.
change
(
usec:
0
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
nil
,
payload
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
nil
,
payload
)
}
let
(
:payload_raw
)
do
let
(
:payload_raw
)
do
{
{
...
...
spec/services/projects/hashed_storage/base_attachment_service_spec.rb
View file @
a76b3bd5
...
@@ -31,7 +31,7 @@ describe Projects::HashedStorage::BaseAttachmentService do
...
@@ -31,7 +31,7 @@ describe Projects::HashedStorage::BaseAttachmentService do
expect
(
Dir
.
exist?
(
target_path
)).
to
be_truthy
expect
(
Dir
.
exist?
(
target_path
)).
to
be_truthy
Timecop
.
freeze
do
Timecop
.
freeze
do
suffix
=
Time
.
now
.
utc
.
to_i
suffix
=
Time
.
current
.
utc
.
to_i
subject
.
send
(
:discard_path!
,
target_path
)
subject
.
send
(
:discard_path!
,
target_path
)
expected_renamed_path
=
"
#{
target_path
}
-
#{
suffix
}
"
expected_renamed_path
=
"
#{
target_path
}
-
#{
suffix
}
"
...
...
spec/services/projects/prometheus/alerts/create_events_service_spec.rb
View file @
a76b3bd5
...
@@ -50,7 +50,7 @@ describe Projects::Prometheus::Alerts::CreateEventsService do
...
@@ -50,7 +50,7 @@ describe Projects::Prometheus::Alerts::CreateEventsService do
let
(
:events
)
{
service
.
execute
}
let
(
:events
)
{
service
.
execute
}
context
'with a firing payload'
do
context
'with a firing payload'
do
let
(
:started_at
)
{
truncate_to_second
(
Time
.
now
)
}
let
(
:started_at
)
{
truncate_to_second
(
Time
.
current
)
}
let
(
:firing_event
)
{
alert_payload
(
status:
'firing'
,
started_at:
started_at
)
}
let
(
:firing_event
)
{
alert_payload
(
status:
'firing'
,
started_at:
started_at
)
}
let
(
:alerts_payload
)
{
{
'alerts'
=>
[
firing_event
]
}
}
let
(
:alerts_payload
)
{
{
'alerts'
=>
[
firing_event
]
}
}
...
@@ -87,7 +87,7 @@ describe Projects::Prometheus::Alerts::CreateEventsService do
...
@@ -87,7 +87,7 @@ describe Projects::Prometheus::Alerts::CreateEventsService do
end
end
context
'with a resolved payload'
do
context
'with a resolved payload'
do
let
(
:started_at
)
{
truncate_to_second
(
Time
.
now
)
}
let
(
:started_at
)
{
truncate_to_second
(
Time
.
current
)
}
let
(
:ended_at
)
{
started_at
+
1
}
let
(
:ended_at
)
{
started_at
+
1
}
let
(
:payload_key
)
{
PrometheusAlertEvent
.
payload_key_for
(
alert
.
prometheus_metric_id
,
utc_rfc3339
(
started_at
))
}
let
(
:payload_key
)
{
PrometheusAlertEvent
.
payload_key_for
(
alert
.
prometheus_metric_id
,
utc_rfc3339
(
started_at
))
}
let
(
:resolved_event
)
{
alert_payload
(
status:
'resolved'
,
started_at:
started_at
,
ended_at:
ended_at
)
}
let
(
:resolved_event
)
{
alert_payload
(
status:
'resolved'
,
started_at:
started_at
,
ended_at:
ended_at
)
}
...
@@ -285,7 +285,7 @@ describe Projects::Prometheus::Alerts::CreateEventsService do
...
@@ -285,7 +285,7 @@ describe Projects::Prometheus::Alerts::CreateEventsService do
private
private
def
alert_payload
(
status:
'firing'
,
started_at:
Time
.
now
,
ended_at:
Time
.
now
,
gitlab_alert_id:
alert
.
prometheus_metric_id
,
title:
nil
,
environment:
nil
)
def
alert_payload
(
status:
'firing'
,
started_at:
Time
.
current
,
ended_at:
Time
.
current
,
gitlab_alert_id:
alert
.
prometheus_metric_id
,
title:
nil
,
environment:
nil
)
payload
=
{}
payload
=
{}
payload
[
'status'
]
=
status
if
status
payload
[
'status'
]
=
status
if
status
...
...
spec/services/projects/update_repository_storage_service_spec.rb
View file @
a76b3bd5
...
@@ -8,7 +8,7 @@ describe Projects::UpdateRepositoryStorageService do
...
@@ -8,7 +8,7 @@ describe Projects::UpdateRepositoryStorageService do
subject
{
described_class
.
new
(
repository_storage_move
)
}
subject
{
described_class
.
new
(
repository_storage_move
)
}
describe
"#execute"
do
describe
"#execute"
do
let
(
:time
)
{
Time
.
now
}
let
(
:time
)
{
Time
.
current
}
before
do
before
do
allow
(
Time
).
to
receive
(
:now
).
and_return
(
time
)
allow
(
Time
).
to
receive
(
:now
).
and_return
(
time
)
...
...
spec/services/quick_actions/interpret_service_spec.rb
View file @
a76b3bd5
...
@@ -361,7 +361,7 @@ describe QuickActions::InterpretService do
...
@@ -361,7 +361,7 @@ describe QuickActions::InterpretService do
expect
(
updates
).
to
eq
(
spend_time:
{
expect
(
updates
).
to
eq
(
spend_time:
{
duration:
3600
,
duration:
3600
,
user_id:
developer
.
id
,
user_id:
developer
.
id
,
spent_at:
DateTime
.
now
.
to_date
spent_at:
DateTime
.
current
.
to_date
})
})
end
end
...
@@ -379,7 +379,7 @@ describe QuickActions::InterpretService do
...
@@ -379,7 +379,7 @@ describe QuickActions::InterpretService do
expect
(
updates
).
to
eq
(
spend_time:
{
expect
(
updates
).
to
eq
(
spend_time:
{
duration:
-
1800
,
duration:
-
1800
,
user_id:
developer
.
id
,
user_id:
developer
.
id
,
spent_at:
DateTime
.
now
.
to_date
spent_at:
DateTime
.
current
.
to_date
})
})
end
end
end
end
...
...
spec/services/repository_archive_clean_up_service_spec.rb
View file @
a76b3bd5
...
@@ -110,6 +110,6 @@ describe RepositoryArchiveCleanUpService do
...
@@ -110,6 +110,6 @@ describe RepositoryArchiveCleanUpService do
def
create_temporary_files
(
dir
,
extensions
,
mtime
)
def
create_temporary_files
(
dir
,
extensions
,
mtime
)
FileUtils
.
mkdir_p
(
dir
)
FileUtils
.
mkdir_p
(
dir
)
FileUtils
.
touch
(
extensions
.
map
{
|
ext
|
File
.
join
(
dir
,
"sample.
#{
ext
}
"
)
},
mtime:
Time
.
now
-
mtime
)
FileUtils
.
touch
(
extensions
.
map
{
|
ext
|
File
.
join
(
dir
,
"sample.
#{
ext
}
"
)
},
mtime:
Time
.
current
-
mtime
)
end
end
end
end
spec/services/resource_events/merge_into_notes_service_spec.rb
View file @
a76b3bd5
...
@@ -21,7 +21,7 @@ describe ResourceEvents::MergeIntoNotesService do
...
@@ -21,7 +21,7 @@ describe ResourceEvents::MergeIntoNotesService do
let_it_be
(
:resource
)
{
create
(
:issue
,
project:
project
)
}
let_it_be
(
:resource
)
{
create
(
:issue
,
project:
project
)
}
let_it_be
(
:label
)
{
create
(
:label
,
project:
project
)
}
let_it_be
(
:label
)
{
create
(
:label
,
project:
project
)
}
let_it_be
(
:label2
)
{
create
(
:label
,
project:
project
)
}
let_it_be
(
:label2
)
{
create
(
:label
,
project:
project
)
}
let
(
:time
)
{
Time
.
now
}
let
(
:time
)
{
Time
.
current
}
describe
'#execute'
do
describe
'#execute'
do
it
'merges label events into notes in order of created_at'
do
it
'merges label events into notes in order of created_at'
do
...
...
spec/services/update_merge_request_metrics_service_spec.rb
View file @
a76b3bd5
...
@@ -9,7 +9,7 @@ describe MergeRequestMetricsService do
...
@@ -9,7 +9,7 @@ describe MergeRequestMetricsService do
it
'updates metrics'
do
it
'updates metrics'
do
user
=
create
(
:user
)
user
=
create
(
:user
)
service
=
described_class
.
new
(
metrics
)
service
=
described_class
.
new
(
metrics
)
event
=
double
(
Event
,
author_id:
user
.
id
,
created_at:
Time
.
now
)
event
=
double
(
Event
,
author_id:
user
.
id
,
created_at:
Time
.
current
)
service
.
merge
(
event
)
service
.
merge
(
event
)
...
@@ -22,7 +22,7 @@ describe MergeRequestMetricsService do
...
@@ -22,7 +22,7 @@ describe MergeRequestMetricsService do
it
'updates metrics'
do
it
'updates metrics'
do
user
=
create
(
:user
)
user
=
create
(
:user
)
service
=
described_class
.
new
(
metrics
)
service
=
described_class
.
new
(
metrics
)
event
=
double
(
Event
,
author_id:
user
.
id
,
created_at:
Time
.
now
)
event
=
double
(
Event
,
author_id:
user
.
id
,
created_at:
Time
.
current
)
service
.
close
(
event
)
service
.
close
(
event
)
...
...
spec/services/verify_pages_domain_service_spec.rb
View file @
a76b3bd5
...
@@ -348,7 +348,7 @@ describe VerifyPagesDomainService do
...
@@ -348,7 +348,7 @@ describe VerifyPagesDomainService do
end
end
it
'does not shorten any grace period'
do
it
'does not shorten any grace period'
do
grace
=
Time
.
now
+
1
.
year
grace
=
Time
.
current
+
1
.
year
domain
.
update!
(
enabled_until:
grace
)
domain
.
update!
(
enabled_until:
grace
)
disallow_resolver!
disallow_resolver!
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment