Skip to content

Commit

Permalink
(maint) fix the tests so that they actually run
Browse files Browse the repository at this point in the history
* Add testresults to the .gitignore file
* Change the Vagrant box, nano doesn't appear to have whoami and so
  fails to load kitchen-pester at all. I also haven't found a 2012r2 box
  that actually boots. 2016 was the earliest I could find.
* Update provisioning to install nuget provider and set TLS. Both seem
  required to get the rest to actually work.
* Add a bare bones TESTING.md file since the PR template says to use
  them.
* Rename test directory to tests as that's the default location for
  tests.

Signed-off-by: Cory Knox <[email protected]>
  • Loading branch information
corbob committed Feb 7, 2022
1 parent 1918212 commit 7f1012e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Gemfile.lock
.kitchen/*
**/.kitchen/*
*.gem
testresults/*
6 changes: 4 additions & 2 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ provisioner:
script: provision.ps1

platforms:
- name: windows-nano
- name: windows-2016
driver_config:
box: mwrock/WindowsNano
box: stefanscherer/windows_2016

verifier:
name: pester
remove_builtin_pester: false
remove_builtin_powershellget: false

suites:
- name: default
11 changes: 11 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Local testing of kitchen-pester

Testing of `kitchen-pester` is done via `kitchen-pester` in `test-kitchen`.

The `provision.ps1` file is used to prepare the environment, then tests are run in `test/integration/default/pester/default.tests.ps1`.

The general steps to test your changes:

1. Build new gem: `chef gem build ./kitchen-pester.gemspec`
1. Install built gem: `chef gem install ./kitchen-pester-<version>.gem`
1. Test with `test-kitchen`: `kitchen test`
2 changes: 2 additions & 0 deletions provision.ps1
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Install-PackageProvider Nuget -Force
Set-Content -Path "$env:Temp\test.txt" -Value 'testing'

0 comments on commit 7f1012e

Please sign in to comment.