Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deletion of data/git_repos for EmbeddedAnsible tests #22960

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions spec/models/git_repository_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
let(:userid) { 'user' }
let(:password) { 'password' }

after do
described_class::LOCKFILE_DIR.join(repo.id.to_s).unlink
rescue Errno::ENOENT
nil
end

context "parameter check" do
let(:args) do
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
let(:clone_dir) { Dir.mktmpdir }
let(:local_repo) { File.join(clone_dir, "hello_world_local") }
let(:repo_dir) { Pathname.new(Dir.mktmpdir) }
let(:locks_dir) { Pathname.new(Dir.mktmpdir) }
let(:repos) { Dir.glob(File.join(repo_dir, "*")) }
let(:repo_dir_structure) { %w[hello_world.yaml] }

Expand All @@ -26,6 +27,7 @@

GitRepository
stub_const("GitRepository::GIT_REPO_DIRECTORY", repo_dir)
stub_const("GitRepository::LOCKFILE_DIR", locks_dir)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE unlike the git_repository_spec there isn't always a repos instance available (this also tests creating via the create_in_provider_queue method for example), since this already stubs the GIT_REPO_DIRECTORY so that it can be cleaned up later this felt like another case of the same issue.


EvmSpecHelper.assign_embedded_ansible_role
end
Expand All @@ -34,6 +36,7 @@
after do
FileUtils.rm_rf(repo_dir)
FileUtils.rm_rf(clone_dir)
FileUtils.rm_rf(locks_dir)
end

def files_in_repository(git_repo_dir)
Expand Down
Loading