.. | ||
esxbox | ||
images | ||
vcsim | ||
.gitignore | ||
boot_order_test.sh | ||
clean.sh | ||
cli.bats | ||
datacenter.bats | ||
datastore_file_manager_test.sh | ||
datastore_tail_test.sh | ||
datastore.bats | ||
device.bats | ||
esxcli.bats | ||
events.bats | ||
extension.bats | ||
fields.bats | ||
firewall.bats | ||
folder.bats | ||
govc-sim | ||
guest_operations_test.sh | ||
host_cert_sign.sh | ||
host.bats | ||
import.bats | ||
license.bats | ||
logs.bats | ||
ls.bats | ||
metric_info_test.sh | ||
metric.bats | ||
network.bats | ||
object.bats | ||
pool.bats | ||
README.md | ||
role.bats | ||
session.bats | ||
test_helper.bash | ||
vm.bats |
Functional tests for govc
Bats
Install Bats
coreutils
Install gxargs, greadlink and gmktemp on Darwin
brew install coreutils
brew install findutils
Download test images
Some tests depend on ttylinux images, these can be downloaded by running:
./images/update.sh
These images are uploaded to the esxbox as needed by tests and can be removed with the following command:
./clean.sh
GOVC_TEST_URL
The govc tests need an ESX instance to run against. The default
GOVC_TEST_URL
is that of the vagrant box in the esxbox directory:
(cd esxbox && vagrant up)
Any other ESX box can be used by exporting the following variable:
export GOVC_TEST_URL=user:pass@hostname
vCenter Simulator
Some tests require vCenter and depend on the Vagrant box in the vcsim directory. These tests are skipped if the vcsim box is not running. To enable these tests:
(cd vcsim && vagrant up)
Running tests
The test helper prepends ../govc to PATH
.
The tests can be run from any directory, as govc is found related to
PATH
and images are found relative to $BATS_TEST_DIRNAME
.
The entire suite can be run with the following command:
cd $GOPATH/github.com/vmware/govmomi/govc
go build -v .
bats test
Or individually, for example:
./test/cli.bats