diff options
author | Tim Smith <tsmith@chef.io> | 2016-12-01 10:49:41 -0800 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2016-12-01 11:12:53 -0800 |
commit | 941c1f4eb3e6a728f06ad2547c94136aea641ff6 (patch) | |
tree | 2222335f741ecb9cb2f4e06b8e8b50a3c5b25336 /spec | |
parent | 9ab214367563c26ab839838a9287bbf04a33efb5 (diff) | |
download | ohai-941c1f4eb3e6a728f06ad2547c94136aea641ff6.tar.gz |
Pull the complete version string of Erlangerlang
Improve the shellout with help of StackOverflow and srenatus. This
requires less fragile work in Ruby by formatting the data in erlang
properly.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/plugins/erlang_spec.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/spec/unit/plugins/erlang_spec.rb b/spec/unit/plugins/erlang_spec.rb index b7f51f14..968ec033 100644 --- a/spec/unit/plugins/erlang_spec.rb +++ b/spec/unit/plugins/erlang_spec.rb @@ -25,10 +25,10 @@ describe Ohai::System, "plugin erlang" do before(:each) do plugin[:languages] = Mash.new erl_v_output = "Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 7.3\n" - erl_systeminfo_output = "\"18\"\r\n\"7.3\"\r\n\"2.10\"\r\n" + erl_systeminfo_output = "19.1,8.1,2.11" allow(plugin).to receive(:shell_out).with("erl +V") .and_return(mock_shell_out(0, "", erl_v_output)) - allow(plugin).to receive(:shell_out).with("erl -eval 'erlang:display(erlang:system_info(otp_release)), erlang:display(erlang:system_info(version)), erlang:display(erlang:system_info(nif_version)), halt().' -noshell") + allow(plugin).to receive(:shell_out).with("erl -eval '{ok, Ver} = file:read_file(filename:join([code:root_dir(), \"releases\", erlang:system_info(otp_release), \"OTP_VERSION\"])), Vsn = binary:bin_to_list(Ver, {0, byte_size(Ver) - 1}), io:format(\"~s,~s,~s\", [Vsn, erlang:system_info(version), erlang:system_info(nif_version)]), halt().' -noshell") .and_return(mock_shell_out(0, erl_systeminfo_output, "")) end @@ -44,17 +44,17 @@ describe Ohai::System, "plugin erlang" do it "sets languages[:erlang][:version]" do plugin.run - expect(plugin.languages[:erlang][:version]).to eql("18") + expect(plugin.languages[:erlang][:version]).to eql("19.1") end it "sets languages[:erlang][:erts_version]" do plugin.run - expect(plugin.languages[:erlang][:erts_version]).to eql("7.3") + expect(plugin.languages[:erlang][:erts_version]).to eql("8.1") end it "sets languages[:erlang][:nif_version]" do plugin.run - expect(plugin.languages[:erlang][:nif_version]).to eql("2.10") + expect(plugin.languages[:erlang][:nif_version]).to eql("2.11") end it "does not set languages[:erlang] if the erl commands fails" do |