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
9ec9fb6a
Commit
9ec9fb6a
authored
Apr 26, 2021
by
Abdul Wadood
Committed by
Rémy Coutable
Apr 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Rails/SaveBang offenses in ee/spec/workers
parent
cd7aa577
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
21 additions
and
27 deletions
+21
-27
.rubocop_manual_todo.yml
.rubocop_manual_todo.yml
+0
-11
ee/changelogs/unreleased/rails-save-bang-ee-workers.yml
ee/changelogs/unreleased/rails-save-bang-ee-workers.yml
+5
-0
ee/spec/workers/adjourned_project_deletion_worker_spec.rb
ee/spec/workers/adjourned_project_deletion_worker_spec.rb
+1
-1
ee/spec/workers/clear_shared_runners_minutes_worker_spec.rb
ee/spec/workers/clear_shared_runners_minutes_worker_spec.rb
+1
-1
ee/spec/workers/create_github_webhook_worker_spec.rb
ee/spec/workers/create_github_webhook_worker_spec.rb
+1
-1
ee/spec/workers/elastic_namespace_rollout_worker_spec.rb
ee/spec/workers/elastic_namespace_rollout_worker_spec.rb
+1
-1
ee/spec/workers/geo/file_download_dispatch_worker_spec.rb
ee/spec/workers/geo/file_download_dispatch_worker_spec.rb
+2
-2
ee/spec/workers/geo/prune_event_log_worker_spec.rb
ee/spec/workers/geo/prune_event_log_worker_spec.rb
+2
-2
ee/spec/workers/geo/registry_sync_worker_spec.rb
ee/spec/workers/geo/registry_sync_worker_spec.rb
+1
-1
ee/spec/workers/geo/repository_shard_sync_worker_spec.rb
ee/spec/workers/geo/repository_shard_sync_worker_spec.rb
+4
-4
ee/spec/workers/repository_import_worker_spec.rb
ee/spec/workers/repository_import_worker_spec.rb
+2
-2
ee/spec/workers/update_all_mirrors_worker_spec.rb
ee/spec/workers/update_all_mirrors_worker_spec.rb
+1
-1
No files found.
.rubocop_manual_todo.yml
View file @
9ec9fb6a
...
@@ -132,17 +132,6 @@ Rails/SaveBang:
...
@@ -132,17 +132,6 @@ Rails/SaveBang:
-
'
ee/spec/support/shared_examples/graphql/geo/geo_registries_resolver_shared_examples.rb'
-
'
ee/spec/support/shared_examples/graphql/geo/geo_registries_resolver_shared_examples.rb'
-
'
ee/spec/support/shared_examples/lib/analytics/common_merge_request_metrics_refresh_shared_examples.rb'
-
'
ee/spec/support/shared_examples/lib/analytics/common_merge_request_metrics_refresh_shared_examples.rb'
-
'
ee/spec/support/shared_examples/policies/protected_environments_shared_examples.rb'
-
'
ee/spec/support/shared_examples/policies/protected_environments_shared_examples.rb'
-
'
ee/spec/workers/adjourned_project_deletion_worker_spec.rb'
-
'
ee/spec/workers/clear_shared_runners_minutes_worker_spec.rb'
-
'
ee/spec/workers/create_github_webhook_worker_spec.rb'
-
'
ee/spec/workers/elastic_namespace_rollout_worker_spec.rb'
-
'
ee/spec/workers/geo/container_repository_sync_dispatch_worker_spec.rb'
-
'
ee/spec/workers/geo/file_download_dispatch_worker_spec.rb'
-
'
ee/spec/workers/geo/prune_event_log_worker_spec.rb'
-
'
ee/spec/workers/geo/registry_sync_worker_spec.rb'
-
'
ee/spec/workers/geo/repository_shard_sync_worker_spec.rb'
-
'
ee/spec/workers/repository_import_worker_spec.rb'
-
'
ee/spec/workers/update_all_mirrors_worker_spec.rb'
-
'
qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb'
-
'
qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb'
-
'
qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb'
-
'
qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb'
-
'
qa/qa/specs/features/ee/browser_ui/3_create/repository/pull_mirroring_over_http_spec.rb'
-
'
qa/qa/specs/features/ee/browser_ui/3_create/repository/pull_mirroring_over_http_spec.rb'
...
...
ee/changelogs/unreleased/rails-save-bang-ee-workers.yml
0 → 100644
View file @
9ec9fb6a
---
title
:
Fix Rails/SaveBang rubocop offenses in ee/spec/workers
merge_request
:
58070
author
:
Abdul Wadood @abdulwd
type
:
fixed
ee/spec/workers/adjourned_project_deletion_worker_spec.rb
View file @
9ec9fb6a
...
@@ -18,7 +18,7 @@ RSpec.describe AdjournedProjectDeletionWorker do
...
@@ -18,7 +18,7 @@ RSpec.describe AdjournedProjectDeletionWorker do
end
end
it
'stops execution if user was deleted'
do
it
'stops execution if user was deleted'
do
project
.
update
(
deleting_user:
nil
)
project
.
update
!
(
deleting_user:
nil
)
expect
(
Projects
::
DestroyService
).
not_to
receive
(
:new
)
expect
(
Projects
::
DestroyService
).
not_to
receive
(
:new
)
...
...
ee/spec/workers/clear_shared_runners_minutes_worker_spec.rb
View file @
9ec9fb6a
...
@@ -24,7 +24,7 @@ RSpec.describe ClearSharedRunnersMinutesWorker do
...
@@ -24,7 +24,7 @@ RSpec.describe ClearSharedRunnersMinutesWorker do
let
(
:statistics
)
{
project
.
statistics
}
let
(
:statistics
)
{
project
.
statistics
}
before
do
before
do
statistics
.
update
(
shared_runners_seconds:
100
)
statistics
.
update
!
(
shared_runners_seconds:
100
)
end
end
it
'clears counters'
do
it
'clears counters'
do
...
...
ee/spec/workers/create_github_webhook_worker_spec.rb
View file @
9ec9fb6a
...
@@ -19,7 +19,7 @@ RSpec.describe CreateGithubWebhookWorker do
...
@@ -19,7 +19,7 @@ RSpec.describe CreateGithubWebhookWorker do
describe
'#perform'
do
describe
'#perform'
do
before
do
before
do
project
.
ensure_external_webhook_token
project
.
ensure_external_webhook_token
project
.
save
project
.
save
!
end
end
it
'creates the webhook'
do
it
'creates the webhook'
do
...
...
ee/spec/workers/elastic_namespace_rollout_worker_spec.rb
View file @
9ec9fb6a
...
@@ -10,7 +10,7 @@ RSpec.describe ElasticNamespaceRolloutWorker do
...
@@ -10,7 +10,7 @@ RSpec.describe ElasticNamespaceRolloutWorker do
Plan
::
PAID_HOSTED_PLANS
.
each
do
|
plan
|
Plan
::
PAID_HOSTED_PLANS
.
each
do
|
plan
|
plan_factory
=
"
#{
plan
}
_plan"
plan_factory
=
"
#{
plan
}
_plan"
let_it_be
(
plan_factory
)
{
create
(
plan_factory
)
}
let_it_be
(
plan_factory
)
{
create
(
plan_factory
)
}
# rubocop:disable Rails/SaveBang
end
end
before_all
do
before_all
do
...
...
ee/spec/workers/geo/file_download_dispatch_worker_spec.rb
View file @
9ec9fb6a
...
@@ -38,7 +38,7 @@ RSpec.describe Geo::FileDownloadDispatchWorker, :geo, :use_sql_query_cache_for_t
...
@@ -38,7 +38,7 @@ RSpec.describe Geo::FileDownloadDispatchWorker, :geo, :use_sql_query_cache_for_t
create
(
:lfs_object
,
:with_file
)
create
(
:lfs_object
,
:with_file
)
secondary
.
enabled
=
false
secondary
.
enabled
=
false
secondary
.
save
secondary
.
save
!
expect
(
Geo
::
FileDownloadWorker
).
not_to
receive
(
:perform_async
)
expect
(
Geo
::
FileDownloadWorker
).
not_to
receive
(
:perform_async
)
...
@@ -76,7 +76,7 @@ RSpec.describe Geo::FileDownloadDispatchWorker, :geo, :use_sql_query_cache_for_t
...
@@ -76,7 +76,7 @@ RSpec.describe Geo::FileDownloadDispatchWorker, :geo, :use_sql_query_cache_for_t
expect
(
Geo
::
FileDownloadWorker
).
to
receive
(
:perform_async
).
with
(
'lfs'
,
lfs_object_1
.
id
).
once
do
expect
(
Geo
::
FileDownloadWorker
).
to
receive
(
:perform_async
).
with
(
'lfs'
,
lfs_object_1
.
id
).
once
do
Thread
.
new
do
Thread
.
new
do
# Rails will invalidate the query cache if the update happens in the same thread
# Rails will invalidate the query cache if the update happens in the same thread
Geo
::
LfsObjectRegistry
.
update
(
success:
true
)
Geo
::
LfsObjectRegistry
.
update
(
success:
true
)
# rubocop:disable Rails/SaveBang
end
end
end
end
...
...
ee/spec/workers/geo/prune_event_log_worker_spec.rb
View file @
9ec9fb6a
...
@@ -63,7 +63,7 @@ RSpec.describe Geo::PruneEventLogWorker, :geo do
...
@@ -63,7 +63,7 @@ RSpec.describe Geo::PruneEventLogWorker, :geo do
context
'no Geo secondary nodes'
do
context
'no Geo secondary nodes'
do
before
do
before
do
secondary
.
destroy
secondary
.
destroy
!
end
end
it
'deletes everything from the Geo event log'
do
it
'deletes everything from the Geo event log'
do
...
@@ -76,7 +76,7 @@ RSpec.describe Geo::PruneEventLogWorker, :geo do
...
@@ -76,7 +76,7 @@ RSpec.describe Geo::PruneEventLogWorker, :geo do
context
'no Geo primary node'
do
context
'no Geo primary node'
do
before
do
before
do
primary
.
destroy
primary
.
destroy
!
end
end
it
'deletes everything from the Geo event log'
do
it
'deletes everything from the Geo event log'
do
...
...
ee/spec/workers/geo/registry_sync_worker_spec.rb
View file @
9ec9fb6a
...
@@ -74,7 +74,7 @@ RSpec.describe Geo::RegistrySyncWorker, :geo, :use_sql_query_cache_for_tracking_
...
@@ -74,7 +74,7 @@ RSpec.describe Geo::RegistrySyncWorker, :geo, :use_sql_query_cache_for_tracking_
expect
(
Geo
::
EventWorker
).
to
receive
(
:perform_async
).
with
(
'package_file'
,
:created
,
{
model_record_id:
package_file_1
.
package_file
.
id
}).
once
do
expect
(
Geo
::
EventWorker
).
to
receive
(
:perform_async
).
with
(
'package_file'
,
:created
,
{
model_record_id:
package_file_1
.
package_file
.
id
}).
once
do
Thread
.
new
do
Thread
.
new
do
# Rails will invalidate the query cache if the update happens in the same thread
# Rails will invalidate the query cache if the update happens in the same thread
Geo
::
PackageFileRegistry
.
update
(
state:
Geo
::
PackageFileRegistry
::
STATE_VALUES
[
:synced
])
Geo
::
PackageFileRegistry
.
update
(
state:
Geo
::
PackageFileRegistry
::
STATE_VALUES
[
:synced
])
# rubocop:disable Rails/SaveBang
end
end
end
end
...
...
ee/spec/workers/geo/repository_shard_sync_worker_spec.rb
View file @
9ec9fb6a
...
@@ -146,8 +146,8 @@ RSpec.describe Geo::RepositoryShardSyncWorker, :geo, :clean_gitlab_redis_cache,
...
@@ -146,8 +146,8 @@ RSpec.describe Geo::RepositoryShardSyncWorker, :geo, :clean_gitlab_redis_cache,
abandoned_project
.
update_column
(
:last_repository_updated_at
,
1
.
year
.
ago
)
abandoned_project
.
update_column
(
:last_repository_updated_at
,
1
.
year
.
ago
)
# Neither of these are needed for this spec
# Neither of these are needed for this spec
project_2
.
destroy
project_2
.
destroy
!
project_1
.
destroy
project_1
.
destroy
!
allow_next_instance_of
(
described_class
)
do
|
instance
|
allow_next_instance_of
(
described_class
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:db_retrieve_batch_size
).
and_return
(
2
)
# Must be >1 because of the Geo::BaseSchedulerWorker#interleave
allow
(
instance
).
to
receive
(
:db_retrieve_batch_size
).
and_return
(
2
)
# Must be >1 because of the Geo::BaseSchedulerWorker#interleave
...
@@ -191,8 +191,8 @@ RSpec.describe Geo::RepositoryShardSyncWorker, :geo, :clean_gitlab_redis_cache,
...
@@ -191,8 +191,8 @@ RSpec.describe Geo::RepositoryShardSyncWorker, :geo, :clean_gitlab_redis_cache,
before
do
before
do
# Neither of these are needed for this spec
# Neither of these are needed for this spec
project_2
.
destroy
project_2
.
destroy
!
project_1
.
destroy
project_1
.
destroy
!
allow_next_instance_of
(
described_class
)
do
|
instance
|
allow_next_instance_of
(
described_class
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:db_retrieve_batch_size
).
and_return
(
2
)
# Must be >1 because of the Geo::BaseSchedulerWorker#interleave
allow
(
instance
).
to
receive
(
:db_retrieve_batch_size
).
and_return
(
2
)
# Must be >1 because of the Geo::BaseSchedulerWorker#interleave
...
...
ee/spec/workers/repository_import_worker_spec.rb
View file @
9ec9fb6a
...
@@ -9,8 +9,8 @@ RSpec.describe RepositoryImportWorker do
...
@@ -9,8 +9,8 @@ RSpec.describe RepositoryImportWorker do
stub_licensed_features
(
custom_project_templates:
true
)
stub_licensed_features
(
custom_project_templates:
true
)
error
=
%q{remote: Not Found fatal: repository 'https://user:pass@test.com/root/repoC.git/' not found }
error
=
%q{remote: Not Found fatal: repository 'https://user:pass@test.com/root/repoC.git/' not found }
project
.
update
(
import_type:
'gitlab_custom_project_template'
)
project
.
update
!
(
import_type:
'gitlab_custom_project_template'
)
project
.
import_state
.
update
(
jid:
'123'
)
project
.
import_state
.
update
!
(
jid:
'123'
)
expect_next_instance_of
(
Projects
::
ImportService
)
do
|
service
|
expect_next_instance_of
(
Projects
::
ImportService
)
do
|
service
|
expect
(
service
).
to
receive
(
:execute
).
and_return
({
status: :error
,
message:
error
})
expect
(
service
).
to
receive
(
:execute
).
and_return
({
status: :error
,
message:
error
})
end
end
...
...
ee/spec/workers/update_all_mirrors_worker_spec.rb
View file @
9ec9fb6a
...
@@ -160,7 +160,7 @@ RSpec.describe UpdateAllMirrorsWorker do
...
@@ -160,7 +160,7 @@ RSpec.describe UpdateAllMirrorsWorker do
context
'when the instance checks namespace plans'
do
context
'when the instance checks namespace plans'
do
def
scheduled_mirror
(
at
:,
licensed
:,
public:
false
,
subgroup:
nil
)
def
scheduled_mirror
(
at
:,
licensed
:,
public:
false
,
subgroup:
nil
)
group_args
=
[
:group
,
:public
,
subgroup
&&
:nested
].
compact
group_args
=
[
:group
,
:public
,
subgroup
&&
:nested
].
compact
namespace
=
create
(
*
group_args
)
namespace
=
create
(
*
group_args
)
# rubocop:disable Rails/SaveBang
project
=
create
(
:project
,
:public
,
:mirror
,
namespace:
namespace
)
project
=
create
(
:project
,
:public
,
:mirror
,
namespace:
namespace
)
create
(
:gitlab_subscription
,
(
licensed
?
:bronze
:
:free
),
namespace:
namespace
.
root_ancestor
)
create
(
:gitlab_subscription
,
(
licensed
?
:bronze
:
:free
),
namespace:
namespace
.
root_ancestor
)
...
...
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