Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-15 21:12:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-15 21:12:51 +0300
commitefbd20fd1ecd091f1270f73d617822a32c94376f (patch)
tree98bc700b5eaabb510d9af3a7ca6ddc847de9ac42 /spec/workers
parent51d5328e82229d69456d3a43dd2cf10518bf64c7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/pages/invalidate_domain_cache_worker_spec.rb12
-rw-r--r--spec/workers/users/deactivate_dormant_users_worker_spec.rb21
2 files changed, 23 insertions, 10 deletions
diff --git a/spec/workers/pages/invalidate_domain_cache_worker_spec.rb b/spec/workers/pages/invalidate_domain_cache_worker_spec.rb
index df1b91ff0e5..75d7c9f82b4 100644
--- a/spec/workers/pages/invalidate_domain_cache_worker_spec.rb
+++ b/spec/workers/pages/invalidate_domain_cache_worker_spec.rb
@@ -104,6 +104,18 @@ RSpec.describe Pages::InvalidateDomainCacheWorker do
{ type: :namespace, id: 5 }
]
+ it_behaves_like 'clears caches with',
+ event_class: Groups::GroupPathChangedEvent,
+ event_data: {
+ group_id: 1,
+ root_namespace_id: 2,
+ old_path: 'old_path',
+ new_path: 'new_path'
+ },
+ caches: [
+ { type: :namespace, id: 2 }
+ ]
+
context 'when namespace based cache keys are duplicated' do
# de-dups namespace cache keys
it_behaves_like 'clears caches with',
diff --git a/spec/workers/users/deactivate_dormant_users_worker_spec.rb b/spec/workers/users/deactivate_dormant_users_worker_spec.rb
index 297301c45e2..263ca31e0a0 100644
--- a/spec/workers/users/deactivate_dormant_users_worker_spec.rb
+++ b/spec/workers/users/deactivate_dormant_users_worker_spec.rb
@@ -25,20 +25,13 @@ RSpec.describe Users::DeactivateDormantUsersWorker do
context 'when automatic deactivation of dormant users is enabled' do
before do
stub_application_setting(deactivate_dormant_users: true)
- stub_const("#{described_class.name}::PAUSE_SECONDS", 0)
end
it 'deactivates dormant users' do
- freeze_time do
- stub_const("#{described_class.name}::BATCH_SIZE", 1)
-
- expect(worker).to receive(:sleep).twice
-
- worker.perform
+ worker.perform
- expect(User.dormant.count).to eq(0)
- expect(User.with_no_activity.count).to eq(0)
- end
+ expect(User.dormant.count).to eq(0)
+ expect(User.with_no_activity.count).to eq(0)
end
where(:user_type, :expected_state) do
@@ -78,6 +71,14 @@ RSpec.describe Users::DeactivateDormantUsersWorker do
expect(inactive_recently_created.reload.state).to eq('active')
end
+
+ it 'triggers update of highest user role for deactivated users', :clean_gitlab_redis_shared_state do
+ [dormant, inactive].each do |user|
+ expect(UpdateHighestRoleWorker).to receive(:perform_in).with(anything, user.id)
+ end
+
+ worker.perform
+ end
end
context 'when automatic deactivation of dormant users is disabled' do