* 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
105 lines
3.0 KiB
Bash
105 lines
3.0 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load helpers
|
|
|
|
export DRIVER=virtualbox
|
|
export NAME="bats-$DRIVER-daemon-configs"
|
|
export MACHINE_STORAGE_PATH=/tmp/machine-bats-daemon-test-$DRIVER
|
|
# Default memsize is 1024MB and disksize is 20000MB
|
|
# These values are defined in drivers/virtualbox/virtualbox.go
|
|
export DEFAULT_MEMSIZE=1024
|
|
export DEFAULT_DISKSIZE=20000
|
|
export CUSTOM_MEMSIZE=1536
|
|
export CUSTOM_DISKSIZE=10000
|
|
export CUSTOM_CPUCOUNT=1
|
|
export BAD_URL="http://dev.null:9111/bad.iso"
|
|
|
|
function setup() {
|
|
# add sleep because vbox; ugh
|
|
sleep 1
|
|
}
|
|
|
|
findDiskSize() {
|
|
# SATA-0-0 is usually the boot2disk.iso image
|
|
# We assume that SATA 1-0 is root disk VMDK and grab this UUID
|
|
# e.g. "SATA-ImageUUID-1-0"="fb5f33a7-e4e3-4cb9-877c-f9415ae2adea"
|
|
# TODO(slashk): does this work on Windows ?
|
|
run bash -c "VBoxManage showvminfo --machinereadable $NAME | grep SATA-ImageUUID-1-0 | cut -d'=' -f2"
|
|
run bash -c "VBoxManage showhdinfo $output | grep "Capacity:" | awk -F' ' '{ print $2 }'"
|
|
}
|
|
|
|
findMemorySize() {
|
|
run bash -c "VBoxManage showvminfo --machinereadable $NAME | grep memory= | cut -d'=' -f2"
|
|
}
|
|
|
|
findCPUCount() {
|
|
run bash -c "VBoxManage showvminfo --machinereadable $NAME | grep cpus= | cut -d'=' -f2"
|
|
}
|
|
|
|
buildMachineWithOldIsoCheckUpgrade() {
|
|
run wget https://github.com/boot2docker/boot2docker/releases/download/v1.4.1/boot2docker.iso -O $MACHINE_STORAGE_PATH/cache/boot2docker.iso
|
|
run machine create -d virtualbox $NAME
|
|
run machine upgrade $NAME
|
|
}
|
|
|
|
@test "$DRIVER: machine should not exist" {
|
|
run machine active $NAME
|
|
[ "$status" -eq 1 ]
|
|
}
|
|
|
|
@test "$DRIVER: VM should not exist" {
|
|
run VBoxManage showvminfo $NAME
|
|
[ "$status" -eq 1 ]
|
|
}
|
|
|
|
@test "$DRIVER: create" {
|
|
run machine create -d $DRIVER $NAME
|
|
[ "$status" -eq 0 ]
|
|
}
|
|
|
|
@test "$DRIVER: active" {
|
|
run machine active $NAME
|
|
[ "$status" -eq 0 ]
|
|
}
|
|
|
|
@test "$DRIVER: check default machine memory size" {
|
|
findMemorySize
|
|
[[ ${output} == "${DEFAULT_MEMSIZE}" ]]
|
|
}
|
|
|
|
@test "$DRIVER: check default machine disksize" {
|
|
findDiskSize
|
|
[[ ${output} == *"$DEFAULT_DISKSIZE"* ]]
|
|
}
|
|
|
|
@test "$DRIVER: test bridge-ip" {
|
|
run machine ssh $NAME sudo /etc/init.d/docker stop
|
|
run machine ssh $NAME sudo ifconfig docker0 down
|
|
run machine ssh $NAME sudo ip link delete docker0
|
|
BIP='--bip=172.168.45.1/24'
|
|
set_extra_config $BIP
|
|
cat ${TMP_EXTRA_ARGS_FILE} | machine ssh $NAME sudo tee /var/lib/boot2docker/profile
|
|
cat ${DAEMON_CFG_FILE} | machine ssh $NAME "sudo tee -a /var/lib/boot2docker/profile"
|
|
run machine ssh $NAME sudo /etc/init.d/docker start
|
|
run machine ssh $NAME ifconfig docker0
|
|
[ "$status" -eq 0 ]
|
|
[[ ${lines[1]} =~ "172.168.45.1" ]]
|
|
}
|
|
|
|
@test "$DRIVER: run busybox container" {
|
|
run machine ssh $NAME sudo cat /var/lib/boot2docker/profile
|
|
run docker $(machine config $NAME) run busybox echo hello world
|
|
[ "$status" -eq 0 ]
|
|
}
|
|
|
|
@test "$DRIVER: remove machine" {
|
|
run machine rm -f $NAME
|
|
}
|
|
|
|
# Cleanup of machine store should always be the last 'test'
|
|
@test "$DRIVER: cleanup" {
|
|
run rm -rf $MACHINE_STORAGE_PATH
|
|
[ "$status" -eq 0 ]
|
|
}
|
|
|