summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaymala Sinha <jsinha@chef.io>2019-09-27 15:03:34 -0400
committerJaymala Sinha <jsinha@chef.io>2019-09-27 15:03:34 -0400
commit9c3fe7b43ac95e0392bf62ef5930b117c7903ae1 (patch)
tree9f87f887e6dfbcc8da5180ce972c596131989ddc
parent2a98c165d1bd7dd5959c6e7b8d7d4699f6cb97c9 (diff)
downloadchef-9c3fe7b43ac95e0392bf62ef5930b117c7903ae1.tar.gz
Fix Windows Integration and Functional tests for BK
* 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.yml16
-rw-r--r--scripts/bk_tests/bk_run_choco.ps115
-rw-r--r--scripts/bk_tests/bk_win_functional.ps128
-rw-r--r--scripts/bk_tests/bk_win_integration.ps18
-rw-r--r--spec/integration/knife/chef_repo_path_spec.rb6
-rw-r--r--spec/spec_helper.rb2
6 files changed, 65 insertions, 10 deletions
diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml
index c45f2e9933..49dfb1035e 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 100644
--- 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 100644
--- 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 919741f930..7d98b7ad4e 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 @@ 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 -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 e19a06f3d7..27cf301d67 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -141,6 +141,8 @@ RSpec.configure do |config|
config.filter_run_excluding skip_appveyor: true if ENV["APPVEYOR"]
config.filter_run_excluding appveyor_only: true unless ENV["APPVEYOR"]
+ 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_windows: true if windows?
config.filter_run_excluding not_supported_on_macos: true if mac_osx?