diff options
author | John McCrae <john.mccrae@progress.com> | 2022-03-31 13:56:24 -0700 |
---|---|---|
committer | John McCrae <john.mccrae@progress.com> | 2022-03-31 13:56:24 -0700 |
commit | 47d4813c902b1efd80ff4acfd6c0393c14dabc9b (patch) | |
tree | a251ef721fb2bef184c5b9b765381d49e4ce343f | |
parent | b252dfa82b44bc561264bb68bb7c1bc2e3acac18 (diff) | |
download | wmi-lite-47d4813c902b1efd80ff4acfd6c0393c14dabc9b.tar.gz |
updated pipleline to test against Ruby 3.x and narrowed down the list of OS variables to compare
Signed-off-by: John McCrae <john.mccrae@progress.com>
-rw-r--r-- | .expeditor/verify.pipeline.yml | 15 | ||||
-rw-r--r-- | 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"] != "<SYSTEM>" @@ -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 |