-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
URL validation, improve macOS testing and testing guide (#8)
* Several improvements for Mac - Add URL validation for VSTS_URL variable - Update soon-to-be depracated node attributes from "set" to "default" - Use homebrew for installing openssl on macOS - More detailed and updated testing guide - Fix style and foodcritic
- Loading branch information
1 parent
a8a9ef4
commit d6c2655
Showing
21 changed files
with
200 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ bin | |
.kitchen.local.yml | ||
.coverage | ||
.kitchen/ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,67 @@ | ||
# Testing Documentation | ||
|
||
## Prerequisites | ||
VSTS Build Agent cookbook requires ChefDK installation. ChefDK can be downloaded at https://downloads.chef.io/chef-dk/ | ||
VSTS Build Agent cookbook requires ChefDK installation - download it [here](https://downloads.chef.io/chef-dk/). | ||
|
||
Integration testing uses Hashicorp's [Vagrant](https://www.vagrantup.com/downloads.html) and Oracle's [Virtualbox](https://www.virtualbox.org/wiki/Downloads), which must be installed first. | ||
|
||
## Style Testing | ||
Ruby and Chef([Foodcritic](http://www.foodcritic.io/)) style checks can be performed by running: | ||
``` | ||
chef exec rake style | ||
``` | ||
or | ||
``` | ||
rake style | ||
``` | ||
You'll also need the following from VSTS: | ||
- Username | ||
- [Account URL](https://www.visualstudio.com/en-us/get-started/setup/sign-up-for-visual-studio-online) | ||
- [Personal access token](http://roadtoalm.com/2015/07/22/using-personal-access-tokens-to-access-visual-studio-online/) | ||
- [Build pool name](http://blog.devmatter.com/understanding-pools-and-queues-in-vso/) | ||
|
||
### Integration testing using boxes and Virtualbox | ||
Integration tests are orchestrated by [test-kitchen](https://github.com/test-kitchen/test-kitchen). | ||
Although Linux boxes are freely available from Vagrant's repository, for Mac and Windows, you'll need to build your own using Hashicorp's [Packer](https://www.packer.io/). | ||
|
||
## Integration Testing | ||
Integration tests are orchestrated by [test-kitchen](https://github.com/test-kitchen/test-kitchen). Currently kitchen.yml contains mix of public(linux) and private boxes(Windows and MacOSX). Windows and MacOSX boxes can be built locally with help of Hashicorp's [packer](https://www.packer.io/) tool. | ||
:small_red_triangle:NOTE: To use MacOSX boxes you need an Apple-branded computer. | ||
#### Guides for building Mac and Windows boxes | ||
- [Mac VM templates for Packer and VeeWee](https://github.com/timsutton/osx-vm-templates) | ||
- [Windows Packer templates](https://github.com/joefitzgerald/packer-windows) | ||
- [Boxcutter](https://github.com/boxcutter) (All platforms) | ||
|
||
Additionally you need [vsts account url](https://www.visualstudio.com/en-us/get-started/setup/sign-up-for-visual-studio-online), username, [personal access token](http://roadtoalm.com/2015/07/22/using-personal-access-tokens-to-access-visual-studio-online/) and [pool name](http://blog.devmatter.com/understanding-pools-and-queues-in-vso/). | ||
|
||
Set environment variables | ||
### Running the tests | ||
#### Set environment variables | ||
|
||
on windows: | ||
Windows: | ||
``` | ||
set VSTS_URL=account.visualstudio.com | ||
set VSTS_URL='https://account.visualstudio.com' | ||
set VSTS_POOL=default | ||
set VSTS_USER=username | ||
set VSTS_TOKEN=my_secret_token_from_vsts | ||
``` | ||
on linux or macosx: | ||
Linux / Mac: | ||
``` | ||
export VSTS_URL=account.visualstudio.com | ||
export VSTS_URL='https://account.visualstudio.com' | ||
export VSTS_POOL=default | ||
export VSTS_USER=username | ||
export VSTS_TOKEN=my_secret_token_from_vsts | ||
``` | ||
|
||
To run test against specific platform run: | ||
If the username of the box you're testing differs from standard "vagrant": | ||
``` | ||
export BOX_USERNAME=username | ||
``` | ||
|
||
#### Executing the tests | ||
The `kitchen test` instance states are in order: destroy, create, converge, setup, verify, destroy. `kitchen test` changes the state of one or more instances to destroyed, then executes the actions for each state up to destroy. At any sign of failure, executing the actions stops and the instance is left in the last successful execution state. | ||
``` | ||
kitchen verify PLATFORM | ||
kitchen test VAGRANT_BOX_NAME | ||
``` | ||
|
||
Available platforms: | ||
* debian8 (public) | ||
* ubuntu1604 (public) | ||
* osx109-desktop (private) | ||
* windows10 (private) | ||
#### Examples: | ||
`$ kitchen test osx1010` | ||
`$ kitchen test windows_2012_r2` | ||
`$ kitchen test ubuntu1604` | ||
|
||
|
||
:small_red_triangle: The Windows and Mac boxes must be [built](#guides-for-building-mac-and-windows-boxes) prior to testing. Once built, you'll need to modify the `.kitchen.yml` file. To find out list of available boxes and their names, simply execute `vagrant box list`. See the [Chef documentation](https://docs.chef.io/config_yml_kitchen.html) or comments in `.kitchen.yml` for how to modify it for your boxes. | ||
|
||
#### Style Testing | ||
Several style checks can be performed by running any of the following: | ||
|
||
`$ chef exec rake style` | ||
`$ rake style` | ||
`$ foodcritic .` | ||
`$ rubocop .` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.