diff options
author | Jaymala Sinha <jsinha@chef.io> | 2019-09-27 15:03:34 -0400 |
---|---|---|
committer | Jaymala Sinha <jsinha@chef.io> | 2019-10-01 10:12:05 -0400 |
commit | fab84885cf151365c378097a8036843f4e782e70 (patch) | |
tree | 54e4f155d32c2ec9083ad70c5b6a881b6d7fa846 | |
parent | b3599e009d2a70828e7742f02ea68d7d119336d3 (diff) | |
download | chef-fab84885cf151365c378097a8036843f4e782e70.tar.gz |
Fix Windows Integration and Functional tests for BKjsinha/migrate_appveyor
* Use default windows 2019 image
* Skip 8dot3name tests as default disabled on 2019
* Use windows privileged executor for functional tests
* Use windows docker image for chocolatey tests
Signed-off-by: Jaymala Sinha <jsinha@chef.io>
-rw-r--r-- | .expeditor/verify.pipeline.yml | 16 | ||||
-rw-r--r-- | scripts/bk_tests/bk_run_choco.ps1 | 15 | ||||
-rwxr-xr-x | scripts/bk_tests/bk_win_functional.ps1 | 28 | ||||
-rwxr-xr-x | scripts/bk_tests/bk_win_integration.ps1 | 8 | ||||
-rw-r--r-- | spec/integration/knife/chef_repo_path_spec.rb | 6 | ||||
-rw-r--r-- | spec/spec_helper.rb | 2 |
6 files changed, 65 insertions, 10 deletions
diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index 78336123b9..456d171c30 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -199,7 +199,6 @@ steps: executor: docker: host_os: windows - os_version: 2016 environment: - FORCE_FFI_YAJL=ext - CHEF_LICENSE=accept-no-persist @@ -207,15 +206,20 @@ steps: - label: "Functional Specs Windows :ruby: 2.6" commands: - - /workdir/scripts/bk_tests/bk_win_functional.ps1 + - scripts/bk_tests/bk_win_functional.ps1 + expeditor: + executor: + windows: + privileged: true + shell: ["powershell", "-Command"] + +- label: "Chocolatey Specs Windows :ruby: 2.6" + commands: + - /workdir/scripts/bk_tests/bk_run_choco.ps1 expeditor: executor: docker: host_os: windows - os_version: 2016 - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist shell: ["powershell", "-Command"] - label: "Unit Specs Windows :ruby: 2.6" diff --git a/scripts/bk_tests/bk_run_choco.ps1 b/scripts/bk_tests/bk_run_choco.ps1 new file mode 100644 index 0000000000..1d4b87a73a --- /dev/null +++ b/scripts/bk_tests/bk_run_choco.ps1 @@ -0,0 +1,15 @@ +echo "--- system details" +$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture' +Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize + +choco --version +ruby -v +bundle --version + +echo "--- bundle install" +bundle install --jobs=3 --retry=3 --without omnibus_package docgen chefstyle + +echo "+++ bundle exec rspec chocolatey_package_spec" +bundle exec rspec spec/functional/resource/chocolatey_package_spec.rb + +exit $LASTEXITCODE
\ No newline at end of file diff --git a/scripts/bk_tests/bk_win_functional.ps1 b/scripts/bk_tests/bk_win_functional.ps1 index 06695ccd97..085f22e40c 100755 --- a/scripts/bk_tests/bk_win_functional.ps1 +++ b/scripts/bk_tests/bk_win_functional.ps1 @@ -1,13 +1,39 @@ echo "--- system details" $Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture' Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize + +# chocolatey functional tests fail so delete the chocolatey binary to avoid triggering them +Remove-Item -Path C:\ProgramData\chocolatey\bin\choco.exe -ErrorAction SilentlyContinue + +# +# Software Languages +# + +# Install Ruby + Devkit +$ErrorActionPreference = 'Stop' + +echo "Downloading Ruby + DevKit" +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +(New-Object System.Net.WebClient).DownloadFile('https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.4-1/rubyinstaller-devkit-2.6.4-1-x64.exe', 'c:\\rubyinstaller-devkit-2.6.4-1-x64.exe') + +echo "Installing Ruby + DevKit" +Start-Process c:\rubyinstaller-devkit-2.6.4-1-x64.exe -ArgumentList '/verysilent /dir=C:\\ruby26' -Wait + +echo "Cleaning up installation" +Remove-Item c:\rubyinstaller-devkit-2.6.4-1-x64.exe -Force +echo "Closing out the layer (this can take awhile)" + +# Set-Item -Path Env:Path -Value to include ruby26 +$Env:Path+=";C:\ruby26\bin" + +winrm quickconfig -q ruby -v bundle --version echo "--- bundle install" bundle install --jobs=3 --retry=3 --without omnibus_package docgen chefstyle -echo "+++ bundle exec rake" +echo "+++ bundle exec rake spec:functional" bundle exec rake spec:functional exit $LASTEXITCODE
\ No newline at end of file diff --git a/scripts/bk_tests/bk_win_integration.ps1 b/scripts/bk_tests/bk_win_integration.ps1 index c6cdd5e2b1..546a9fbb91 100755 --- a/scripts/bk_tests/bk_win_integration.ps1 +++ b/scripts/bk_tests/bk_win_integration.ps1 @@ -1,13 +1,19 @@ echo "--- system details" $Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture' Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize + +# Set-Item -Path Env:Path -Value ($Env:Path + ";C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin") +$Env:Path="C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\ruby26\bin;C:\ci-studio-common\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Users\ContainerAdministrator\AppData\Local\Microsoft\WindowsApps;C:\Go\bin;C:\Users\ContainerAdministrator\go\bin" + +winrm quickconfig -q + ruby -v bundle --version echo "--- bundle install" bundle install --jobs=3 --retry=3 --without omnibus_package docgen chefstyle -echo "+++ bundle exec rake" +echo "+++ bundle exec rake spec:integration" bundle exec rake spec:integration exit $LASTEXITCODE
\ No newline at end of file diff --git a/spec/integration/knife/chef_repo_path_spec.rb b/spec/integration/knife/chef_repo_path_spec.rb index 9df0b9def9..9eb4e28df1 100644 --- a/spec/integration/knife/chef_repo_path_spec.rb +++ b/spec/integration/knife/chef_repo_path_spec.rb @@ -79,7 +79,8 @@ describe "chef_repo_path tests", :workstation do EOM end - it "knife list --local -Rfp --chef-repo-path chef_r~1 / grabs chef_repo2 stuff", :windows_only do + # "Skipping for BK... As Windows 2019 has 8dot3name disabled by default" + it "knife list --local -Rfp --chef-repo-path chef_r~1 / grabs chef_repo2 stuff", :windows_only, :skip_buildkite do Chef::Config.delete(:chef_repo_path) knife("list --local -Rfp --chef-repo-path #{path_to('chef_r~1')} /").should_succeed <<~EOM /clients/ @@ -101,7 +102,8 @@ EOM EOM end - it "knife list --local -Rfp --chef-repo-path chef_r~1 / grabs chef_repo2 stuff", :windows_only do + # "Skipping for BK... As Windows 2019 has 8dot3name disabled by default" + it "knife list --local -Rfp --chef-repo-path chef_r~1 / grabs chef_repo2 stuff", :windows_only, :skip_buildkite do Chef::Config.delete(:chef_repo_path) knife("list -z -Rfp --chef-repo-path #{path_to('chef_r~1')} /").should_succeed <<~EOM /acls/ diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 582e183b36..b52c7d171d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -142,6 +142,8 @@ RSpec.configure do |config| config.filter_run_excluding appveyor_only: true unless ENV["APPVEYOR"] config.filter_run_excluding skip_travis: true if ENV["TRAVIS"] + config.filter_run_excluding skip_buildkite: true if ENV["BUILDKITE"] + config.filter_run_excluding windows_only: true unless windows? config.filter_run_excluding not_supported_on_mac_osx: true if mac_osx? config.filter_run_excluding mac_osx_only: true if !mac_osx? |