diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2020-08-25 16:27:40 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2020-08-25 16:27:40 -0700 |
commit | c2cfa71a400ff49493adc0882373bd55d6141e8a (patch) | |
tree | 4dea04d2bcea90c08749538d3d1246500e0b91b4 | |
parent | 5e4fc4ab25185696c7ad84aa34f17a3eed6ab13c (diff) | |
download | ohai-c2cfa71a400ff49493adc0882373bd55d6141e8a.tar.gz |
trying to fix windows tests
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | spec/unit/mixin/shell_out_spec.rb | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/spec/unit/mixin/shell_out_spec.rb b/spec/unit/mixin/shell_out_spec.rb index 93ccb2c3..a7ff5776 100644 --- a/spec/unit/mixin/shell_out_spec.rb +++ b/spec/unit/mixin/shell_out_spec.rb @@ -28,22 +28,25 @@ describe Ohai::Mixin::ShellOut, "shell_out" do let(:timeout) { 30 } let(:options) do + # this just replicates the behavior of default_paths in chef-utils + default_paths = [ Gem.bindir, RbConfig::CONFIG["bindir"] ].compact.uniq + if windows? - { timeout: timeout } + default_paths = default_paths.join(";") else - # this just replicates the behavior of default_paths in chef-utils - default_paths = ( [ ENV["PATH"] ? ENV["PATH"].split(":").reverse : nil, RbConfig::CONFIG["bindir"] ].uniq.reverse + [ "/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin" ] ).compact.uniq.join(":") - default_locale = ChefConfig::Config.guess_internal_locale - { - timeout: timeout, - environment: { - "LANG" => default_locale, - "LANGUAGE" => default_locale, - "LC_ALL" => default_locale, - "PATH" => default_paths, - }, - } + default_paths = ( default_paths + [ "/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin" ] ).compact.uniq.join(":") end + + default_locale = ChefConfig::Config.guess_internal_locale + { + timeout: timeout, + environment: { + "LANG" => default_locale, + "LANGUAGE" => default_locale, + "LC_ALL" => default_locale, + "PATH" => default_paths, + }, + } end let(:logger) { instance_double("Mixlib::Log::Child", trace: nil, debug: nil, warn: nil, debug?: false) } @@ -101,7 +104,7 @@ describe Ohai::Mixin::ShellOut, "shell_out" do expect(logger) .to receive(:trace) .with("Plugin OSSparkleDream: ran 'sparkle-dream --version' and failed " \ - "#<Errno::ENOENT: No such file or directory - sparkle-dream>") + "#<Errno::ENOENT: No such file or directory - sparkle-dream>") expect { instance.shell_out(cmd) } .to raise_error(Ohai::Exceptions::Exec) @@ -122,7 +125,7 @@ describe Ohai::Mixin::ShellOut, "shell_out" do expect(logger) .to receive(:trace) .with("Plugin OSSparkleDream: ran 'sparkle-dream --version' and timed " \ - "out after 30 seconds") + "out after 30 seconds") expect { instance.shell_out(cmd) } .to raise_error(Ohai::Exceptions::Exec) @@ -165,7 +168,7 @@ describe Ohai::Mixin::ShellOut, "shell_out" do expect(logger) .to receive(:trace) .with("Plugin OSSparkleDream: ran 'sparkle-dream --version' and timed " \ - "out after 10 seconds") + "out after 10 seconds") expect { instance.shell_out(cmd, timeout: 10) } .to raise_error(Ohai::Exceptions::Exec) |