Skip to content

Commit

Permalink
(doc) update readme/add testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ferventcoder committed Jan 12, 2016
1 parent cb5c0a2 commit bd7d8ab
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 12 deletions.
24 changes: 13 additions & 11 deletions ReadMe.md
@@ -1,20 +1,20 @@
# Package Verifier Vagrant
# Chocolatey Testing Environment

A vagrant setup similar to the package-verifier for manually testing packages.
A testing environment setup similar to the [package-verifier](https://github.com/chocolatey/package-verifier/wiki) for testing packages.

## Requirements

You need a computer with:

* a 64-bit processor and OS
* Intel VT-x [enabled](http://www.howtogeek.com/213795/how-to-enable-intel-vt-x-in-your-computers-bios-or-uefi-firmware/) (usually not an issue if your computer is newer than 2011).
* Intel VT-x [enabled](http://www.howtogeek.com/213795/how-to-enable-intel-vt-x-in-your-computers-bios-or-uefi-firmware/) (usually not an issue if your computer is newer than 2011). This is necessary because we are using 64bit VMs.
* Hyper-V may need to be disabled for Virtualbox to work properly if your computer is a Windows box.
* At least 10GB of free space.

## Setup

To get started, ensure you have the following installed:
* Vagrant 1.8.1+
* Vagrant 1.8.1+ - linked clones is the huge reason here. You can technically use any version of Vagrant 1.3.5+. But you will get the best performance with 1.8.x.
* Virtualbox 4.3.28+ (5.x may have issues, so try to stay in 4.3.x series)
* vagrant sahara plugin (`vagrant plugin install sahara`)

Expand All @@ -27,8 +27,9 @@ You can also install Vagrant/Virtualbox on Windows by running `choco install pac
### Preparing the Testing Environment

* Ensure setup above is good on your machine.
* Open a command line and navigate to the `vagrant` subdirectory of this repository.
* Run `vagrant up` to prepare the machine for testing. Note that it will take quite awhile the first time you need to download the [box from Atlas](https://atlas.hashicorp.com/ferventcoder/boxes/win2012r2-x64-nocm). Once it has downloaded it will import the box and apply the scripts and configurations to the box as listed inside the Vagrantfile.
* Open a command line (`PowerShell.exe`/`cmd.exe` on Windows, `bash` everywhere else) and navigate to this directory of the repository. You know you are in the right place when you do a `dir` or `ls` and `Vagrantfile` is in your path.
* No idea if bash on Windows (through Git/CygWin) is supported. If you run into issues, it is better to just use `PowerShell.exe` or `cmd.exe`. Please do not file issues stating it doesn't work.
* Run `vagrant up` to prepare the machine for testing. Note that it will take quite awhile the first time you need to download the [box from Atlas](https://atlas.hashicorp.com/ferventcoder/boxes/win2012r2-x64-nocm). Once it has downloaded it will import the box and apply the scripts and configurations to the box as listed inside the `Vagrantfile`.
* Now the box is ready for you to start testing against. Run `vagrant sandbox on`.

### Testing a Package
Expand All @@ -51,20 +52,21 @@ When you are ready to reset to the state just before installing:

* If you are finished with the vagrant box, you can remove your temporary copy with `vagrant destroy`.

## Differences Between This and Verifier Service
## Differences Between This and Package Verifier Service

There are a couple of difference between the verifier service and this environment.
There are a couple of difference between the [verifier service]() and this environment.

* The verifier is run without the GUI - meaning it is run in a headless state. There is no box to interact with.
* The verifier only runs against Windows 2012 R2 currently. This repo is adding more boxes as they become available.
* The verifier times out on waiting for a command after 12 minutes.
* Synced folders are different - it syncs the .chocolatey folder to gather the package information files.
* Synced folders are different - the verifier syncs the .chocolatey folder to gather the package information files.
* Specific VM settings are different (for performance):
* No GUI (as previously mentioned) - `v.gui = false`
* 6GB RAM - `v.customize ["modifyvm", :id, "--memory", "6144"]`
* 4 CPUs - `v.customize ["modifyvm", :id, "--cpus", "4"]`
* Clipboard disabled - `v.customize ["modifyvm", :id, "--clipboard", "disabled"]`
* Drag and Drop disabled - `v.customize ["modifyvm", :id, "--draganddrop", "disabled"]`

## Troubleshooting
## Troubleshooting

You get this error: "A Vagrant environment or target machine is required to run this command. Run `vagrant init` to create a new Vagrant environment. Or, get an ID of a target machine from `vagrant global-status` to run this command on. A final option is to change to a directory with a Vagrantfile and to try again." - please cd into the vagrant subdirectory of this repo and try again.
You get this error: "A Vagrant environment or target machine is required to run this command. Run `vagrant init` to create a new Vagrant environment. Or, get an ID of a target machine from `vagrant global-status` to run this command on. A final option is to change to a directory with a Vagrantfile and to try again." - please ensure you are on the correct working directory (where this ReadMe and `Vagrantfile` is) of this repo and try again.
29 changes: 29 additions & 0 deletions Testing.md
@@ -0,0 +1,29 @@
# Test examples


Installing latest version of a package from Chocolatey.org
~~~ruby
choco.exe install -fdvy nodejs.install
~~~

Retesting failing package from Chocolatey.org
~~~ruby
choco.exe install -fdvy github --version 3.0.11.0
~~~


After dropping badpackage.1.0.0.nupkg into the packages directory:
~~~ruby
choco.exe install -fdvy badpackage --source "'c:\\packages;http://chocolatey.org/api/v2/'"
~~~


For interactive testing of Chocolatey itself - please ignore if you are not doing so. Otherwise you need to share a folder with this box named code and have a temp folder in it where you drop the `code_drop\chocolatey\console\choco.exe` file to after building it from source.
~~~ruby
config.vm.synced_folder "code", "ABSOLUTE PATH TO CODE FOLDER"

config.vm.provision :shell, :powershell_elevated_interactive => true, :inline => <<SCRIPT
Copy-Item 'c:\\code\\temp\\choco.exe' 'c:\\ProgramData\\chocolatey\\choco.exe' -Force
choco.exe unpackself -f
SCRIPT
~~~
2 changes: 1 addition & 1 deletion Vagrantfile
Expand Up @@ -92,7 +92,7 @@ Write-Output "Testing package if a line is uncommented. Otherwise you will see a
# - uncomment one of the two and edit it appropriately
# - See the README for details
#choco.exe install -fdvy INSERT_NAME --version INSERT_VERSION
#choco.exe install -fdvy INSERT_NAME --source 'c:\\packages;http://chocolatey.org/api/v2/'"
#choco.exe install -fdvy INSERT_NAME --source "'c:\\packages;http://chocolatey.org/api/v2/'"
# vagrant has issues knowing that there was an error
if ($LASTEXITCODE -ne 0) {
Expand Down

0 comments on commit bd7d8ab

Please sign in to comment.