Skip to content

Commit

Permalink
Merge pull request #19612 from rapid7/revert-19554-new-junction-test
Browse files Browse the repository at this point in the history
Revert "Added new failing test for windows junction points"
  • Loading branch information
adfoster-r7 authored Nov 1, 2024
2 parents d9b3528 + 9485cdd commit f40e986
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions test/modules/post/test/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,27 +117,6 @@ def test_dir
ret
end
end

if (session.platform == 'windows')
it 'should delete a junction target' do
mkdir(datastore['BaseDirectoryName'])
ret = directory?(datastore['BaseDirectoryName'])
link = "#{datastore['BaseDirectoryName']}.junc"
ret &&= write_file([datastore['BaseDirectoryName'], 'file'].join(fs_sep), '')
make_junction(datastore['BaseDirectoryName'], link)
unless exists?(link)
print_error('failed to create the symbolic link')
end
rm_rf(link)
# the link should have been deleted
ret &&= !exists?(link)
# but the target directory and its contents should still be intact
ret &&= exists?("#{[datastore['BaseDirectoryName'], 'file'].join(fs_sep)}")
rm_rf(datastore['BaseDirectoryName'])
ret
end
end

end

def test_file
Expand Down Expand Up @@ -310,10 +289,6 @@ def test_path_expansion_nix
end
end

def make_junction(target, symlink)
cmd_exec("cmd.exe", "/c mklink #{directory?(target) ? '/J ' : ''}#{symlink} #{target}")
end

def make_symlink(target, symlink)
if session.platform == 'windows'
cmd_exec("cmd.exe", "/c mklink #{directory?(target) ? '/D ' : ''}#{symlink} #{target}")
Expand Down

0 comments on commit f40e986

Please sign in to comment.