Files
virtual-kubelet/vendor/github.com/vmware/govmomi/govc/test/import.bats
Loc Nguyen 513cebe7b7 VMware vSphere Integrated Containers provider (#206)
* Add Virtual Kubelet provider for VIC

Initial virtual kubelet provider for VMware VIC.  This provider currently
handles creating and starting of a pod VM via the VIC portlayer and persona
server.  Image store handling via the VIC persona server.  This provider
currently requires the feature/wolfpack branch of VIC.

* Added pod stop and delete.  Also added node capacity.

Added the ability to stop and delete pod VMs via VIC.  Also retrieve
node capacity information from the VCH.

* Cleanup and readme file

Some file clean up and added a Readme.md markdown file for the VIC
provider.

* Cleaned up errors, added function comments, moved operation code

1. Cleaned up error handling.  Set standard for creating errors.
2. Added method prototype comments for all interface functions.
3. Moved PodCreator, PodStarter, PodStopper, and PodDeleter to a new folder.

* Add mocking code and unit tests for podcache, podcreator, and podstarter

Used the unit test framework used in VIC to handle assertions in the provider's
unit test.  Mocking code generated using OSS project mockery, which is compatible
with the testify assertion framework.

* Vendored packages for the VIC provider

Requires feature/wolfpack branch of VIC and a few specific commit sha of
projects used within VIC.

* Implementation of POD Stopper and Deleter unit tests (#4)

* Updated files for initial PR
2018-06-04 15:41:32 -07:00

101 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bats
load test_helper
@test "import.ova" {
esx_env
run govc import.ova $GOVC_IMAGES/${TTYLINUX_NAME}.ova
assert_success
run govc vm.destroy ${TTYLINUX_NAME}
assert_success
}
@test "import.ova with iso" {
esx_env
run govc import.ova $GOVC_IMAGES/${TTYLINUX_NAME}-live.ova
assert_success
run govc vm.destroy ${TTYLINUX_NAME}-live
assert_success
}
@test "import.ovf" {
esx_env
run govc import.ovf $GOVC_IMAGES/${TTYLINUX_NAME}.ovf
assert_success
run govc vm.destroy ${TTYLINUX_NAME}
assert_success
# test w/ relative dir
pushd $BATS_TEST_DIRNAME >/dev/null
run govc import.ovf ./images/${TTYLINUX_NAME}.ovf
assert_success
popd >/dev/null
run govc vm.destroy ${TTYLINUX_NAME}
assert_success
}
@test "import.ovf with name in options" {
esx_env
name=$(new_id)
file=$($mktemp --tmpdir govc-test-XXXXX)
echo "{ \"Name\": \"${name}\"}" > ${file}
run govc import.ovf -options="${file}" $GOVC_IMAGES/${TTYLINUX_NAME}.ovf
assert_success
run govc vm.destroy "${name}"
assert_success
rm -f ${file}
}
@test "import.ovf with import.spec result" {
esx_env
file=$($mktemp --tmpdir govc-test-XXXXX)
name=$(new_id)
govc import.spec $GOVC_IMAGES/${TTYLINUX_NAME}.ovf > ${file}
run govc import.ovf -name="${name}" -options="${file}" $GOVC_IMAGES/${TTYLINUX_NAME}.ovf
assert_success
run govc vm.destroy "${name}"
assert_success
}
@test "import.ovf with name as argument" {
esx_env
name=$(new_id)
run govc import.ova -name="${name}" $GOVC_IMAGES/${TTYLINUX_NAME}.ova
assert_success
run govc vm.destroy "${name}"
assert_success
}
@test "import.vmdk" {
esx_env
name=$(new_id)
run govc import.vmdk "$GOVC_TEST_VMDK_SRC" "$name"
assert_success
run govc import.vmdk "$GOVC_TEST_VMDK_SRC" "$name"
assert_failure # exists
run govc import.vmdk -force "$GOVC_TEST_VMDK_SRC" "$name"
assert_success # exists, but -force was used
}