diff options
author | Serdar Sutay <serdar@opscode.com> | 2014-01-09 13:12:14 -0800 |
---|---|---|
committer | Serdar Sutay <serdar@opscode.com> | 2014-01-09 13:12:14 -0800 |
commit | 90988200ccb18d8e68e5467777bcf5112eb65f03 (patch) | |
tree | 3f8d00f895b914cbb6b905794ae2c00481c6c94a | |
parent | 01792df11904c587a7f8c366bac613dc92fd6cb4 (diff) | |
parent | a24e46e25963a67505d2fd1e540d5dc4d6959385 (diff) | |
download | ohai-90988200ccb18d8e68e5467777bcf5112eb65f03.tar.gz |
Merge pull request #269 from opscode/OC-10057
Move Ohai Platform Simulation tests to its own directory under spec.
28 files changed, 463 insertions, 225 deletions
diff --git a/platform_simulation_specs/README.md b/platform_simulation_specs/README.md new file mode 100644 index 00000000..3a5a1c15 --- /dev/null +++ b/platform_simulation_specs/README.md @@ -0,0 +1,5 @@ +# Ohai Platform Simulation Tests + +These tests are experimental tests that test Ohai simulating platforms. + +Currently these tests are disabled.
\ No newline at end of file diff --git a/platform_simulation_specs/common/lib/libc.so.6 b/platform_simulation_specs/common/lib/libc.so.6 new file mode 100755 index 00000000..e20d9e88 --- /dev/null +++ b/platform_simulation_specs/common/lib/libc.so.6 @@ -0,0 +1,6 @@ +#!/Users/serdar/.rbenv/versions/1.9.3-p385/bin/ruby + +require 'yaml' +require '/Users/serdar/oc/ohai/spec/platform_simulation/common/ohai_plugin_common.rb' + +OhaiPluginCommon.fake_command OhaiPluginCommon.read_output( '___lib___libc.so.6' ), 'centos-5.5', 'x64', [] diff --git a/platform_simulation_specs/common/lib/libc.so.6.bat b/platform_simulation_specs/common/lib/libc.so.6.bat new file mode 100644 index 00000000..44bc5cd9 --- /dev/null +++ b/platform_simulation_specs/common/lib/libc.so.6.bat @@ -0,0 +1 @@ +@/Users/serdar/.rbenv/versions/1.9.3-p385/bin/ruby /Users/serdar/oc/ohai/spec/platform_simulation/common/lib/libc.so.6 %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/platform_simulation_specs/common/lib64/libc.so.6 b/platform_simulation_specs/common/lib64/libc.so.6 new file mode 100755 index 00000000..d84e8fdd --- /dev/null +++ b/platform_simulation_specs/common/lib64/libc.so.6 @@ -0,0 +1,6 @@ +#!/Users/serdar/.rbenv/versions/1.9.3-p385/bin/ruby + +require 'yaml' +require '/Users/serdar/oc/ohai/spec/platform_simulation/common/ohai_plugin_common.rb' + +OhaiPluginCommon.fake_command OhaiPluginCommon.read_output( '___lib64___libc.so.6' ), 'centos-5.5', 'x64', [] diff --git a/platform_simulation_specs/common/lib64/libc.so.6.bat b/platform_simulation_specs/common/lib64/libc.so.6.bat new file mode 100644 index 00000000..abbadd24 --- /dev/null +++ b/platform_simulation_specs/common/lib64/libc.so.6.bat @@ -0,0 +1 @@ +@/Users/serdar/.rbenv/versions/1.9.3-p385/bin/ruby /Users/serdar/oc/ohai/spec/platform_simulation/common/lib64/libc.so.6 %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/spec/unit/path/ohai_plugin_common.rb b/platform_simulation_specs/common/ohai_plugin_common.rb index ecc57e7a..3087536c 100644 --- a/spec/unit/path/ohai_plugin_common.rb +++ b/platform_simulation_specs/common/ohai_plugin_common.rb @@ -30,25 +30,25 @@ module OhaiPluginCommon # platform = ENV['OHAI_TEST_PLATFORM'] # arch = ENV['OHAI_TEST_ARCH'] # env = ENV['OHAI_TEST_ENVIRONMENT'] - + # env = JSON.load(env) - + argv = ARGV.map { |arg| if /\ / =~ arg then "\"" + arg + "\"" else arg end }.join ' ' match = data[platform][arch].select{ |v| v[:params] == argv && v[:env] == env } - + raise "No canned output for these settings." if match.empty? raise "More than one set of data matches these parameters." if match.size > 1 match = match[0] - + $stdout.puts match[:stdout] if match[:stdout] != '' $stderr.puts match[:stderr] if match[:stderr] != '' exit match[:exit_status] end - + def data_path File.expand_path(File.dirname(__FILE__) + '../../../data/plugins') end - + def get_path(path = '') File.expand_path(File.dirname(__FILE__) + path) end @@ -64,7 +64,7 @@ module OhaiPluginCommon @data = Class.new do @instances - #DSL - make a list of hashes with + #DSL - make a list of hashes with def push(param, value) @instances ||= [] @instances[0] ||= {} @@ -112,9 +112,9 @@ eos # prep fake executable data for writing to a file def data_to_string(data) - a = data.map do |platform,v| - v.map do |arch,v| - v.map do |e| + a = data.map do |platform,v| + v.map do |arch,v| + v.map do |e| to_fake_exe_format platform, arch, e[:env], e[:params], e[:stdout], e[:stderr], e[:exit_status] end end @@ -165,7 +165,7 @@ eof @#{File.join( RbConfig::CONFIG['bindir'], 'ruby' )} #{cmd_path} %1 %2 %3 %4 %5 %6 %7 %8 %9 eof File.open(bat_path, "w") { |f| f.puts bat } - + # sleep 0.01 until File.exists? cmd_path Mixlib::ShellOut.new("chmod 755 #{cmd_path}").run_command end @@ -195,11 +195,12 @@ end # test that a plugin conforms populates ohai with the correct data def test_plugin(plugin_names, cmd_list) - puts "Functional testing is temporary disabled until plugin reloading is resolved." + # + # Current platform simulation tests are disabled. Remove the line below + # in order to enable the platform simulation tests. + # return - require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')) - # clean the path directory, in case a previous test was interrupted OhaiPluginCommon.clean_path OhaiPluginCommon.get_path, /^.*\.rb$/ @@ -217,15 +218,15 @@ def test_plugin(plugin_names, cmd_list) describe "and the environment is #{env}" do path = OhaiPluginCommon.get_path cmd_not_found = Set.new - + begin # preserve the path old_path = ENV[ 'PATH' ] - + # create fake executables cmd_list.each do | c | data = OhaiPluginCommon.read_output( c.gsub( /\//, OhaiPluginCommon::FAKE_SEP )) - + data = data[platform][arch].select { |f| f[:env] == env } if data.all? { |f| ( /not found/ =~ f[:stderr] ) && f[:exit_status] == 127 } cmd_not_found.add c @@ -233,7 +234,7 @@ def test_plugin(plugin_names, cmd_list) OhaiPluginCommon.create_exe c, path, platform, arch, env end end - + # capture all executions in path dir ENV['PATH'] = path Ohai.instance_eval do @@ -241,10 +242,11 @@ def test_plugin(plugin_names, cmd_list) File.join( OhaiPluginCommon.get_path, abs_path ) end end - + @ohai = Ohai::System.new plugin_names.each do | plugin_name | @plugin = get_plugin(plugin_name, @ohai, OhaiPluginCommon.plugin_path) + raise "Can not find plugin #{plugin_name}" if @plugin.nil? @plugin.safe_run end ensure @@ -256,7 +258,7 @@ def test_plugin(plugin_names, cmd_list) ENV['PATH'] = old_path OhaiPluginCommon.clean_path OhaiPluginCommon.get_path, /^.*\.rb$/ end - + enc = Yajl::Encoder subsumes?( @ohai.data, ohai ) do | path, source, test | path_txt = path.map { |p| "[#{enc.encode( p )}]" }.join diff --git a/spec/unit/path/ohai_plugin_common_spec.rb b/platform_simulation_specs/common/ohai_plugin_common_spec.rb index 5ea81ee5..5ea81ee5 100644 --- a/spec/unit/path/ohai_plugin_common_spec.rb +++ b/platform_simulation_specs/common/ohai_plugin_common_spec.rb diff --git a/platform_simulation_specs/plugins/c_spec.rb b/platform_simulation_specs/plugins/c_spec.rb new file mode 100644 index 00000000..fea35c51 --- /dev/null +++ b/platform_simulation_specs/plugins/c_spec.rb @@ -0,0 +1,56 @@ + +# Author:: Doug MacEachern <dougm@vmware.com> +# Copyright:: Copyright (c) 2010 VMware, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'rbconfig' + +require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')) +require File.expand_path( File.join( File.dirname( __FILE__ ), '..', 'common', 'ohai_plugin_common.rb' )) + +describe Ohai::System, "plugin c" do + test_plugin([ "languages", "c" ], [ "/lib/libc.so.6", "/lib64/libc.so.6", "gcc", "cl", "devenv.com", "xlc", "cc", "what" ]) do | p | + p.test([ "centos-5.5" ], [ "x64" ], [[]], { "languages" => { "c" => { + "gcc" => { "version" => "4.1.2", "description" => "gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)" }, + "glibc" => { "version" => "2.5" , "description" => "GNU C Library stable release version 2.5, by Roland McGrath et al." }, + "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil }}}) + p.test([ "centos-6.2" ], [ "x86", "x64" ], [[]], { "languages" => { "c" => { + "gcc" => { "version" => "4.4.6", "description" => "gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) " }, + "glibc" => { "version" => "2.12", "description" => "GNU C Library stable release version 2.12, by Roland McGrath et al." }, + "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil }}}) + p.test([ "ubuntu-10.04" ], [ "x86", "x64" ], [[]], + { "languages" => { "c" => { + "glibc" => { "version" => "2.11.1", "description" => "GNU C Library (Ubuntu EGLIBC 2.11.1-0ubuntu7.12) stable release version 2.11.1, by Roland McGrath et al." }, + "gcc" => nil, "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil }}}) + p.test([ "ubuntu-12.04", "ubuntu-13.04" ], [ "x86", "x64" ], [[]], { "languages" => { "c" => nil }}, "OC-9993") + p.test([ "ubuntu-12.10" ], [ "x64" ], [[]], { "languages" => { "c" => nil }}, "OC-9993") + p.test([ "centos-5.5" ], [ "x64" ], [[ "gcc" ]], { "languages" => { "c" => { + "gcc" => { "version" => "4.1.2", "description" => "gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)" }, + "glibc" => { "version" => "2.5", "description" => "GNU C Library stable release version 2.5, by Roland McGrath et al." }, + "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil }}}) + p.test([ "centos-6.2" ], [ "x86", "x64" ], [[ "gcc" ]], { "languages" => { "c" => { + "gcc" => { "version" => "4.4.7", "description" => "gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) " }, + "glibc" => { "version" => "2.12", "description" => "GNU C Library stable release version 2.12, by Roland McGrath et al." }, + "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil }}}) + p.test([ "ubuntu-10.04" ], [ "x86", "x64" ], [[ "gcc" ]], { "languages" => { "c" => { + "gcc" => { "version" => "4.4.3", "description" => "gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1) " }, + "glibc" => { "version" => "2.11.1", "description" => "GNU C Library (Ubuntu EGLIBC 2.11.1-0ubuntu7.12) stable release version 2.11.1, by Roland McGrath et al." }, + "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil }}}) + p.test([ "ubuntu-12.04" ], [ "x86", "x64" ], [[ "gcc" ]], { "languages" => { "c" => { + "gcc" => { "version" => "4.6.3", "description" => "gcc verison 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) " }, + "glibc" => nil, "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil }}}, "OC-9993" ) + end +end diff --git a/platform_simulation_specs/plugins/erlang_spec.rb b/platform_simulation_specs/plugins/erlang_spec.rb new file mode 100644 index 00000000..fcee1e64 --- /dev/null +++ b/platform_simulation_specs/plugins/erlang_spec.rb @@ -0,0 +1,39 @@ +# +# Author:: Adam Jacob (<adam@opscode.com>) +# Author:: Theodore Nordsieck (<theo@opscode.com>) +# Copyright:: Copyright (c) 2008-2013 Opscode, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'json' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require File.expand_path( File.join( File.dirname( __FILE__ ), '..', 'common', 'ohai_plugin_common.rb' )) + +describe Ohai::System, "plugin erlang" do + test_plugin([ "languages", "erlang" ], [ "erl" ]) do | p | + p.test([ "centos-5.9", "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[]], + { "languages" => { "erlang" => nil }}) + p.test([ "ubuntu-13.04" ], [ "x64" ], [[]], + { "languages" => { "erlang" => nil }}) + p.test([ "centos-5.9", "centos-6.4" ], [ "x86", "x64" ], [[ "erlang" ]], + { "languages" => { "erlang" => { "version" => "5.8.5", "options" => [ "ASYNC_THREADS" ], "emulator" => "BEAM" }}}) + p.test([ "ubuntu-10.04" ], [ "x86", "x64" ], [[ "erlang" ]], + { "languages" => { "erlang" => { "version" => "5.7.4", "options" => [ "ASYNC_THREADS", "HIPE" ], "emulator" => "BEAM" }}}) + p.test([ "ubuntu-12.04" ], [ "x86", "x64" ], [[ "erlang" ]], + { "languages" => { "erlang" => { "version" => "5.8.5", "options" => [ "ASYNC_THREADS" ], "emulator" => "BEAM" }}}) + p.test([ "ubuntu-13.04" ], [ "x64" ], [[ "erlang" ]], + { "languages" => { "erlang" => { "version" => "5.9.1", "options" => [ "ASYNC_THREADS" ], "emulator" => "BEAM" }}}) + end +end diff --git a/platform_simulation_specs/plugins/groovy_spec.rb b/platform_simulation_specs/plugins/groovy_spec.rb new file mode 100644 index 00000000..72697d04 --- /dev/null +++ b/platform_simulation_specs/plugins/groovy_spec.rb @@ -0,0 +1,40 @@ +# +# Author:: Doug MacEachern <dougm@vmware.com> +# Copyright:: Copyright (c) 2009 VMware, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')) +require File.expand_path( File.join( File.dirname( __FILE__ ), '..', 'common', 'ohai_plugin_common.rb' )) + +describe Ohai::System, "plugin groovy" do + test_plugin([ "languages", "groovy" ], [ "groovy" ]) do | p | + p.test([ "centos-5.5", "ubuntu-12.10" ], [ "x64" ], [[]], + { "languages" => { "groovy" => nil }}) + p.test([ "centos-6.2", "ubuntu-12.04", "ubuntu-13.04" ], [ "x86", "x64" ], [[]], + { "languages" => { "groovy" => nil }}) + p.test([ "centos-5.5" ], [ "x64" ], [[ "java", "groovy" ]], + { "languages" => { "groovy" => { "version" => "2.1.7" }}}) + p.test([ "centos-6.2" ], [ "x86", "x64" ], [[ "java", "groovy" ]], + { "languages" => { "groovy" => { "version" => "2.1.7" }}}) + p.test([ "ubuntu-10.04" ], [ "x86", "x64" ], [[ "java", "groovy" ]], + { "languages" => { "groovy" => { "version" => "1.6.4" }}}) + p.test([ "ubuntu-12.04", "ubuntu-13.04" ], [ "x86", "x64" ], [[ "java", "groovy" ]], + { "languages" => { "groovy" => { "version" => "1.8.6" }}}) + p.test([ "ubuntu-12.10" ], [ "x64" ], [[ "java", "groovy" ]], + { "languages" => { "groovy" => { "version" => "1.8.6" }}}) + end +end diff --git a/platform_simulation_specs/plugins/java_spec.rb b/platform_simulation_specs/plugins/java_spec.rb new file mode 100644 index 00000000..96b156a7 --- /dev/null +++ b/platform_simulation_specs/plugins/java_spec.rb @@ -0,0 +1,66 @@ +# +# Author:: Benjamin Black (<bb@opscode.com>) +# Author:: Theodore Nordsieck (<theo@opscode.com>) +# Copyright:: Copyright (c) 2009-2013 Opscode, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require File.expand_path( File.join( File.dirname( __FILE__ ), '..', 'common', 'ohai_plugin_common.rb' )) + +describe Ohai::System, "plugin java (Java5 Client VM)" do + test_plugin([ "languages", "java" ], [ "java" ]) do | p | + p.test([ "centos-5.9", "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[]], + { "languages" => { "java" => nil }}) + p.test([ "ubuntu-13.04" ], [ "x64" ], [[]], + { "languages" => { "java" => nil }}) + p.test([ "centos-5.9" ], [ "x86" ], [["java"]], + { "languages" => { "java" => { "version" => "1.6.0_24", + "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.11.11.90)", "build" => "rhel-1.41.1.11.11.90.el5_9-i386" }, + "hotspot" => { "name" => "OpenJDK Client VM", "build" => "20.0-b12, mixed mode" }}}}) + p.test([ "centos-5.9" ], [ "x64" ], [["java"]], + { "languages" => { "java" => { "version" => "1.6.0_24", + "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.11.11.90)", "build" => "rhel-1.41.1.11.11.90.el5_9-x86_64" }, + "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" }}}}) + p.test([ "centos-6.4" ], [ "x86" ], [["java"]], + { "languages" => { "java" => { "version" => "1.6.0_24", + "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.11.11.90)", "build" => "rhel-1.62.1.11.11.90.el6_4-i386" }, + "hotspot" => { "name" => "OpenJDK Client VM", "build" => "20.0-b12, mixed mode" }}}}) + p.test([ "centos-6.4" ], [ "x64" ], [["java"]], + { "languages" => { "java" => { "version" => "1.6.0_24", + "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.11.11.90)", "build" => "rhel-1.62.1.11.11.90.el6_4-x86_64" }, + "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" }}}}) + p.test([ "ubuntu-10.04" ], [ "x86" ], [["java"]], + { "languages" => { "java" => { "version" => "1.6.0_27", + "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-0ubuntu0.10.04.1" }, + "hotspot" => { "name" => "OpenJDK Client VM", "build" => "20.0-b12, mixed mode, sharing" }}}}) + p.test([ "ubuntu-10.04" ], [ "x64" ], [["java"]], + { "languages" => { "java" => { "version" => "1.6.0_27", + "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-0ubuntu0.10.04.1" }, + "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" }}}}) + p.test([ "ubuntu-12.04" ], [ "x86" ], [["java"]], + { "languages" => { "java" => { "version" => "1.6.0_27", + "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-0ubuntu0.12.04.1" }, + "hotspot" => { "name" => "OpenJDK Client VM", "build" => "20.0-b12, mixed mode, sharing" }}}}) + p.test([ "ubuntu-12.04" ], [ "x64" ], [["java"]], + { "languages" => { "java" => { "version" => "1.6.0_27", + "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-0ubuntu0.12.04.1" }, + "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" }}}}) + p.test([ "ubuntu-13.04" ], [ "x64" ], [["java"]], + { "languages" => { "java" => { "version" => "1.6.0_27", + "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-1ubuntu1" }, + "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" }}}}) + end +end diff --git a/platform_simulation_specs/plugins/kernel_spec.rb b/platform_simulation_specs/plugins/kernel_spec.rb new file mode 100644 index 00000000..8929c329 --- /dev/null +++ b/platform_simulation_specs/plugins/kernel_spec.rb @@ -0,0 +1,30 @@ +# +# Author:: Adam Jacob (<adam@opscode.com>) +# Author:: Theodore Nordsieck (<theo@opscode.com>) +# Copyright:: Copyright (c) 2008-2013 Opscode, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper.rb') +require File.expand_path( File.join( File.dirname( __FILE__ ), '..', 'common', 'ohai_plugin_common.rb' )) + +describe Ohai::System, "Linux kernel plugin" do + test_plugin([ "kernel" ], [ "uname", "env" ]) do | p | + p.test([ "centos-5.9", "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[]], + { "kernel" => { "os" => "GNU/Linux" }}) + p.test([ "ubuntu-13.04" ], [ "x64" ], [[]], + { "kernel" => { "os" => "GNU/Linux" }}) + end +end diff --git a/platform_simulation_specs/plugins/lua_spec.rb b/platform_simulation_specs/plugins/lua_spec.rb new file mode 100644 index 00000000..28d9166e --- /dev/null +++ b/platform_simulation_specs/plugins/lua_spec.rb @@ -0,0 +1,38 @@ +# +# Author:: Doug MacEachern <dougm@vmware.com> +# Author:: Theodore Nordsieck (<theo@opscode.com>) +# Copyright:: Copyright (c) 2009 VMware, Inc. +# Copyright:: Copyright (c) 2013 Opscode, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')) +require File.expand_path( File.join( File.dirname( __FILE__ ), '..', 'common', 'ohai_plugin_common.rb' )) + +describe Ohai::System, "plugin lua" do + test_plugin([ "languages", "lua" ], [ "lua" ]) do | p | + p.test([ "centos-6.4" ], ["x86", "x64"], [[], ["lua"]], + { "languages" => { "lua" => { "version" => "5.1.4" }}}) + p.test([ "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[]], + { "languages" => { "lua" => nil }}) + p.test([ "ubuntu-13.04" ], [ "x64" ], [[]], + { "languages" => { "lua" => nil }}) + p.test([ "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[ "lua" ]], + { "languages" => { "lua" => { "version" => "5.1.4" }}}) + p.test([ "ubuntu-13.04" ], [ "x64" ], [["lua"]], + { "languages" => { "lua" => { "version" => "5.1.5" }}}) + end +end diff --git a/platform_simulation_specs/plugins/nodejs_spec.rb b/platform_simulation_specs/plugins/nodejs_spec.rb new file mode 100644 index 00000000..b2277039 --- /dev/null +++ b/platform_simulation_specs/plugins/nodejs_spec.rb @@ -0,0 +1,35 @@ +# +# Author:: Jacques Marneweck (<jacques@powertrip.co.za>) +# Author:: Theodore Nordsieck (<theo@opscode.com>) +# Copyright:: Copyright (c) Jacques Marneweck +# Copyright:: Copyright (c) 2013 Opscode, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')) +require File.expand_path( File.join( File.dirname( __FILE__ ), '..', 'common', 'ohai_plugin_common.rb' )) + +describe Ohai::System, "plugin nodejs" do + test_plugin([ "languages", "nodejs" ], [ "node" ]) do | p | + p.test([ "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[]], + { "languages" => { "nodejs" => nil }}) + p.test([ "ubuntu-13.04" ], [ "x64" ], [[]], + { "languages" => { "nodejs" => nil }}) + p.test([ "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[ "nodejs" ]], + { "languages" => { "nodejs" => { "version" => "0.10.2" }}}) + p.test([ "ubuntu-13.04" ], [ "x64" ], [[ "nodejs" ]], + { "languages" => { "nodejs" => { "version" => "0.10.2" }}}) + end +end diff --git a/platform_simulation_specs/plugins/perl_spec.rb b/platform_simulation_specs/plugins/perl_spec.rb new file mode 100644 index 00000000..a275633f --- /dev/null +++ b/platform_simulation_specs/plugins/perl_spec.rb @@ -0,0 +1,42 @@ +# +# Author:: Joshua Timberman(<joshua@opscode.com>) +# Author:: Theodore Nordsieck (<theo@opscode.com>) +# Copyright:: Copyright (c) 2009-2013 Opscode, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require File.expand_path( File.join( File.dirname( __FILE__ ), '..', 'common', 'ohai_plugin_common.rb' )) + +describe Ohai::System, "plugin perl" do + test_plugin([ "languages", "perl" ], [ "perl" ]) do | p | + p.test([ "centos-5.9" ], [ "x86" ], [[], [ "perl" ]], + { "languages" => { "perl" => { "version" => "5.8.8", "archname" => "i386-linux-thread-multi" }}}) + p.test([ "centos-5.9" ], [ "x64" ], [[], [ "perl" ]], + { "languages" => { "perl" => { "version" => "5.8.8", "archname" => "x86_64-linux-thread-multi" }}}) + p.test([ "centos-6.4" ], [ "x86" ], [[], [ "perl" ]], + { "languages" => { "perl" => { "version" => "5.10.1", "archname" => "i386-linux-thread-multi" }}}) + p.test([ "centos-6.4" ], [ "x64" ], [[], [ "perl" ]], + { "languages" => { "perl" => { "version" => "5.10.1", "archname" => "x86_64-linux-thread-multi" }}}) + p.test([ "ubuntu-10.04" ], [ "x86" ], [[], [ "perl" ]], + { "languages" => { "perl" => { "version" => "5.10.1", "archname" => "i486-linux-gnu-thread-multi" }}}) + p.test([ "ubuntu-10.04" ], [ "x64" ], [[], [ "perl" ]], + { "languages" => { "perl" => { "version" => "5.10.1", "archname" => "x86_64-linux-gnu-thread-multi" }}}) + p.test([ "ubuntu-12.04" ], [ "x86" ], [[], [ "perl" ]], + { "languages" => { "perl" => { "version" => "5.14.2", "archname" => "i686-linux-gnu-thread-multi-64int" }}}) + p.test([ "ubuntu-12.04", "ubuntu-13.04" ], [ "x64" ], [[], [ "perl" ]], + { "languages" => { "perl" => { "version" => "5.14.2", "archname" => "x86_64-linux-gnu-thread-multi" }}}) + end +end diff --git a/platform_simulation_specs/plugins/php_spec.rb b/platform_simulation_specs/plugins/php_spec.rb new file mode 100644 index 00000000..2956360c --- /dev/null +++ b/platform_simulation_specs/plugins/php_spec.rb @@ -0,0 +1,39 @@ +# +# Author:: Doug MacEachern <dougm@vmware.com> +# Author:: Theodore Nordsieck (<theo@opscode.com>) +# Copyright:: Copyright (c) 2009 VMware, Inc. +# Copyright:: Copyright (c) 2013 Opscode, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')) +require File.expand_path( File.join( File.dirname( __FILE__ ), '..', 'common', 'ohai_plugin_common.rb' )) + +describe Ohai::System, "plugin php" do + test_plugin([ "languages", "php" ], [ "php" ]) do | p | + p.test([ "centos-5.9", "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[]], + { "languages" => { "php" => nil }}) + p.test([ "ubuntu-13.04" ], [ "x64" ], [[]], + { "languages" => { "php" => nil }}) + p.test([ "centos-5.9", "centos-6.4" ], [ "x86", "x64" ], [[ "php" ]], + { "languages" => { "php" => { "version" => "5.3.3" }}}) + p.test([ "ubuntu-10.04" ], ["x86", "x64"], [[ "php" ]], + { "languages" => { "php" => { "version" => "5.3.2-1ubuntu4.20" }}}) + p.test([ "ubuntu-12.04" ], [ "x86", "x64" ], [[ "php" ]], + { "languages" => { "php" => { "version" => "5.3.10-1ubuntu3.7" }}}) + p.test([ "ubuntu-13.04" ], [ "x64" ], [[ "php" ]], + { "languages" => { "php" => { "version" => "5.4.9-4ubuntu2.2" }}}) + end +end diff --git a/platform_simulation_specs/plugins/python_spec.rb b/platform_simulation_specs/plugins/python_spec.rb new file mode 100644 index 00000000..fbabb2e4 --- /dev/null +++ b/platform_simulation_specs/plugins/python_spec.rb @@ -0,0 +1,37 @@ +# +# Author:: Adam Jacob (<adam@opscode.com>) +# Author:: Theodore Nordsieck (<theo@opscode.com>) +# Copyright:: Copyright (c) 2008-2013 Opscode, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require File.expand_path( File.join( File.dirname( __FILE__ ), '..', 'common', 'ohai_plugin_common.rb' )) + +describe Ohai::System, "plugin python" do + test_plugin([ "languages", "python" ], [ "python" ]) do | p | + p.test([ "centos-5.9" ], [ "x86", "x64" ], [[], [ "python" ]], + { "languages" => { "python" => { "version" => "2.4.3" }}}) + p.test([ "centos-6.4" ], [ "x86", "x64" ], [[], [ "python" ]], + { "languages" => { "python" => { "version" => "2.6.6" }}}) + p.test([ "ubuntu-10.04" ], [ "x86", "x64" ], [[], [ "python" ]], + { "languages" => { "python" => { "version" => "2.6.5" }}}) + p.test([ "ubuntu-12.04" ], [ "x86", "x64" ], [[], [ "python" ]], + { "languages" => { "python" => { "version" => "2.7.3"}}}) + p.test([ "ubuntu-13.04" ], ["x64"], [[], ["python"]], + { "languages" => { "python" => { "version" => "2.7.4"}}}) + end +end diff --git a/bin/grab_data.rb b/platform_simulation_specs/tools/grab_data.rb index 10489d02..10489d02 100644 --- a/bin/grab_data.rb +++ b/platform_simulation_specs/tools/grab_data.rb diff --git a/spec/unit/plugins/c_spec.rb b/spec/unit/plugins/c_spec.rb index 33daa21c..9668317e 100644 --- a/spec/unit/plugins/c_spec.rb +++ b/spec/unit/plugins/c_spec.rb @@ -305,37 +305,4 @@ describe Ohai::System, "plugin c" do @plugin[:languages][:c].should_not have_key(:hpcc) if @plugin[:languages][:c] end - require File.expand_path( File.join( File.dirname( __FILE__ ), '..', 'path', 'ohai_plugin_common.rb' )) - - test_plugin([ "languages", "c" ], [ "/lib/libc.so.6", "/lib64/libc.so.6", "gcc", "cl", "devenv.com", "xlc", "cc", "what" ]) do | p | - p.test([ "centos-5.5" ], [ "x64" ], [[]], { "languages" => { "c" => { - "gcc" => { "version" => "4.1.2", "description" => "gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)" }, - "glibc" => { "version" => "2.5" , "description" => "GNU C Library stable release version 2.5, by Roland McGrath et al." }, - "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil }}}) - p.test([ "centos-6.2" ], [ "x86", "x64" ], [[]], { "languages" => { "c" => { - "gcc" => { "version" => "4.4.6", "description" => "gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) " }, - "glibc" => { "version" => "2.12", "description" => "GNU C Library stable release version 2.12, by Roland McGrath et al." }, - "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil }}}) - p.test([ "ubuntu-10.04" ], [ "x86", "x64" ], [[]], - { "languages" => { "c" => { - "glibc" => { "version" => "2.11.1", "description" => "GNU C Library (Ubuntu EGLIBC 2.11.1-0ubuntu7.12) stable release version 2.11.1, by Roland McGrath et al." }, - "gcc" => nil, "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil }}}) - p.test([ "ubuntu-12.04", "ubuntu-13.04" ], [ "x86", "x64" ], [[]], { "languages" => { "c" => nil }}, "OC-9993") - p.test([ "ubuntu-12.10" ], [ "x64" ], [[]], { "languages" => { "c" => nil }}, "OC-9993") - p.test([ "centos-5.5" ], [ "x64" ], [[ "gcc" ]], { "languages" => { "c" => { - "gcc" => { "version" => "4.1.2", "description" => "gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)" }, - "glibc" => { "version" => "2.5", "description" => "GNU C Library stable release version 2.5, by Roland McGrath et al." }, - "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil }}}) - p.test([ "centos-6.2" ], [ "x86", "x64" ], [[ "gcc" ]], { "languages" => { "c" => { - "gcc" => { "version" => "4.4.7", "description" => "gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) " }, - "glibc" => { "version" => "2.12", "description" => "GNU C Library stable release version 2.12, by Roland McGrath et al." }, - "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil }}}) - p.test([ "ubuntu-10.04" ], [ "x86", "x64" ], [[ "gcc" ]], { "languages" => { "c" => { - "gcc" => { "version" => "4.4.3", "description" => "gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1) " }, - "glibc" => { "version" => "2.11.1", "description" => "GNU C Library (Ubuntu EGLIBC 2.11.1-0ubuntu7.12) stable release version 2.11.1, by Roland McGrath et al." }, - "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil }}}) - p.test([ "ubuntu-12.04" ], [ "x86", "x64" ], [[ "gcc" ]], { "languages" => { "c" => { - "gcc" => { "version" => "4.6.3", "description" => "gcc verison 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) " }, - "glibc" => nil, "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil }}}, "OC-9993" ) - end end diff --git a/spec/unit/plugins/erlang_spec.rb b/spec/unit/plugins/erlang_spec.rb index fc7a2cb1..97c5cb14 100644 --- a/spec/unit/plugins/erlang_spec.rb +++ b/spec/unit/plugins/erlang_spec.rb @@ -19,7 +19,6 @@ require 'json' require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') -require File.expand_path(File.join(File.dirname(__FILE__), '..', 'path', 'ohai_plugin_common.rb')) describe Ohai::System, "plugin erlang" do @@ -59,21 +58,4 @@ describe Ohai::System, "plugin erlang" do @plugin.languages.should_not have_key(:erlang) end - - ########## - - test_plugin([ "languages", "erlang" ], [ "erl" ]) do | p | - p.test([ "centos-5.9", "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[]], - { "languages" => { "erlang" => nil }}) - p.test([ "ubuntu-13.04" ], [ "x64" ], [[]], - { "languages" => { "erlang" => nil }}) - p.test([ "centos-5.9", "centos-6.4" ], [ "x86", "x64" ], [[ "erlang" ]], - { "languages" => { "erlang" => { "version" => "5.8.5", "options" => [ "ASYNC_THREADS" ], "emulator" => "BEAM" }}}) - p.test([ "ubuntu-10.04" ], [ "x86", "x64" ], [[ "erlang" ]], - { "languages" => { "erlang" => { "version" => "5.7.4", "options" => [ "ASYNC_THREADS", "HIPE" ], "emulator" => "BEAM" }}}) - p.test([ "ubuntu-12.04" ], [ "x86", "x64" ], [[ "erlang" ]], - { "languages" => { "erlang" => { "version" => "5.8.5", "options" => [ "ASYNC_THREADS" ], "emulator" => "BEAM" }}}) - p.test([ "ubuntu-13.04" ], [ "x64" ], [[ "erlang" ]], - { "languages" => { "erlang" => { "version" => "5.9.1", "options" => [ "ASYNC_THREADS" ], "emulator" => "BEAM" }}}) - end end diff --git a/spec/unit/plugins/groovy_spec.rb b/spec/unit/plugins/groovy_spec.rb index 5d072d16..81a1c557 100644 --- a/spec/unit/plugins/groovy_spec.rb +++ b/spec/unit/plugins/groovy_spec.rb @@ -18,7 +18,6 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')) -require File.expand_path(File.join(File.dirname(__FILE__), '..', 'path', 'ohai_plugin_common.rb')) describe Ohai::System, "plugin groovy" do @@ -45,20 +44,4 @@ describe Ohai::System, "plugin groovy" do @plugin.languages.should_not have_key(:groovy) end - test_plugin([ "languages", "groovy" ], [ "groovy" ]) do | p | - p.test([ "centos-5.5", "ubuntu-12.10" ], [ "x64" ], [[]], - { "languages" => { "groovy" => nil }}) - p.test([ "centos-6.2", "ubuntu-12.04", "ubuntu-13.04" ], [ "x86", "x64" ], [[]], - { "languages" => { "groovy" => nil }}) - p.test([ "centos-5.5" ], [ "x64" ], [[ "java", "groovy" ]], - { "languages" => { "groovy" => { "version" => "2.1.7" }}}) - p.test([ "centos-6.2" ], [ "x86", "x64" ], [[ "java", "groovy" ]], - { "languages" => { "groovy" => { "version" => "2.1.7" }}}) - p.test([ "ubuntu-10.04" ], [ "x86", "x64" ], [[ "java", "groovy" ]], - { "languages" => { "groovy" => { "version" => "1.6.4" }}}) - p.test([ "ubuntu-12.04", "ubuntu-13.04" ], [ "x86", "x64" ], [[ "java", "groovy" ]], - { "languages" => { "groovy" => { "version" => "1.8.6" }}}) - p.test([ "ubuntu-12.10" ], [ "x64" ], [[ "java", "groovy" ]], - { "languages" => { "groovy" => { "version" => "1.8.6" }}}) - end end diff --git a/spec/unit/plugins/java_spec.rb b/spec/unit/plugins/java_spec.rb index cc3e3e0a..13f29996 100644 --- a/spec/unit/plugins/java_spec.rb +++ b/spec/unit/plugins/java_spec.rb @@ -166,51 +166,4 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do end end - - ########### - - require File.expand_path(File.dirname(__FILE__) + '/../path/ohai_plugin_common.rb') - - test_plugin([ "languages", "java" ], [ "java" ]) do | p | - p.test([ "centos-5.9", "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[]], - { "languages" => { "java" => nil }}) - p.test([ "ubuntu-13.04" ], [ "x64" ], [[]], - { "languages" => { "java" => nil }}) - p.test([ "centos-5.9" ], [ "x86" ], [["java"]], - { "languages" => { "java" => { "version" => "1.6.0_24", - "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.11.11.90)", "build" => "rhel-1.41.1.11.11.90.el5_9-i386" }, - "hotspot" => { "name" => "OpenJDK Client VM", "build" => "20.0-b12, mixed mode" }}}}) - p.test([ "centos-5.9" ], [ "x64" ], [["java"]], - { "languages" => { "java" => { "version" => "1.6.0_24", - "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.11.11.90)", "build" => "rhel-1.41.1.11.11.90.el5_9-x86_64" }, - "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" }}}}) - p.test([ "centos-6.4" ], [ "x86" ], [["java"]], - { "languages" => { "java" => { "version" => "1.6.0_24", - "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.11.11.90)", "build" => "rhel-1.62.1.11.11.90.el6_4-i386" }, - "hotspot" => { "name" => "OpenJDK Client VM", "build" => "20.0-b12, mixed mode" }}}}) - p.test([ "centos-6.4" ], [ "x64" ], [["java"]], - { "languages" => { "java" => { "version" => "1.6.0_24", - "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.11.11.90)", "build" => "rhel-1.62.1.11.11.90.el6_4-x86_64" }, - "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" }}}}) - p.test([ "ubuntu-10.04" ], [ "x86" ], [["java"]], - { "languages" => { "java" => { "version" => "1.6.0_27", - "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-0ubuntu0.10.04.1" }, - "hotspot" => { "name" => "OpenJDK Client VM", "build" => "20.0-b12, mixed mode, sharing" }}}}) - p.test([ "ubuntu-10.04" ], [ "x64" ], [["java"]], - { "languages" => { "java" => { "version" => "1.6.0_27", - "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-0ubuntu0.10.04.1" }, - "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" }}}}) - p.test([ "ubuntu-12.04" ], [ "x86" ], [["java"]], - { "languages" => { "java" => { "version" => "1.6.0_27", - "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-0ubuntu0.12.04.1" }, - "hotspot" => { "name" => "OpenJDK Client VM", "build" => "20.0-b12, mixed mode, sharing" }}}}) - p.test([ "ubuntu-12.04" ], [ "x64" ], [["java"]], - { "languages" => { "java" => { "version" => "1.6.0_27", - "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-0ubuntu0.12.04.1" }, - "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" }}}}) - p.test([ "ubuntu-13.04" ], [ "x64" ], [["java"]], - { "languages" => { "java" => { "version" => "1.6.0_27", - "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-1ubuntu1" }, - "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" }}}}) - end end diff --git a/spec/unit/plugins/linux/kernel_spec.rb b/spec/unit/plugins/linux/kernel_spec.rb index 068b8f10..3105a4fd 100644 --- a/spec/unit/plugins/linux/kernel_spec.rb +++ b/spec/unit/plugins/linux/kernel_spec.rb @@ -18,7 +18,6 @@ # require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb') -require File.expand_path(File.dirname(__FILE__) + '/../../path/ohai_plugin_common.rb') describe Ohai::System, "Linux kernel plugin" do before(:each) do @@ -43,10 +42,4 @@ ENV_LSMOD it_should_check_from_deep_mash("linux::kernel", "kernel", "os", "uname -o", [0, "Linux", ""]) - test_plugin([ "kernel" ], [ "uname", "env" ]) do | p | - p.test([ "centos-5.9", "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[]], - { "kernel" => { "os" => "GNU/Linux" }}) - p.test([ "ubuntu-13.04" ], [ "x64" ], [[]], - { "kernel" => { "os" => "GNU/Linux" }}) - end end diff --git a/spec/unit/plugins/lua_spec.rb b/spec/unit/plugins/lua_spec.rb index 8dff19b6..16b34c7a 100644 --- a/spec/unit/plugins/lua_spec.rb +++ b/spec/unit/plugins/lua_spec.rb @@ -47,18 +47,4 @@ describe Ohai::System, "plugin lua" do @plugin.languages.should_not have_key(:lua) end - require File.expand_path(File.join(File.dirname(__FILE__), '..', 'path', '/ohai_plugin_common.rb')) - - test_plugin([ "languages", "lua" ], [ "lua" ]) do | p | - p.test([ "centos-6.4" ], ["x86", "x64"], [[], ["lua"]], - { "languages" => { "lua" => { "version" => "5.1.4" }}}) - p.test([ "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[]], - { "languages" => { "lua" => nil }}) - p.test([ "ubuntu-13.04" ], [ "x64" ], [[]], - { "languages" => { "lua" => nil }}) - p.test([ "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[ "lua" ]], - { "languages" => { "lua" => { "version" => "5.1.4" }}}) - p.test([ "ubuntu-13.04" ], [ "x64" ], [["lua"]], - { "languages" => { "lua" => { "version" => "5.1.5" }}}) - end end diff --git a/spec/unit/plugins/nodejs_spec.rb b/spec/unit/plugins/nodejs_spec.rb index 15a596af..14e5ae3c 100644 --- a/spec/unit/plugins/nodejs_spec.rb +++ b/spec/unit/plugins/nodejs_spec.rb @@ -46,18 +46,4 @@ describe Ohai::System, "plugin nodejs" do @plugin.languages.should_not have_key(:nodejs) end - ############# - - require File.expand_path(File.dirname(__FILE__) + '/../path/ohai_plugin_common.rb') - - test_plugin([ "languages", "nodejs" ], [ "node" ]) do | p | - p.test([ "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[]], - { "languages" => { "nodejs" => nil }}) - p.test([ "ubuntu-13.04" ], [ "x64" ], [[]], - { "languages" => { "nodejs" => nil }}) - p.test([ "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[ "nodejs" ]], - { "languages" => { "nodejs" => { "version" => "0.10.2" }}}) - p.test([ "ubuntu-13.04" ], [ "x64" ], [[ "nodejs" ]], - { "languages" => { "nodejs" => { "version" => "0.10.2" }}}) - end end diff --git a/spec/unit/plugins/perl_spec.rb b/spec/unit/plugins/perl_spec.rb index 1922a3cf..0e84dfee 100644 --- a/spec/unit/plugins/perl_spec.rb +++ b/spec/unit/plugins/perl_spec.rb @@ -55,26 +55,4 @@ describe Ohai::System, "plugin perl" do @plugin.languages.should_not have_key(:perl) end - ######### - - require File.expand_path(File.join(File.dirname(__FILE__), '..', 'path', 'ohai_plugin_common.rb')) - - test_plugin([ "languages", "perl" ], [ "perl" ]) do | p | - p.test([ "centos-5.9" ], [ "x86" ], [[], [ "perl" ]], - { "languages" => { "perl" => { "version" => "5.8.8", "archname" => "i386-linux-thread-multi" }}}) - p.test([ "centos-5.9" ], [ "x64" ], [[], [ "perl" ]], - { "languages" => { "perl" => { "version" => "5.8.8", "archname" => "x86_64-linux-thread-multi" }}}) - p.test([ "centos-6.4" ], [ "x86" ], [[], [ "perl" ]], - { "languages" => { "perl" => { "version" => "5.10.1", "archname" => "i386-linux-thread-multi" }}}) - p.test([ "centos-6.4" ], [ "x64" ], [[], [ "perl" ]], - { "languages" => { "perl" => { "version" => "5.10.1", "archname" => "x86_64-linux-thread-multi" }}}) - p.test([ "ubuntu-10.04" ], [ "x86" ], [[], [ "perl" ]], - { "languages" => { "perl" => { "version" => "5.10.1", "archname" => "i486-linux-gnu-thread-multi" }}}) - p.test([ "ubuntu-10.04" ], [ "x64" ], [[], [ "perl" ]], - { "languages" => { "perl" => { "version" => "5.10.1", "archname" => "x86_64-linux-gnu-thread-multi" }}}) - p.test([ "ubuntu-12.04" ], [ "x86" ], [[], [ "perl" ]], - { "languages" => { "perl" => { "version" => "5.14.2", "archname" => "i686-linux-gnu-thread-multi-64int" }}}) - p.test([ "ubuntu-12.04", "ubuntu-13.04" ], [ "x64" ], [[], [ "perl" ]], - { "languages" => { "perl" => { "version" => "5.14.2", "archname" => "x86_64-linux-gnu-thread-multi" }}}) - end end diff --git a/spec/unit/plugins/php_spec.rb b/spec/unit/plugins/php_spec.rb index 0cf011e0..0046a665 100644 --- a/spec/unit/plugins/php_spec.rb +++ b/spec/unit/plugins/php_spec.rb @@ -20,7 +20,6 @@ require 'json' require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')) -require File.expand_path(File.join(File.dirname(__FILE__), '..', 'path', 'ohai_plugin_common.rb')) describe Ohai::System, "plugin php" do @@ -55,20 +54,4 @@ describe Ohai::System, "plugin php" do @plugin.languages[:php][:builddate].should eql("Aug 30 2013 04:30:30") end - ######### - - test_plugin([ "languages", "php" ], [ "php" ]) do | p | - p.test([ "centos-5.9", "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], [ "x86", "x64" ], [[]], - { "languages" => { "php" => nil }}) - p.test([ "ubuntu-13.04" ], [ "x64" ], [[]], - { "languages" => { "php" => nil }}) - p.test([ "centos-5.9", "centos-6.4" ], [ "x86", "x64" ], [[ "php" ]], - { "languages" => { "php" => { "version" => "5.3.3" }}}) - p.test([ "ubuntu-10.04" ], ["x86", "x64"], [[ "php" ]], - { "languages" => { "php" => { "version" => "5.3.2-1ubuntu4.20" }}}) - p.test([ "ubuntu-12.04" ], [ "x86", "x64" ], [[ "php" ]], - { "languages" => { "php" => { "version" => "5.3.10-1ubuntu3.7" }}}) - p.test([ "ubuntu-13.04" ], [ "x64" ], [[ "php" ]], - { "languages" => { "php" => { "version" => "5.4.9-4ubuntu2.2" }}}) - end end diff --git a/spec/unit/plugins/python_spec.rb b/spec/unit/plugins/python_spec.rb index 68ef48c6..85892fc2 100644 --- a/spec/unit/plugins/python_spec.rb +++ b/spec/unit/plugins/python_spec.rb @@ -46,20 +46,4 @@ describe Ohai::System, "plugin python" do @plugin.languages.should_not have_key(:python) end - ########## - - require File.expand_path(File.dirname(__FILE__) + '/../path/ohai_plugin_common.rb') - - test_plugin([ "languages", "python" ], [ "python" ]) do | p | - p.test([ "centos-5.9" ], [ "x86", "x64" ], [[], [ "python" ]], - { "languages" => { "python" => { "version" => "2.4.3" }}}) - p.test([ "centos-6.4" ], [ "x86", "x64" ], [[], [ "python" ]], - { "languages" => { "python" => { "version" => "2.6.6" }}}) - p.test([ "ubuntu-10.04" ], [ "x86", "x64" ], [[], [ "python" ]], - { "languages" => { "python" => { "version" => "2.6.5" }}}) - p.test([ "ubuntu-12.04" ], [ "x86", "x64" ], [[], [ "python" ]], - { "languages" => { "python" => { "version" => "2.7.3"}}}) - p.test([ "ubuntu-13.04" ], ["x64"], [[], ["python"]], - { "languages" => { "python" => { "version" => "2.7.4"}}}) - end end |