Commit 67082753 authored by Patrick Steinhardt's avatar Patrick Steinhardt

spec: Do not recreate existing snippet repositories

In order to set up snippet repositories in some of our tests, we first
copy over a template repository into the target location and then call
Gitaly's `CreateRepository()`. While this call wouldn't do anything if
used with Gitaly only given that the RPC is idempotent, it would create
a database record when Gitaly is proxied by Praefect.

Gitaly is about to drop idempotentcy of `CreateRepository()`, where it
will instead raise an error. Prepare for this by reversing calls such
that we first create the repository in Gitaly, and then copy over
contents of our seed repository.
parent 527d5ba2
......@@ -111,11 +111,11 @@ RSpec.describe Gitlab::BackgroundMigration::PopulatePersonalSnippetStatistics do
if with_repo
allow(snippet).to receive(:disk_path).and_return(disk_path(snippet))
raw_repository(snippet).create_repository
TestEnv.copy_repo(snippet,
bare_repo: TestEnv.factory_repo_path_bare,
refs: TestEnv::BRANCH_SHA)
raw_repository(snippet).create_repository
end
end
end
......
......@@ -183,11 +183,11 @@ RSpec.describe Gitlab::BackgroundMigration::PopulateProjectSnippetStatistics do
if with_repo
allow(snippet).to receive(:disk_path).and_return(disk_path(snippet))
raw_repository(snippet).create_repository
TestEnv.copy_repo(snippet,
bare_repo: TestEnv.factory_repo_path_bare,
refs: TestEnv::BRANCH_SHA)
raw_repository(snippet).create_repository
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment