We have implemented unit tests using BATS. To run them all you may simply run test.
One of the more complex pieces of forklift to test is the install script.
If you want to test a custom or modified installer itself, this section is for you. You have two basic options:
- Simply run the install from your local repo:
bash <(cat install)
- Modify the
curl
command to reference the appropriate organization, repository and commit/tag/branch, as shown below:
Usage shows how to use the install script for install forklift, and example 5 shows how to use the it to import a pallet using forklift. Both of these examples have the following form (pick one depending on OS):
bash <(curl -L https://raw.githubusercontent.com/<INSTALLER_ORG>/<INSTALLER_REPO>/<INSTALLER_COMMIT>/install) <OPTIONAL FORKLIFT COMMAND>
$env:INSTALL_URL="https://raw.githubusercontent.com/<INSTALLER_ORG>/<INSTALLER_REPO>/<INSTALLER_COMMIT>/install"; (New-Object System.Net.WebClient).DownloadFile("$env:INSTALL_URL.ps1", "$pwd\install.ps1"); powershell -ExecutionPolicy Bypass .\install.ps1
If you want to try intalling a custom release, this is the section for you. This can be particularly helpful if you're modifying the post-import script for forklift itself.
The install script normally downloads and installs the most recent release of forklift.
This can be changed by setting the environment variable RELEASE_URL
when running the installer.
For example, the following command (pick one depending on OS) will install the HEAD
of the master
branch of forklift:
RELEASE_URL="https://github.com/g2forge/forklift/archive/master.zip" bash <(curl -L https://raw.githubusercontent.com/g2forge/forklift/master/install)
$env:RELEASE_URL="https://github.com/g2forge/forklift/archive/master.zip"; $env:INSTALL_URL="https://raw.githubusercontent.com/g2forge/forklift/master/install"; (New-Object System.Net.WebClient).DownloadFile("$env:INSTALL_URL.ps1", "$pwd\install.ps1"); powershell -ExecutionPolicy Bypass .\install.ps1
To obtain a usable RELEASE_URL
you can simply use the GitHub UI, as shown below.
Please note that the installer expects to receive a GitHub download URL for either a zipfile or tarball.
In the future we may modify it to support arbitrary URLs, but for now it needs metadata which is github specific.
- Tag the release:
git tag -m <TAG> <TAG>
where<TAG>
is of the form "v0.0.1" - Create a release on github using the new tag
- Update the
pom.xml
version. - Create the new milestone