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

Fix mocha ~1.1 incompatibility with minitest #752

Merged
merged 7 commits into from
Oct 16, 2023
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
1 change: 1 addition & 0 deletions .expeditor/buildkite/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ bundle --version

echo "--- bundle install"
bundle config --local path vendor/bundle
bundle config --local without integration tools
bundle install --jobs=7 --retry=3

echo "+++ bundle exec rake"
Expand Down
9 changes: 3 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
source "https://rubygems.org"
gemspec name: "train"

if Gem.ruby_version.to_s.start_with?("2.5")
# 16.7.23 required ruby 2.6+
gem "chef-utils", "< 16.7.23" # TODO: remove when we drop ruby 2.5
end

group :test do
gem "minitest", "~> 5.8"
gem "rake", "~> 13.0"
Expand All @@ -20,7 +15,9 @@ group :test do
# but it's close enough to show the gempath handler can find a plugin
# See test/unit/
gem "train-test-fixture", path: "test/fixtures/plugins/train-test-fixture"
gem "mocha", "~> 1.1"
# Mocha ~1.1 is incompatible with minitest v5.19 and later
# More on the issue: https://github.com/freerange/mocha/issues/614
gem "mocha", "~> 2"
end

if Gem.ruby_version >= Gem::Version.new("2.7.0")
Expand Down
5 changes: 3 additions & 2 deletions test/unit/transports/ssh_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@
end

it "sets up a proxy when ssh proxy command is specified" do
mock = MiniTest::Mock.new
mock = Minitest::Mock.new

mock.expect(:call, true) do |hostname, username, options|
options[:proxy].is_a?(Net::SSH::Proxy::Command) &&
"ssh root@127.0.0.1 -W %h:%p" == options[:proxy].command_line_template
Expand Down Expand Up @@ -384,7 +385,7 @@
end

it "sets up a proxy when ssh proxy command is specified" do
mock = MiniTest::Mock.new
mock = Minitest::Mock.new
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