From b252dfa82b44bc561264bb68bb7c1bc2e3acac18 Mon Sep 17 00:00:00 2001 From: John McCrae Date: Thu, 31 Mar 2022 12:47:28 -0700 Subject: updating the gem for Ruby 3.1 Signed-off-by: John McCrae --- lib/wmi-lite/wmi.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" -- cgit v1.2.1 From 47d4813c902b1efd80ff4acfd6c0393c14dabc9b Mon Sep 17 00:00:00 2001 From: John McCrae Date: Thu, 31 Mar 2022 13:56:24 -0700 Subject: updated pipleline to test against Ruby 3.x and narrowed down the list of OS variables to compare Signed-off-by: John McCrae --- .expeditor/verify.pipeline.yml | 15 +++++++++++++++ spec/functional/wmi_spec.rb | 27 ++++++++++++--------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index 3fd88d2..56794f8 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -16,6 +16,7 @@ steps: executor: docker: image: ruby:2.4-buster + - label: run-specs-ruby-2.5 command: - .expeditor/run_linux_tests.sh rake @@ -23,6 +24,7 @@ steps: executor: docker: image: ruby:2.5-buster + - label: run-specs-ruby-2.6 command: - .expeditor/run_linux_tests.sh rake @@ -30,6 +32,7 @@ steps: executor: docker: image: ruby:2.6-buster + - label: run-specs-ruby-2.7 command: - .expeditor/run_linux_tests.sh rake @@ -37,6 +40,7 @@ steps: executor: docker: image: ruby:2.7-buster + - label: run-specs-windows command: - bundle config set --local without docs debug @@ -46,3 +50,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/spec/functional/wmi_spec.rb b/spec/functional/wmi_spec.rb index e6bfe0e..0c9d5ea 100644 --- a/spec/functional/wmi_spec.rb +++ b/spec/functional/wmi_spec.rb @@ -115,10 +115,15 @@ 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'. + # + # 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 + + ignore = { "path" => true, "pathext" => true, "processor_architecture" => true, "psmodulepath" => true, "username" => true } results.each do |result| if ! variables.key?(result["name"]) || result["username"] != "" @@ -126,22 +131,14 @@ describe WmiLite::Wmi, :windows_only do end end - verified_count = 0 - variables.each_pair do |name, value| - if ignore[name.downcase] != true - - # Turn %SYSTEMROOT% into c:\windows - # so we can compare with what's in ENV - evaluated_value = `echo #{value}`.strip + 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) - 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 -- cgit v1.2.1 From f2e3505921bb6dea1e7a77b584f13f4da8e919fa Mon Sep 17 00:00:00 2001 From: John McCrae Date: Thu, 31 Mar 2022 13:59:04 -0700 Subject: updated pipleline to test against Ruby 3.x and narrowed down the list of OS variables to compare Signed-off-by: John McCrae --- spec/functional/wmi_spec.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/spec/functional/wmi_spec.rb b/spec/functional/wmi_spec.rb index 0c9d5ea..5b3668c 100644 --- a/spec/functional/wmi_spec.rb +++ b/spec/functional/wmi_spec.rb @@ -122,8 +122,6 @@ describe WmiLite::Wmi, :windows_only do # # 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 - - ignore = { "path" => true, "pathext" => true, "processor_architecture" => true, "psmodulepath" => true, "username" => true } results.each do |result| if ! variables.key?(result["name"]) || result["username"] != "" @@ -135,7 +133,6 @@ describe WmiLite::Wmi, :windows_only do processor_count_from_ruby = `echo #{ENV["NUMBER_OF_PROCESSORS"]}`.strip expect(processor_count_from_wmi).to eql(processor_count_from_ruby) - 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}/) -- cgit v1.2.1 From 84f7cff9ece6f7ae7dcc189997a7e105f20b4c95 Mon Sep 17 00:00:00 2001 From: John McCrae Date: Thu, 31 Mar 2022 14:05:57 -0700 Subject: updated pipleline to test against Ruby 3.x and narrowed down the list of OS variables to compare Signed-off-by: John McCrae --- spec/functional/wmi_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/functional/wmi_spec.rb b/spec/functional/wmi_spec.rb index 5b3668c..aaeebe1 100644 --- a/spec/functional/wmi_spec.rb +++ b/spec/functional/wmi_spec.rb @@ -122,7 +122,6 @@ describe WmiLite::Wmi, :windows_only do # # 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 - ignore = { "path" => true, "pathext" => true, "processor_architecture" => true, "psmodulepath" => true, "username" => true } results.each do |result| if ! variables.key?(result["name"]) || result["username"] != "" variables[result["name"]] = result["variablevalue"] -- cgit v1.2.1 From d6fb523a84efd8f468886c2e0a1cf725fbc92ab8 Mon Sep 17 00:00:00 2001 From: John McCrae Date: Thu, 31 Mar 2022 14:13:46 -0700 Subject: updated pipleline to test against Ruby 3.x and narrowed down the list of OS variables to compare, dropped Ruby 2.4 testing over outdated dependencies Signed-off-by: John McCrae --- .expeditor/verify.pipeline.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index 56794f8..580c5fb 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -9,14 +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 -- cgit v1.2.1