vaguerent/test/unit/vagrant/util/guest_inspection_test.rb
Jeff Bonhag 08c3c741fe
Fix #11396: Use sudo to detect if systemd in use (#11398)
This change allows the vagrant user to see the systemd process in the
event that the hidepid mount option is enabled.

Also adds sudo: true to other tests that use `systemd?`
2020-02-14 12:10:59 -05:00

19 lines
497 B
Ruby

require File.expand_path("../../../base", __FILE__)
require "vagrant/util/guest_inspection"
describe Vagrant::Util::GuestInspection::Linux do
include_context "unit"
let(:comm) { double("comm") }
subject{ Class.new { extend Vagrant::Util::GuestInspection::Linux } }
describe "#systemd?" do
it "should execute the command with sudo" do
expect(comm).to receive(:test).with(/ps/, {sudo: true}).and_return(true)
expect(subject.systemd?(comm)).to be(true)
end
end
end