From 4bedce6e5784ecce94a3bc03614c4c25a1ed2f76 Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Thu, 28 Mar 2024 10:44:21 -0400 Subject: [PATCH] Unlink git_repository lockfile after spec --- spec/models/git_repository_spec.rb | 6 ++++++ .../automation_manager/configuration_script_source_spec.rb | 3 +++ 2 files changed, 9 insertions(+) diff --git a/spec/models/git_repository_spec.rb b/spec/models/git_repository_spec.rb index 5ce138bc5a1..b3f252ce8bc 100644 --- a/spec/models/git_repository_spec.rb +++ b/spec/models/git_repository_spec.rb @@ -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 { diff --git a/spec/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source_spec.rb b/spec/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source_spec.rb index d0dea646cbb..cdcbf91a87b 100644 --- a/spec/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source_spec.rb +++ b/spec/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source_spec.rb @@ -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] } @@ -26,6 +27,7 @@ GitRepository stub_const("GitRepository::GIT_REPO_DIRECTORY", repo_dir) + stub_const("GitRepository::LOCKFILE_DIR", locks_dir) EvmSpecHelper.assign_embedded_ansible_role end @@ -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)