Skip to content

Commit

Permalink
Windows platform for all versions of ruby are unaffected it seems
Browse files Browse the repository at this point in the history
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
  • Loading branch information
ahasunos committed Oct 12, 2023
1 parent 5f1ad7b commit 019bfea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ group :test do
gem "train-test-fixture", path: "test/fixtures/plugins/train-test-fixture"
# Mocha ~1.1 is incompatible with minitest v5.19 and later
# More on the issue: https://github.com/freerange/mocha/issues/614
gem "mocha", (RUBY_VERSION < "3.1" ? "~> 1.1" : "~> 2.1")
# It seems non-windows platforms lower than ruby 3.1 are affected
if !Gem.win_platform? && (Gem.ruby_version < Gem::Version.new("3.1"))
gem "mocha", "~> 1.1"
else
gem "mocha", "~> 2.1"
end
end

if Gem.ruby_version >= Gem::Version.new("2.7.0")
Expand Down
7 changes: 6 additions & 1 deletion test/unit/transports/ssh_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,12 @@
end

it "sets up a proxy when ssh proxy command is specified" do
mock = RUBY_VERSION < "3.1" ? MiniTest::Mock.new : Minitest::Mock.new
# Only non-windows ruby < 3.1 uses MiniTest::Mock
if !windows? && RUBY_VERSION < "3.1"
mock = MiniTest::Mock.new
else
mock = Minitest::Mock.new
end
mock.expect(:call, true) do |hostname, username, options|
options[:proxy].is_a?(Net::SSH::Proxy::Command) &&
"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=ERROR -o ForwardAgent=no -o IdentitiesOnly=yes -i #{conf[:key_files]} root@bastion_dummy -p 22 -W %h:%p" == options[:proxy].command_line_template
Expand Down

0 comments on commit 019bfea

Please sign in to comment.