diff options
-rw-r--r-- | .expeditor/verify.pipeline.yml | 21 | ||||
-rw-r--r-- | lib/wmi-lite/wmi.rb | 2 | ||||
-rw-r--r-- | spec/functional/wmi_spec.rb | 27 |
3 files changed, 25 insertions, 25 deletions
diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index 3fd88d2..580c5fb 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -9,13 +9,6 @@ expeditor: steps: -- label: run-specs-ruby-2.4 - command: - - .expeditor/run_linux_tests.sh rake - expeditor: - executor: - docker: - image: ruby:2.4-buster - label: run-specs-ruby-2.5 command: - .expeditor/run_linux_tests.sh rake @@ -23,6 +16,7 @@ steps: executor: docker: image: ruby:2.5-buster + - label: run-specs-ruby-2.6 command: - .expeditor/run_linux_tests.sh rake @@ -30,6 +24,7 @@ steps: executor: docker: image: ruby:2.6-buster + - label: run-specs-ruby-2.7 command: - .expeditor/run_linux_tests.sh rake @@ -37,6 +32,7 @@ steps: executor: docker: image: ruby:2.7-buster + - label: run-specs-windows command: - bundle config set --local without docs debug @@ -46,3 +42,14 @@ steps: executor: docker: host_os: windows + +- label: "Unit and Functional Testing Windows :ruby: 3.0" + command: + - bundle config set --local without docs debug + - bundle install --jobs=7 --retry=3 + - bundle exec rake spec + expeditor: + executor: + docker: + host_os: windows + image: rubydistros/windows-2019:3.0 diff --git a/lib/wmi-lite/wmi.rb b/lib/wmi-lite/wmi.rb index e558c64..8c4b055 100644 --- a/lib/wmi-lite/wmi.rb +++ b/lib/wmi-lite/wmi.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require "win32ole" if RUBY_PLATFORM =~ /mswin|mingw32|windows/ +require "win32ole" if RUBY_PLATFORM =~ /mswin|mingw32|mingw|windows/ require_relative "wmi_instance" require_relative "wmi_exception" diff --git a/spec/functional/wmi_spec.rb b/spec/functional/wmi_spec.rb index e6bfe0e..aaeebe1 100644 --- a/spec/functional/wmi_spec.rb +++ b/spec/functional/wmi_spec.rb @@ -115,33 +115,26 @@ describe WmiLite::Wmi, :windows_only do variables = {} # Skip some environment variables because we can't compare them against what's in ENV. - # Path, pathext, psmodulepath are special, they ares "merged" between the user and system value. + # Path, pathext, psmodulepath are special, they are "merged" between the user and system value. # PROCESSOR_ARCHITECTURE is actually the real processor arch of the system, so #{ENV['processor_architecture']} will # report X86, while WMI will (correctly) report X64. # And username is oddly the username of the WMI service, i.e. 'SYSTEM'. - ignore = { "path" => true, "pathext" => true, "processor_architecture" => true, "psmodulepath" => true, "username" => true } + # + # Update 3/31/2022 + # There is no so much variability in the environment variables that we moved from sampling all of them to a select few results.each do |result| if ! variables.key?(result["name"]) || result["username"] != "<SYSTEM>" variables[result["name"]] = result["variablevalue"] end end - verified_count = 0 - variables.each_pair do |name, value| - if ignore[name.downcase] != true + processor_count_from_wmi = variables["NUMBER_OF_PROCESSORS"] + processor_count_from_ruby = `echo #{ENV["NUMBER_OF_PROCESSORS"]}`.strip + expect(processor_count_from_wmi).to eql(processor_count_from_ruby) - # Turn %SYSTEMROOT% into c:\windows - # so we can compare with what's in ENV - evaluated_value = `echo #{value}`.strip - - expect(evaluated_value).to eql(`echo #{ENV[name]}`.strip) - verified_count += 1 - end - end - - # There are at least 3 variables we could verify in a default - # Windows configuration, make sure we saw some - expect(verified_count).to be >= 3 + operating_system_from_wmi = variables["OS"] + operating_system_from_ruby = `echo #{ENV["OS"]}`.strip + expect(/#{operating_system_from_wmi}/).to eql(/#{operating_system_from_ruby}/) end end |