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
ccfd8df0
Commit
ccfd8df0
authored
Mar 31, 2022
by
Chloe Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'e2e-data-cleanup-worker' into 'master'"
This reverts merge request !82551
parent
c0290a26
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
95 deletions
+0
-95
app/workers/all_queues.yml
app/workers/all_queues.yml
+0
-9
app/workers/quality/test_data_cleanup_worker.rb
app/workers/quality/test_data_cleanup_worker.rb
+0
-33
spec/factories/groups.rb
spec/factories/groups.rb
+0
-9
spec/workers/quality/test_data_cleanup_worker_spec.rb
spec/workers/quality/test_data_cleanup_worker_spec.rb
+0
-44
No files found.
app/workers/all_queues.yml
View file @
ccfd8df0
...
...
@@ -588,15 +588,6 @@
:weight:
1
:idempotent:
:tags: []
-
:name: cronjob:quality_test_data_cleanup
:worker_name: Quality::TestDataCleanupWorker
:feature_category: :quality_management
:has_external_dependencies:
:urgency: :low
:resource_boundary: :unknown
:weight:
1
:idempotent:
true
:tags: []
-
:name: cronjob:releases_manage_evidence
:worker_name: Releases::ManageEvidenceWorker
:feature_category: :release_evidence
...
...
app/workers/quality/test_data_cleanup_worker.rb
deleted
100644 → 0
View file @
c0290a26
# frozen_string_literal: true
module
Quality
class
TestDataCleanupWorker
include
ApplicationWorker
data_consistency
:always
feature_category
:quality_management
urgency
:low
include
CronjobQueue
idempotent!
KEEP_RECENT_DATA_DAY
=
3
GROUP_PATH_PATTERN
=
'test-group-fulfillment'
GROUP_OWNER_EMAIL_PATTERN
=
%w(test-user- gitlab-qa-user qa-user-)
.
freeze
# Remove test groups generated in E2E tests on gstg
# rubocop: disable CodeReuse/ActiveRecord
def
perform
return
unless
Gitlab
.
staging?
Group
.
where
(
'path like ?'
,
"
#{
GROUP_PATH_PATTERN
}
%"
).
where
(
'created_at < ?'
,
KEEP_RECENT_DATA_DAY
.
days
.
ago
).
each
do
|
group
|
next
unless
GROUP_OWNER_EMAIL_PATTERN
.
any?
{
|
pattern
|
group
.
owners
.
first
.
email
.
include?
(
pattern
)
}
with_context
(
namespace:
group
,
user:
group
.
owners
.
first
)
do
Groups
::
DestroyService
.
new
(
group
,
group
.
owners
.
first
).
execute
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
end
end
spec/factories/groups.rb
View file @
ccfd8df0
...
...
@@ -118,14 +118,5 @@ FactoryBot.define do
create
(
:crm_settings
,
group:
group
,
enabled:
true
)
end
end
trait
:test_group
do
path
{
"test-group-fulfillment
#{
SecureRandom
.
hex
(
4
)
}
"
}
created_at
{
4
.
days
.
ago
}
after
(
:create
)
do
|
group
|
group
.
add_owner
(
create
(
:user
,
email:
"test-user-
#{
SecureRandom
.
hex
(
4
)
}
@test.com"
))
end
end
end
end
spec/workers/quality/test_data_cleanup_worker_spec.rb
deleted
100644 → 0
View file @
c0290a26
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Quality
::
TestDataCleanupWorker
do
subject
{
described_class
.
new
}
shared_examples
'successful deletion'
do
before
do
allow
(
Gitlab
).
to
receive
(
:staging?
).
and_return
(
true
)
end
it
'removes test groups'
do
expect
{
subject
.
perform
}.
to
change
(
Group
,
:count
).
by
(
-
test_group_count
)
end
end
describe
"#perform"
do
context
'with multiple test groups to remove'
do
let
(
:test_group_count
)
{
5
}
let!
(
:groups_to_remove
)
{
create_list
(
:group
,
test_group_count
,
:test_group
)
}
let!
(
:group_to_keep
)
{
create
(
:group
,
path:
'test-group-fulfillment-keep'
,
created_at:
1
.
day
.
ago
)
}
let!
(
:non_test_group
)
{
create
(
:group
)
}
let
(
:non_test_owner_group
)
{
create
(
:group
,
path:
'test-group-fulfillment1234'
,
created_at:
4
.
days
.
ago
)
}
before
do
non_test_owner_group
.
add_owner
(
create
(
:user
))
end
it_behaves_like
'successful deletion'
end
context
'with paid groups'
do
let
(
:test_group_count
)
{
1
}
let!
(
:paid_group
)
{
create
(
:group
,
:test_group
)
}
before
do
allow
(
paid_group
).
to
receive
(
:paid?
).
and_return
(
true
)
end
it_behaves_like
'successful deletion'
end
end
end
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