diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 09:16:11 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 09:16:11 +0000 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /spec/factories/namespaces.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) | |
download | gitlab-ce-76a9e64d004e0c02c35b8165ca38d005afb5e823.tar.gz |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'spec/factories/namespaces.rb')
-rw-r--r-- | spec/factories/namespaces.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/factories/namespaces.rb b/spec/factories/namespaces.rb index 2b3dabc07d8..e88bb634898 100644 --- a/spec/factories/namespaces.rb +++ b/spec/factories/namespaces.rb @@ -11,6 +11,14 @@ FactoryBot.define do owner { association(:user, strategy: :build, namespace: instance, username: path) } + after(:create) do |namespace, evaluator| + # simulating ::Namespaces::ProcessSyncEventsWorker because most tests don't run Sidekiq inline + # Note: we need to get refreshed `traversal_ids` it is updated via SQL query + # in `Namespaces::Traversal::Linear#sync_traversal_ids` (see the NOTE in that method). + # We cannot use `.reload` because it cleans other on-the-fly attributes. + namespace.create_ci_namespace_mirror!(traversal_ids: Namespace.find(namespace.id).traversal_ids) unless namespace.ci_namespace_mirror + end + trait :with_aggregation_schedule do after(:create) do |namespace| create(:namespace_aggregation_schedules, namespace: namespace) |